我们有Goole App Engine
Java项目使用Plivo
(短信,电话呼叫平台)发送短信。它使用 Plivo Java Library 发送短信。当我尝试发送短信时,我得到NoClassDefFoundError
例外
java.lang.NoClassDefFoundError: javax.naming.ldap.LdapName is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.apache.http.conn.ssl.AbstractVerifier.extractCNs(AbstractVerifier.java:277)
at org.apache.http.conn.ssl.AbstractVerifier.getCNs(AbstractVerifier.java:265)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:157)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:140)
at org.apache.http.conn.ssl.SSLSocketFactory.verifyHostname(SSLSocketFactory.java:561)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:536)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:403)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at com.plivo.helper.api.client.RestAPI.request(RestAPI.java:106)
如何解决此问题?
答案 0 :(得分:1)
您可能知道,App Engine在沙盒环境中运行,因此某些类不可用。 whitelist页面会告诉您可以使用哪些课程。
如果您需要使用此特定的第三方库,您可以在计算引擎上运行应用程序的相关部分,或查看Managed VMs,它们没有相同的限制作为App Engine上的常规Java模块。缺点是您不享有相同的自动扩展特性,托管虚拟机仍处于预览状态。