Loading JARs

Hi, I could use some help trying to work out how to solve a java issue.

We used to run Lucee in a Docker container which was based on debian and uses the lucee installer to install tomcat/lucee. As the installers haven’t been done for the last two releases I’ve attempted to move to a tomcat base so that at some point I can easily move to JRE11 etc. And the use the lucee lite version.

General usage seems OK, however I have an issue with a jar file importing classes from another jar file.

I have a ‘normal’ Java jar which we compile on build, this is added to the “/opt/lucee/web/lib” directory and is so on the class path. This jar imports classes from another jar in the same directory.

When I used 5.2.9.31 (using the installer) it’s fine. However when using 5.3.1.102 I get a "lucee.runtime.exp.NativeException: com/nimbusds/jose/JWSVerifier at java.lang.Class.getDeclaredConstructors0(Native Method) " error.

This happens when I createObject(“java”, “myObject”);

The other jar is there, as the admin (in the bundle section) says it’s loaded, and I can do a foo = createObject(“java”, “com.nimbusds.jose.JWSVerifier”); which loads the object fine…

Any ideas?

I’ve found, in the application.log, these two stacktraces which look like Lucee doesn’t like them now…

OSGi;Unable to resolve com.nimbusds.nimbus-jose-jwt [48](R 48.0): missing requirement [com.nimbusds.nimbus-jose-jwt [48](R 48.0)] osgi.wiring.package; (osgi.wiring.package=net.jcip.annotations) Unresolved requirements: [[com.nimbusds.nimbus-jose-jwt [48](R 48.0)] osgi.wiring.package; (osgi.wiring.package=net.jcip.annotations)];org.osgi.framework.BundleException: Unable to resolve com.nimbusds.nimbus-jose-jwt [48](R 48.0): missing requirement [com.nimbusds.nimbus-jose-jwt [48](R 48.0)] osgi.wiring.package; (osgi.wiring.package=net.jcip.annotations) Unresolved requirements: [[com.nimbusds.nimbus-jose-jwt [48](R 48.0)] osgi.wiring.package; (osgi.wiring.package=net.jcip.annotations)]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4362)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2277)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
	at lucee.loader.osgi.BundleUtil.start(BundleUtil.java:112)
	at lucee.loader.osgi.BundleUtil.start(BundleUtil.java:108)
	at lucee.runtime.osgi.OSGiUtil._start(OSGiUtil.java:1084)
	at lucee.runtime.osgi.OSGiUtil.start(OSGiUtil.java:1051)
	at lucee.runtime.config.ConfigWebUtil.loadLib(ConfigWebUtil.java:200)
	at lucee.runtime.config.XMLConfigWebFactory.load(XMLConfigWebFactory.java:453)
	at lucee.runtime.config.XMLConfigWebFactory.newInstance(XMLConfigWebFactory.java:284)
	at lucee.runtime.engine.CFMLEngineImpl.loadJSPFactory(CFMLEngineImpl.java:778)
	at lucee.runtime.engine.CFMLEngineImpl.addServletConfig(CFMLEngineImpl.java:662)
	at lucee.loader.engine.CFMLEngineWrapper.addServletConfig(CFMLEngineWrapper.java:87)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:168)
	at lucee.loader.engine.CFMLEngineFactory.getInstance(CFMLEngineFactory.java:201)
	at lucee.loader.servlet.CFMLServlet.init(CFMLServlet.java:42)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1123)
	at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1078)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:971)
	at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4854)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5170)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:928)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:638)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)

and

OSGi;Unable to resolve net.minidev.json-smart [49](R 49.0): missing requirement [net.minidev.json-smart [49](R 49.0)] osgi.wiring.package; (&(osgi.wiring.package=net.minidev.asm)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[net.minidev.json-smart [49](R 49.0)] osgi.wiring.package; (&(osgi.wiring.package=net.minidev.asm)(version>=1.2.0)(!(version>=2.0.0)))];org.osgi.framework.BundleException: Unable to resolve net.minidev.json-smart [49](R 49.0): missing requirement [net.minidev.json-smart [49](R 49.0)] osgi.wiring.package; (&(osgi.wiring.package=net.minidev.asm)(version>=1.2.0)(!(version>=2.0.0))) Unresolved requirements: [[net.minidev.json-smart [49](R 49.0)] osgi.wiring.package; (&(osgi.wiring.package=net.minidev.asm)(version>=1.2.0)(!(version>=2.0.0)))]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4362)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2277)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
	at lucee.loader.osgi.BundleUtil.start(BundleUtil.java:112)
	at lucee.loader.osgi.BundleUtil.start(BundleUtil.java:108)
	at lucee.runtime.osgi.OSGiUtil._start(OSGiUtil.java:1084)
	at lucee.runtime.osgi.OSGiUtil.start(OSGiUtil.java:1051)
	at lucee.runtime.config.ConfigWebUtil.loadLib(ConfigWebUtil.java:200)
	at lucee.runtime.config.XMLConfigWebFactory.load(XMLConfigWebFactory.java:453)
	at lucee.runtime.config.XMLConfigWebFactory.newInstance(XMLConfigWebFactory.java:284)
	at lucee.runtime.engine.CFMLEngineImpl.loadJSPFactory(CFMLEngineImpl.java:778)
	at lucee.runtime.engine.CFMLEngineImpl.getCFMLFactory(CFMLEngineImpl.java:967)
	at lucee.runtime.engine.CFMLEngineImpl._service(CFMLEngineImpl.java:1000)
	at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:991)
	at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(CFMLEngineWrapper.java:97)
	at lucee.loader.servlet.CFMLServlet.service(CFMLServlet.java:51)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:679)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

Both of these Jars are in the class path, and previously worked…

Any help/ideas would be great

Note to self really, and possibly anyone coming across this.

In my particular case, the initial builds were using the installer and placing the JAR files I needed in the same place the lucee.jar file was (/opt/lucee/lib/)

In my later builds, I was using Tomcat and installing the lucee JAR file manually. But I was placing the JAR files I needed in the web lib folder (/opt/lucee/web/libs/) which seems to allow you to instantiate the JAR files, but they couldn’t really see each other.

My fix was to add these JAR files to the same place the lucee jar file is. Now it’s working…

Interesting find. Thanks for reporting back for posterity.