Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] class not found for HandlerContainer

Kelly,

I think you are missing other dependencies.  See the output of mvn dependency:tree for jetty server:

[INFO] org.eclipse.jetty:jetty-server:jar:11.0.10-SNAPSHOT
[INFO] +- org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:jar:5.0.2:compile
[INFO] +- org.eclipse.jetty:jetty-http:jar:11.0.10-SNAPSHOT:compile
[INFO] |  \- org.eclipse.jetty:jetty-util:jar:11.0.10-SNAPSHOT:compile
[INFO] +- org.eclipse.jetty:jetty-io:jar:11.0.10-SNAPSHOT:compile
[INFO] +- org.eclipse.jetty:jetty-jmx:jar:11.0.10-SNAPSHOT:compile
[INFO] +- org.slf4j:slf4j-api:jar:2.0.0-alpha6:compile
[INFO] +- org.eclipse.jetty:jetty-xml:jar:11.0.10-SNAPSHOT:test
[INFO] +- org.eclipse.jetty.toolchain:jetty-test-helper:jar:5.9:test
[INFO] |  \- org.hamcrest:hamcrest:jar:2.2:test
[INFO] +- org.eclipse.jetty.tests:jetty-http-tools:jar:11.0.10-SNAPSHOT:test
[INFO] +- org.eclipse.jetty:jetty-util-ajax:jar:11.0.10-SNAPSHOT:test
[INFO] +- org.eclipse.jetty:jetty-slf4j-impl:jar:11.0.10-SNAPSHOT:test
[INFO] \- org.junit.jupiter:junit-jupiter:jar:5.8.2:test
[INFO]    +- org.junit.jupiter:junit-jupiter-api:jar:5.8.2:test
[INFO]    |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO]    |  +- org.junit.platform:junit-platform-commons:jar:1.8.2:test
[INFO]    |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO]    +- org.junit.jupiter:junit-jupiter-params:jar:5.8.2:test
[INFO]    \- org.junit.jupiter:junit-jupiter-engine:jar:5.8.2:test
[INFO]       \- org.junit.platform:junit-platform-engine:jar:1.8.2:test

So you need at least jetty-http, jetty-util, jetty-io etc.

If you want a single jar, best to use mvn dependency plugin (or similar) to build a single jar.

Even then, the problem could be with the Thread context classloader, so you'd need t o provide more context of where that error is coming from, or perhaps a verbose run of the jvm that details classloading.

cheers







On Sun, 5 Jun 2022 at 00:38, Kelly Wiles <rkwiles@xxxxxxx> wrote:

Hi, Thanks for the reply,

I tried the following, as you suggested but I still get the same error.

java -cp $JETTY_HOME/lib/jetty-server-11.0.9.jar -jar agilemesh.dronevideo-1.0.0.jar
Error: Unable to initialize main class agilemesh.dronevideo.DroneVideo
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/HandlerContainer

If I do the follow command it lists jar file.

ls -l $JETTY_HOME/lib/jetty-server-11.0.9.jar
-r--r--r-- 1 pi pi 774703 Mar 30 12:46 /home/pi/jetty-home-11.0.9/lib/jetty-server-11.0.9.jar

Kelly

On 6/4/2022 7:52 AM, Joakim Erdfelt wrote:
Your classpath declaration is bad.

"$JETTY_HOME/lib/annotations;$JETTY_HOME/lib;$JETTY_HOME/lib/apache-jsp;$JETTY_HOME/lib/jaspi;$JETTY_HOME/lib/logging;./"

That style of definition (where the entry ends in a slash) is for unpacked jars, which you don't have.
Also you cannot include in your classpath ALL jars shipped from Jetty, as that's a nonsense configuration.
There's specific jars for specific functionality, and you cannot have all of them at the same time present in your classpath.

Start with the limited list of jars your maven project is using, no more, no less.
Your classpath should contain all of the jars individually listed.
(eg: $JETTY_HOME/lib/jetty-server-11.0.9.jar;$JETTY_HOME/lib/jetty-io-11.0.9.jar;... etc)

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Sat, Jun 4, 2022 at 7:10 AM Kelly Wiles <rkwiles@xxxxxxx> wrote:
Hi,

I have been looking for several days now this answer.

I develop on Windows 11 using Eclipse IDE and then I create a jar file
using the install goal with the run configuration.  This does create a
jar file in the target directory.

I then copy the jar file to a Linux system, this system has jdk 11
installed and jetty 11.0.9 installed.  I unpacked jetty into my home
directory and set the JETTY_HOME to point to it.

When I use the following command to run it.

java -cp
"$JETTY_HOME/lib/annotations;$JETTY_HOME/lib;$JETTY_HOME/lib/apache-jsp;$JETTY_HOME/lib/jaspi;$JETTY_HOME/lib/logging;./"
-jar agilemesh.dronevideo-1.0.0.jar

This returns the following error.

Error: Unable to initialize main class agilemesh.dronevideo.DroneVideo
Caused by: java.lang.NoClassDefFoundError:
org/eclipse/jetty/server/HandlerContainer

The jetty-server-11.0.9.jar file exists in $JETTY_HOME/lib and contains
the HandlerContainer class, so I am lost as to why I get this error.

Thanks

Kelly


--
This email has been checked for viruses by AVG.
https://www.avg.com

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Virus-free. www.avg.com
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


--

Back to the top