Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1153

GSSAPI auth when running within OSGI causes NoClassDefFoundError (SaslException)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.12.0, 3.0.0
    • Affects Version/s: 2.11.1
    • Component/s: Build
    • None

      I hit the error below when attempting to use Kerberos authentication with the Java driver running as an OSGI module.

      Caused by: java.lang.NoClassDefFoundError: javax/security/sasl/SaslException
      	at com.mongodb.DBPort.authenticate(DBPort.java:318)
      	at com.mongodb.DBPort.checkAuth(DBPort.java:333)
      	at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:243)
      	at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216)
      	at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:288)
      	at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:273)
      	at com.mongodb.DB.getCollectionNames(DB.java:399)
      	at org.pentaho.mongo.wrapper.NoAuthMongoClientWrapper.getCollectionsNames(NoAuthMongoClientWrapper.java:196)
      	... 118 more
      Caused by: java.lang.ClassNotFoundException: javax.security.sasl.SaslException not found by org.mongodb.mongo-java-driver [21]
      	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
      	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
      	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      	... 126 more
      

      -----------------
      I later added the following items to the Import-Package in the MANIFEST for mongo-java-driver-2.11.1.jar and was able to connect without issue.

      javax.security.sasl,javax.security.auth.login,javax.security.auth,org.ietf.jgss
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            mkambol Matt Campbell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: