0

我们有Goole App Engine使用Plivo(SMS,电话呼叫平台)发送 SMS 的 Java 项目。它使用Plivo Java 库来发送 SMS。当我尝试发送短信时,出现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)

我该如何解决这个问题?

4

1 回答 1

1

您可能知道,App Engine 在沙盒环境中运行,因此某些类不可用。白名单页面会告诉您可以使用哪些类。

如果您需要使用这个特定的第三方库,您可以在 Compute Engine 上运行您的应用程序的相关部分,或者查看Managed VMs,它与 App 上的常规 Java 模块没有相同的限制引擎。缺点是您无法享受相同的自动缩放特性,并且托管 VM 仍处于预览阶段。

于 2014-10-03T18:01:28.657 回答