I'm using Spanner API from Java8 GAE Standard App's http servlet, and when I try to execute a query in response to a GET request, I see the following exception in the logs, after which my request seem to hang
java.lang.NullPointerException
at com.google.apphosting.runtime.ApiProxyImpl$CurrentRequestThreadFactory.newThread(ApiProxyImpl.java:1267)
at com.google.common.util.concurrent.ThreadFactoryBuilder$1.newThread(ThreadFactoryBuilder.java:162)
at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:612)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:925)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1368)
at io.grpc.internal.DelayedClientTransport.reprocess(DelayedClientTransport.java:305)
at io.grpc.internal.ManagedChannelImpl$LbHelperImpl$5.run(ManagedChannelImpl.java:733)
at io.grpc.internal.ChannelExecutor.drain(ChannelExecutor.java:87)
at io.grpc.internal.DelayedClientTransport.newStream(DelayedClientTransport.java:185)
at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:222)
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:47)
at com.google.cloud.spanner.spi.v1.WatchdogInterceptor$MonitoredCall.start(WatchdogInterceptor.java:194)
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:47)
at com.google.cloud.spanner.spi.v1.SpannerErrorInterceptor$1.start(SpannerErrorInterceptor.java:67)
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:47)
at com.google.cloud.spanner.spi.v1.GrpcSpannerRpc$MetadataClientCall.start(GrpcSpannerRpc.java:466)
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:276)
at io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:252)
at io.grpc.stub.ClientCalls.futureUnaryCall(ClientCalls.java:186)
at com.google.cloud.spanner.spi.v1.GrpcSpannerRpc.doUnaryCall(GrpcSpannerRpc.java:430)
at com.google.cloud.spanner.spi.v1.GrpcSpannerRpc.createSession(GrpcSpannerRpc.java:333)
at com.google.cloud.spanner.SpannerImpl$2.call(SpannerImpl.java:221)
at com.google.cloud.spanner.SpannerImpl$2.call(SpannerImpl.java:218)
at com.google.cloud.spanner.SpannerImpl.runWithRetries(SpannerImpl.java:200)
at com.google.cloud.spanner.SpannerImpl.createSession(SpannerImpl.java:217)
at com.google.cloud.spanner.SessionPool$4.run(SessionPool.java:1063)
The test code I'm using is taken from the Spanner examples:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
<version>0.21.1-beta</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud</artifactId>
<version>0.21.0-alpha</version>
</dependency>
import com.google.cloud.spanner.DatabaseClient;
import com.google.cloud.spanner.DatabaseId;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Spanner;
import com.google.cloud.spanner.SpannerOptions;
import com.google.cloud.spanner.Statement;
Sample code within http servlet's doGet method:
SpannerOptions options = SpannerOptions.newBuilder().build();
Spanner spanner = options.getService();
try {
DatabaseClient dbClient = spanner.getDatabaseClient(DatabaseId.of(
options.getProjectId(), "spanner123", "xyzdb"));
// Queries the database
try (ResultSet resultSet = dbClient.singleUse()
.executeQuery(Statement.of("SELECT 1"))) {
while (resultSet.next()) {
System.out.printf("%d\n\n", resultSet.getLong(0));
}
}
} finally {
spanner.close();
}
I believe the exception is thrown within dbClient.singleUse().executeQuery(Statement.of("SELECT 1")) call.
I'm using Spanner API from Java8 GAE Standard App's http servlet, and when I try to execute a query in response to a GET request, I see the following exception in the logs, after which my request seem to hang
The test code I'm using is taken from the Spanner examples:
Sample code within http servlet's doGet method:
I believe the exception is thrown within
dbClient.singleUse().executeQuery(Statement.of("SELECT 1"))call.