Jetty.project: Jetty 9.4.9.v20180320 need to use shaded startup.jar

Created on 3 Apr 2018  路  10Comments  路  Source: eclipse/jetty.project

Hi,

I can see the v20180320 startup.jar has added a new dependency on jetty-util. This breaks my startup script which starts jetty server with startup.jar. I cannot add classpath using -cp when using -jar as -jar ignores -cp option.

ERROR : org/eclipse/jetty/util/JavaVersion
java.lang.NoClassDefFoundError: org/eclipse/jetty/util/JavaVersion
        at org.eclipse.jetty.start.StartArgs.setProperty(StartArgs.java:1267)
        at org.eclipse.jetty.start.Modules.<init>(Modules.java:65)
        at org.eclipse.jetty.start.Main.processCommandLine(Main.java:312)
        at org.eclipse.jetty.start.Main.main(Main.java:75)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.JavaVersion
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        ... 4 more

I've worked around with adding both startup jar and util.jar to classpath and started with directly executing

java -cp "./lib/*" org.eclipse.jetty.start.Main

Please advise what is the right way to use startup.jar now.

Also because of this, documentation of 9.4.x https://www.eclipse.org/jetty/documentation/9.4.x/start-jar.html is wrong.. you cannot start the server by java -jar start.jar

Documentation

Most helpful comment

The shaded jar is there.

http://central.maven.org/maven2/org/eclipse/jetty/jetty-start/9.4.9.v20180320/

You'll use the maven dependency ...

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-start</artifactId>
    <version>9.4.9.v20180320</version>
    <classifier>shaded</classifier>
</dependency>

or

compile 'org.eclipse.jetty:jetty-start:9.4.9.v20180320:shaded'

All 10 comments

There's nothing wrong with the start.jar found in the jetty-home artifact (and jetty-distribution artifact).

How are you consuming jetty-start ?

The start.jar does have a dependency on util, but it is a provided dependency and we use the shade plugin to bring in a private version of the util classes that start needs.
Have you built your own start.jar?

@joakime , @gregw no i've not build my own version of jar. I've gradle task which downloads it from maven . All I do to start the jetty is to run the jar likejava -jar jetty-start-9.4.9.v20180320.jar on my web app directory like it is mentioned in here. This approach was working till the last version of jetty 9.4.8.v20171121. Now with 9.4.9.v20180320 it breaks because of the dependency. I see in the jetty distribution it used a shaded startup.jar.Can I get the shaded version of jetty downloaded as a dependency from anywhere?

@joakime , @gregw, @olamy the jetty-start pom.xml has shadedArtifactAttached=true, so why isn't the shaded jar automatically uploaded to maven central during the deploy phase?

@sreejithp you can get the shaded jar on the sonatype jetty repo here: https://oss.sonatype.org/content/groups/jetty/

Thanks @janbartel

The shaded jar is there.

http://central.maven.org/maven2/org/eclipse/jetty/jetty-start/9.4.9.v20180320/

You'll use the maven dependency ...

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-start</artifactId>
    <version>9.4.9.v20180320</version>
    <classifier>shaded</classifier>
</dependency>

or

compile 'org.eclipse.jetty:jetty-start:9.4.9.v20180320:shaded'

can we add this to documentation

@WalkerWatch can you look at this?

@sbordet Sure thing

Was this page helpful?
0 / 5 - 0 ratings