publishing messages to GCP pubSub topic fails - google-app-engine

I have a Spring Boot application which tries to publishes messages to a Cloud Pub/Sub topic. When I run the application in local machine, it successfully publishes the messages into the topic. But after deploying it to App Engine it fails with the below exception
com.google.api.gax.rpc.UnavailableException: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata
at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:69) ~[gax-1.16.0.jar:1.16.0]
at com.google.cloud.pubsub.v1.Publisher$4.onFailure(Publisher.java:373) ~[google-cloud-pubsub-0.33.0-beta.jar:0.33.0-beta]
at com.google.common.util.concurrent.Futures$4.run(Futures.java:1123) [guava-20.0.jar:na]
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) [guava-20.0.jar:na]
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) [guava-20.0.jar:na]
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) [guava-20.0.jar:na]
at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:675) [guava-20.0.jar:na]
at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:492) [grpc-stub-1.9.0.jar:1.9.0]
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:467) [grpc-stub-1.9.0.jar:1.9.0]
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:684) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:392) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:475) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:557) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:478) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:590) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) [grpc-core-1.9.0.jar:1.9.0]
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) [grpc-core-1.9.0.jar:1.9.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_112-google-v7]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_112-google-v7]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_112-google-v7]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:295) [na:1.8.0_112-google-v7]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_112-google-v7]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112-google-v7]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112-google-v7]
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata
at io.grpc.Status.asRuntimeException(Status.java:526) ~[grpc-core-1.9.0.jar:1.9.0]
... 19 common frames omitted
Caused by: java.io.IOException: Could not get the access token.
at com.google.auth.oauth2.AppEngineCredentials.refreshAccessToken(AppEngineCredentials.java:136) ~[google-auth-library-oauth2-http-0.7.1.jar:na]
at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:149) ~[google-auth-library-oauth2-http-0.7.1.jar:na]
at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:135) ~[google-auth-library-oauth2-http-0.7.1.jar:na]
at com.google.auth.Credentials.blockingGetToCallback(Credentials.java:103) ~[google-auth-library-credentials-0.9.0.jar:na]
at com.google.auth.Credentials$1.run(Credentials.java:92) ~[google-auth-library-credentials-0.9.0.jar:na]
... 7 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112-google-v7]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112-google-v7]
at com.google.auth.oauth2.AppEngineCredentials.refreshAccessToken(AppEngineCredentials.java:131) ~[google-auth-library-oauth2-http-0.7.1.jar:na]
... 11 common frames omitted
Caused by: com.google.apphosting.api.ApiProxy$CallNotFoundException: Can't make API call memcache.Get in a thread that is neither the original request thread nor a thread created by ThreadManager
at com.google.apphosting.api.ApiProxy$CallNotFoundException.foreignThread(ApiProxy.java:844) ~[runtime-shared.jar:na]
at com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:183) ~[runtime-shared.jar:na]
at com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:180) ~[runtime-shared.jar:na]
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:93) ~[appengine-api.jar:na]
at com.google.appengine.api.memcache.MemcacheServiceImpl.quietGet(MemcacheServiceImpl.java:28) ~[appengine-api.jar:na]
at com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:51) ~[appengine-api.jar:na]
at com.google.appengine.api.appidentity.AppIdentityServiceImpl.getAccessToken(AppIdentityServiceImpl.java:302) ~[appengine-api.jar:na]
... 15 common frames omitted
Code is copied from this Spring guide.

The error message you shared clearly states UNAVAILABLE: Credentials failed to obtain metadata, so it looks like the error is related to credentials in App Engine. Apparently, and according to your description of the issue, your application is working properly when being run in the local development server, but once you deploy it to your App Engine Standard application, it fails. It all indicates that you may have a faulty credentials configuration.
As explained in the Authentication section in the guide you shared, and also in App Engine's documentation, App Engine Standard uses the Application Default Credentials for authentication. To do so, it checks for credentials in the environment variable GOOGLE_APPLICATION_CREDENTIALS, and if they are missing, it will use the default service account from your App Engine application.
Knowing that, your possible issue is that you are pointing to a credentials file that is not available in the remote (App Engine) environment. Therefore, my recommendation is that, if you think you can work with the default App Engine service account, you just leave the GOOGLE_APPLICATION_CREDENTIALS environment variable and the spring.cloud.gcp.credentials.location property empty so that App Engine takes the default credentials from its own service account. Bear in mind that it should have permissions to interact with Pub/Sub in order for it to work too, so you may have to grant roles to the service account if needed.

Related

SQL Server Certificate error on Kubernetes

I have a Spring Boot rest service which retrieves data from a SQL Server Database. It runs fine on local but on deploying to the Cloud environment, the POD fails to come up and we are seeing certificate issues, I see the below logs:
[main] ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target". ClientConnectionId:<random generated id>
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3680)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:2113)
.............................................
.............................................
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
.............................................
.............................................
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:2021)
... 58 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.validator.PKIXValidator.doBuild(Unknown Source)
.............................................
.............................................
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSChannel$HostNameOverrideX509TrustManager.checkServerTrusted(IOBuffer.java:1702)
at java.base/sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(Unknown Source)
... 71 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)
at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
at java.base/java.security.cert.CertPathBuilder.build(Unknown Source)
... 79 more
The connection string: jdbc:sqlserver://<HOST_NAME>:<PORT_NAME>;instanceName=<INSTANCE_NAME>;databaseName=<DB_NAME>;
I have tried adding encrypt=true; trustServerCertificate=true; and trustServerCertificate=false; as suggested on different posts but it still fails.
I have seen this error for different URLs in the past and the fix would be to download the Certificate (using the browser) and adding it to the Java KeyStore but I am not sure what to do for Databases. Also, we wouldn't have access to the Java Keystore on the cloud env.
Can someone help/guide on how to fix this issue?
Thanks in advance.

Problem with creating a data pipeline from SQL Server to BigQuery using cloud data fusion

I am trying to create a data pipeline from "SQL SERVER (from GCP VM)" To "BigQuery" using CLOUD DATA FUSION; I have done all the below setup configurations,
Created the new instance in Cloud data fusion.
Added this as a service account in IAM & Admin.
Installed the JDBC driver in SQL Server plugin
Create the wrangler and read the data from SQL server using this SQL Server plugin (in this step I can successfully authenticate my SQL server and I can see my SQL table data in it)
I Completed the pipleine config by adding Bigquery as a sink.
And I try run the pipeline and it end up with few errors; I have tried few google search but I didn't get the answer.
I was able to create a data fusion pipeline between "GCS To BigQuery" and it was working fine. but this "SQL server to big query" pipeline showing some Error.
Could anyone please help me on this?
Here is the error details,
2020-01-10 13:00:47,528 - WARN [Thread-95:o.a.h.m.LocalJobRunner#589] - job_local976595976_0001
java.lang.Exception: java.lang.NullPointerException
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:491) ~[hadoop-mapreduce-client-common-2.9.2.jar:na]
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:551) ~[hadoop-mapreduce-client-common-2.9.2.jar:na]
java.lang.NullPointerException: null
at org.apache.hadoop.mapreduce.lib.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:281) ~[hadoop-mapreduce-client-core-2.9.2.jar:na]
at io.cdap.plugin.db.batch.source.DataDrivenETLDBInputFormat.createDBRecordReader(DataDrivenETLDBInputFormat.java:124) ~[1578661227434-0/:na]
at org.apache.hadoop.mapreduce.lib.db.DBInputFormat.createRecordReader(DBInputFormat.java:245) ~[hadoop-mapreduce-client-core-2.9.2.jar:na]
at io.cdap.cdap.etl.batch.preview.LimitingInputFormat.createRecordReader(LimitingInputFormat.java:51) ~[cdap-etl-core-6.1.0.jar:na]
at io.cdap.cdap.internal.app.runtime.batch.dataset.input.MultiInputFormat.createRecordReader(MultiInputFormat.java:92) ~[na:na]
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.(MapTask.java:521) ~[hadoop-mapreduce-client-core-2.9.2.jar:na]
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764) ~[hadoop-mapreduce-client-core-2.9.2.jar:na]
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341) ~[hadoop-mapreduce-client-core-2.9.2.jar:na]
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:270) ~[hadoop-mapreduce-client-common-2.9.2.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_232]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_232]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_232]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_232]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_232]
2020-01-10 13:00:50,841 - ERROR [MapReduceRunner-phase-1:i.c.c.i.a.r.ProgramControllerServiceAdapter#97] - MapReduce Program 'phase-1' failed.
java.lang.IllegalStateException: MapReduce JobId job_local976595976_0001 failed
at com.google.common.base.Preconditions.checkState(Preconditions.java:176) ~[com.google.guava.guava-13.0.1.jar:na]
at io.cdap.cdap.internal.app.runtime.batch.MapReduceRuntimeService.run(MapReduceRuntimeService.java:416) ~[na:na]
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$1.run(AbstractExecutionThreadService.java:52) ~[com.google.guava.guava-13.0.1.jar:na]
at io.cdap.cdap.internal.app.runtime.batch.MapReduceRuntimeService$2$1.run(MapReduceRuntimeService.java:450) [na:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_232]
2020-01-10 13:00:50,842 - ERROR [MapReduceRunner-phase-1:i.c.c.i.a.r.ProgramControllerServiceAdapter#98] - MapReduce program 'phase-1' failed with error: MapReduce JobId job_local976595976_0001 failed. Please check the system logs for more details.
java.lang.IllegalStateException: MapReduce JobId job_local976595976_0001 failed
at com.google.common.base.Preconditions.checkState(Preconditions.java:176) ~[com.google.guava.guava-13.0.1.jar:na]
at io.cdap.cdap.internal.app.runtime.batch.MapReduceRuntimeService.run(MapReduceRuntimeService.java:416) ~[na:na]
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$1.run(AbstractExecutionThreadService.java:52) ~[com.google.guava.guava-13.0.1.jar:na]
at io.cdap.cdap.internal.app.runtime.batch.MapReduceRuntimeService$2$1.run(MapReduceRuntimeService.java:450) [na:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_232]
2020-01-10 13:00:50,916 - ERROR [WorkflowDriver:i.c.c.d.SmartWorkflow#552] - Pipeline '0f084034-33a9-11ea-95f6-8e2648ebe039' failed.
2020-01-10 13:00:51,225 - ERROR [WorkflowDriver:i.c.c.i.a.r.w.WorkflowProgramController#89] - Workflow service 'workflow.default.0f084034-33a9-11ea-95f6-8e2648ebe039.DataPipelineWorkflow.20288f05-33a9-11ea-a505-8e2648ebe039' failed.
java.lang.IllegalStateException: MapReduce JobId job_local976595976_0001 failed
at com.google.common.base.Preconditions.checkState(Preconditions.java:176) ~[com.google.guava.guava-13.0.1.jar:na]
at io.cdap.cdap.internal.app.runtime.batch.MapReduceRuntimeService.run(MapReduceRuntimeService.java:416) ~[na:na]
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$1.run(AbstractExecutionThreadService.java:52) ~[com.google.guava.guava-13.0.1.jar:na]
at io.cdap.cdap.internal.app.runtime.batch.MapReduceRuntimeService$2$1.run(MapReduceRuntimeService.java:450) ~[na:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_232]
As per issue records reported, you have persisted with java.lang.nullpointerexception error, that might reflect the usage of a null when the object required within an application run path.
Assuming the fact that you've successfully configured JDBC driver, I would recommend to check the source Database Properties across your pipeline in order to determine the undefined field, supposedly can be Import Query property field, that is used to import data from specified table by supplying SELECT query with appropriate $CONDITIONS if the number of splits to generate is more than 1:
SELECT * FROM <table> WHERE $CONDITIONS
UPDATE:
https://issues.cask.co/browse/CDAP-16453
It's a known issue, fixed in 6.1.2
"Same error on MySQL 5.x
Strange enough, if you deploy the pipeline and run it it works...
I'm thinking about decoupling pipelines to have small sql-to-storage and the big pipeline in the outgoing flow"
regards
Virgilio

Executing Spring Cloud application in Google AppEngine

We are trying to deploy a Spring Cloud (Boot + Netflix API wrappers) based project in Google AppEngine. We want to use spring-cloud-starter-zuul as an API Gateway.
For reasons beyond the development team, we have to deploy this in the AppEngine Standard Environment (Java7, Servlet 2.5). We can't use the newer AppEngine Flexible Environment (container based, Java 8).
We have created a sample Gradle+AppEngine project based on these guidelines.
Sample project code is on Github.
We see this stacktrace when running the command ./gradlew appengineRun:
java.lang.ClassNotFoundException: com.google.appengine.api.ThreadManager
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_80]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_80]
at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_80]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_80]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_80]
at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:198) ~[appengine-local-runtime.jar:na]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[na:1.7.0_80]
at java.lang.Class.forName0(Native Method) ~[na:1.7.0_80]
at java.lang.Class.forName(Class.java:195) ~[na:1.7.0_80]
at com.netflix.hystrix.util.PlatformSpecific.getAppEngineThreadFactory(PlatformSpecific.java:64) ~[hystrix-core-1.5.5.jar:1.5.5]
at com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller.<init>(HystrixMetricsPoller.java:86) ~[hystrix-metrics-event-stream-1.5.5.jar:1.5.5]
at org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$HystrixMetricsPollerConfiguration.start(HystrixCircuitBreakerConfiguration.java:135) ~[spring-cloud-netflix-core-1.2.0.RELEASE.jar:1.2.0.RELEASE]
What are we missing to be getting this error during application startup?
Is this related to Hystrix code trying to ascertain if it is running in an AppEngine environment? Ref: Netflix Hystrix Pull Request 1066 (due to few reputation points on SO, I can't post more than two links).
Thank you.

Jersey 1.17 on Google App Engine

I deployed my REST service on Google App Engine and I receive following error each time I try to query the service:
com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider: The provider class, class com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider, could not be instantiated. Processing will continue but the class will not be utilized
java.lang.SecurityException: Unable to get members for class com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
at com.google.appengine.runtime.Request.process-7d6711107bb7eaaa(Request.java)
at java.lang.Class.getDeclaredMethods(Class.java:253)
at com.sun.jersey.core.reflection.MethodList.getAllDeclaredMethods(MethodList.java:70)
at com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:64)
at com.sun.jersey.core.spi.component.ComponentConstructor.getPostConstructMethods(ComponentConstructor.java:131)
at com.sun.jersey.core.spi.component.ComponentConstructor.<init>(ComponentConstructor.java:123)
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:165)
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:256)
at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:160)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1310)
at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:168)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:774)
at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:770)
at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:770)
at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:765)
at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:489)
at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:319)
at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:557)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:454)
at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:461)
at com.google.tracing.TraceContext.runInContext(TraceContext.java:703)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:338)
at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:330)
at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:458)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
... 41 more
Caused by: java.lang.NoClassDefFoundError: javax/mail/MessagingException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2444)
... 41 more
Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException
at com.google.appengine.runtime.Request.process-7d6711107bb7eaaa(Request.java)
... 41 more
This service doesn't use or send any mail messages. Only one thing it does is writing JSON response from some POJO. It works locally of course (on local GAE and local Tomcat).
It might be a compatibility problem with versions. According to this, Jersey versions that are compatible with Google App Engine are 1.5 and 1.1.5.
I had similar problems and I don't like this version compatibility issues, so I opted for:
To offer REST web services from GAE, use Google Cloud Endpoints, which is still an experimental technology but as far as I've tried, it works pretty well. Furthermore it is very well integrated with GAE and the Google Plugin for Eclipse.
To cosume REST services from GAE, I've opted for using just Java build-in HTTP client library as explained here. I don't know if it's the best way, but it is very simple and you avoid compatibility problems that could arise between GAE and external APIs such as Jersey.
I created a GAE REST skeleton app on GitHub. It's at https://github.com/deege/gae-rest-skeleton
The app just has two REST calls defined, but it will give you a starting point. It uses GAE 1.9.4, and Jersey 1.17.1.
You can fork the code from https://github.com/deege/gae-rest-skeleton.git

GWT App engine Error

I have a small problem with my GWT application.
Here's the console output :
SEVERE: Received exception processing /Users/je/Documents/HelloWorld/ConnectrStage1/war/WEB-INF/appengine-web.xml
com.google.apphosting.utils.config.AppEngineConfigException: appengine-web.xml does not contain a <threadsafe> element.
See http://code.google.com/appengine/docs/java/config/appconfig.html#Using_Concurrent_Requests for more information.
You probably want to enable concurrent requests.
at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:79)
at com.google.appengine.tools.development.AbstractContainerService.loadAppEngineWebXml(AbstractContainerService.java:360)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:148)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
[ERROR] Unable to start App Engine server
com.google.apphosting.utils.config.AppEngineConfigException: appengine-web.xml does not contain a <threadsafe> element.
See http://code.google.com/appengine/docs/java/config/appconfig.html#Using_Concurrent_Requests for more information.
You probably want to enable concurrent requests.
at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:79)
at com.google.appengine.tools.development.AbstractContainerService.loadAppEngineWebXml(AbstractContainerService.java:360)
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:239)
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:148)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:97)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Unable to start embedded HTTP server
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:102)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
[ERROR] shell failed in doStartupServer method
For me, it's pretty clear
com.google.apphosting.utils.config.AppEngineConfigException: appengine-web.xml does not contain a <threadsafe> element.
See https://developers.google.com/appengine/docs/java/config/appconfig?hl=fr#Using_Concurrent_Requestsfor more information.

Resources