0

We have Goole App Engine Java Project that uses Plivo(SMS, Phone Call Platform) to send SMS. It uses Plivo Java Library to send a SMS. When I tried to send a sms, i got NoClassDefFoundError exceptions

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)

How do i resolve this issue?

Fizer Khan
  • 88,237
  • 28
  • 143
  • 153

1 Answers1

1

As you may know, App Engine runs in a sandboxed environment, so certain classes are unavailable. The whitelist page will tell you which classes you can use.

If you need to make use of this specific third party library, you can either run the relevant part(s) of your app on Compute Engine, or look at Managed VMs, which don't have the same restrictions as regular Java modules on App Engine. The downside is that you don't enjoy the same auto-scaling characteristics and Managed VMs are still in preview.

tx802
  • 3,524
  • 2
  • 17
  • 22
  • When i check plivo java library, it is nowhere depends on LDAP package. Why it happens to third party library? – Fizer Khan Oct 04 '14 at 06:11
  • Your library is dependent on the Apache HTTP library referenced in the call stack, which in turn is dependent on LdapName (see [here](http://mail-archives.apache.org/mod_mbox/hc-commits/201407.mbox/%3C20140728155736.AA8C62388A9B@eris.apache.org%3E) for example). – tx802 Oct 04 '14 at 07:57
  • Okay. now i understood. – Fizer Khan Oct 05 '14 at 11:15