3

I am running a 3rd-party jar file (no UI) on the command line like this:

 /usr/bin/java -jar exchange-sync.jar

After my distribution (Debian Buster) upgraded to the latest OpenJDK 11 this command is no longer working. This is what I am now getting:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/ws/http/HTTPException
        at microsoft.exchange.webservices.data.core.ExchangeService.findItems(ExchangeService.java:976)
        at microsoft.exchange.webservices.data.core.ExchangeService.findAppointments(ExchangeService.java:1264)
        at microsoft.exchange.webservices.data.core.ExchangeService.findAppointments(ExchangeService.java:1285)
        at com.zerodes.exchangesync.exchange.ExchangeSourceImpl.getAllAppointments(ExchangeSourceImpl.java:399)
        at com.zerodes.exchangesync.sync.SyncCalendarsImpl.generatePairs(SyncCalendarsImpl.java:45)
        at com.zerodes.exchangesync.sync.SyncCalendarsImpl.syncAll(SyncCalendarsImpl.java:98)
        at com.zerodes.exchangesync.App.main(App.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.ws.http.HTTPException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

I've already figured out that I now need to install the jaxws-api Debian Package, which provides the missing classes in /usr/share/java/jaxws-api.jar.

Which java command line do I need in order to include the classes from the installed jar file? I have already tried this, but I am getting the same error:

/usr/bin/java -cp /usr/share/java/jaxws-api.jar -jar exchange-sync.jar

BTW: I am a Java noob and I don't want to mess with recompiling things. I am also sure that javax.xml.ws.http.HTTPException resides in jaxws-api.jar, as I have browsed that JAR file with vim and found that class in it.

2

1 Answer 1

3

OK, I finally figured this out by myself. This is how you correctly add modules, which the JAR expects to be present:

/usr/bin/java --module-path /usr/share/java/jaxws-api.jar --add-modules jaxws.api -jar exchange-sync.jar

So it does not really have anything to do with the classpath, it's just about adding the module.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.