By the way, I advise you to read the documentation of the java command, especially about "-jar":

"When you use -jar, the specified JAR file is the source of all user classes, and other class path settings are ignored"

Put agilemesh.dronevideo-1.0.0.jar into the classpath too and specify the name of the class to be launched.


envoyé : 4 juin 2022 à 16:38
de : Kelly Wiles <[email protected]>
à : JETTY user mailing list <[email protected]>, Joakim Erdfelt <[email protected]>
objet : Re: [jetty-users] class not found for HandlerContainer


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 / [email protected]


On Sat, Jun 4, 2022 at 7:10 AM Kelly Wiles <[email protected]> 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
[email protected]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users


Virus-free. www.avg.com


 

_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to