Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError on Google App Engine #377

Closed
katafractari opened this issue Jul 4, 2017 · 3 comments
Closed

NoClassDefFoundError on Google App Engine #377

katafractari opened this issue Jul 4, 2017 · 3 comments

Comments

@katafractari
Copy link
Contributor

Version: 7.4.0 and up

Code Snippet

Call callResponse = Call.creator(new com.twilio.type.PhoneNumber(call.getTo()), new com.twilio.type.PhoneNumber(call.getFrom()), new URI(call.getAnswerUrl()))
.setStatusCallback(call.getHangupUrl())
.setStatusCallbackEvent(Collections.singletonList("completed"))
.create();

Exception / Log

java.lang.NoClassDefFoundError: java.net.ProxySelector is a restricted class. Please see the Google App Engine developer's guide for more details.
	at com.google.apphosting.runtime.security.shared.stub.java.net.ProxySelector.<clinit>(ProxySelector.java)
	at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:1145)
	at com.twilio.http.NetworkHttpClient.<init>(NetworkHttpClient.java:51)
	at com.twilio.http.TwilioRestClient$Builder.<init>(TwilioRestClient.java:66)
	at com.twilio.Twilio.getRestClient(Twilio.java:118)
	at com.twilio.base.Creator.create(Creator.java:45)
	at com.receivr.services.calls.twilio.TwilioClient.call(TwilioClient.java:84)
	at com.receivr.managers.CallFlowManager.callReceptionist(CallFlowManager.java:66)
	at com.receivr.managers.CallFlowEventManager.handleCallAnswer(CallFlowEventManager.java:314)
	at com.receivr.managers.CallFlowEventManager.waitForCallAnswer(CallFlowEventManager.java:273)
	at com.receivr.services.calls.twilio.servlets.WaitForReceptionistAnswerServlet.handleRequest(WaitForReceptionistAnswerServlet.java:49)
	at com.receivr.services.calls.twilio.servlets.TwilioServlet.doPost(TwilioServlet.java:72)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181)
	at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.googlecode.objectify.ObjectifyFilter.doFilter(ObjectifyFilter.java:48)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:37)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
	at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:257)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
	at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:657)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:619)
	at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:589)
	at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:453)
	at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:460)
	at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:293)
	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:319)
	at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:311)
	at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:457)
	at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:263)
	at java.lang.Thread.run(Thread.java:745)

Steps to Reproduce

  1. Include twilio-java SDK 7.4.0+
  2. Make any REST call
  3. If the application is deployed to Google App Engine (Java 7), the above exception is thrown. The exception is not thrown if we downgrade Twilio Java SDK to at least 7.3.0.

As far as I see, GAE platform uses a modified Apache HttpClient, which probably conflicts with the HttpClient that Twilio Java SDK uses.

@jimm-porch
Copy link
Contributor

Until recently, Google imposed a "white list" on App Engine applications, where certain Java classes were prohibited from use. They just lifted that restriction for Java 8 applications and beyond.

On the JRE whitelist page they have a comment at the top saying "Important: This whitelist does not apply to the Java 8 runtime, which supports all public JDK APIs."

@codejudas
Copy link
Contributor

We've created a PR to address this: #378

@codejudas
Copy link
Contributor

@katafractari @jimm-porch We are releasing today so this should be fixed in 7.13.0 and 7.13.0-alpha-1. Thanks for your patience and help debugging :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants