Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread "main" java.lang.NoClassDefFoundError: javax/websocket/server/ServerContainer #29

Closed
miketeo opened this issue Apr 30, 2018 · 8 comments

Comments

@miketeo
Copy link

miketeo commented Apr 30, 2018

Hi, I have created a new appengine project using mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtifactId=ninja-appengine-blog-archetype

On running mvn appengine:devserver -Pdevserver, I have encountered the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/websocket/server/ServerContainer

The following properties are used in the pom.xml:

        <ninja.version>6.2.1</ninja.version>
        <ninja-appengine.version>1.9.60</ninja-appengine.version>
        <appengine.version>1.9.60</appengine.version>
@overengineered
Copy link

I'm facing the same problem. I'm new to Java server development, so not sure what's relevant to report. I'm running macOS 10.13.5,

openjdk version "1.8.0_152-release"
OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
OpenJDK 64-Bit Server VM (build 25.152-b01, mixed mode)

I've tried mvn jetty:run with the same result.

@miketeo Did you manage to overcome this?

@raphaelbauer
Copy link
Contributor

It works (at least for me) with mvn appengine:devserver -Pdevserver. jetty:run won't work.

@overengineered
Copy link

When I generate appengine guestbook archetype it works on my machine. However if I add

    <dependency>
        <groupId>org.ninjaframework</groupId>
        <artifactId>ninja-appengine-module</artifactId>
        <version>1.9.60</version>
    </dependency>

guestbook project also stops working with java.lang.NoClassDefFoundError: javax/websocket/server/ServerContainer

@overengineered
Copy link

I've tried running another machine (macOS again) where java -version is

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

I'm again stuck on the same problem. All the Ninja tests pass, then server is started

[INFO] Running /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/bin/java -XstartOnFirstThread -D--enable_all_permissions=true -Dappengine.fullscan.seconds=5 -Duse_jetty9_runtime=true -classpath /Users/juozask/.m2/repository/com/google/appengine/appengine-java-sdk/1.9.60/appengine-java-sdk/appengine-java-sdk-1.9.60/lib/appengine-tools-api.jar -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+UseParNewGC -XX:MaxNewSize=256m -XX:NewSize=256m -XX:SurvivorRatio=128 -XX:+UseTLAB -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled com.google.appengine.tools.development.DevAppServerMain --allow_remote_shutdown --no_java_agent /Users/incognito/code/ninja/target/test1-1.0-SNAPSHOT

And it fails with non-descriptive callstack

[INFO] Exception in thread "main" java.lang.NoClassDefFoundError: javax/websocket/server/ServerContainer
[INFO] 	at java.lang.Class.getDeclaredMethods0(Native Method)
[INFO] 	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[INFO] 	at java.lang.Class.getDeclaredMethods(Class.java:1975)
[INFO] 	at org.eclipse.jetty.annotations.ResourceAnnotationHandler.doHandle(ResourceAnnotationHandler.java:70)
[INFO] 	at org.eclipse.jetty.annotations.AnnotationIntrospector$AbstractIntrospectableAnnotationHandler.handle(AnnotationIntrospector.java:71)
[INFO] 	at org.eclipse.jetty.annotations.AnnotationIntrospector.introspect(AnnotationIntrospector.java:96)
[INFO] 	at org.eclipse.jetty.annotations.AnnotationDecorator.introspect(AnnotationDecorator.java:61)
[INFO] 	at org.eclipse.jetty.annotations.AnnotationDecorator.decorate(AnnotationDecorator.java:67)
[INFO] 	at org.eclipse.jetty.util.DecoratedObjectFactory.decorate(DecoratedObjectFactory.java:77)
[INFO] 	at org.eclipse.jetty.servlet.ServletContextHandler$Context.createListener(ServletContextHandler.java:1471)
[INFO] 	at org.eclipse.jetty.server.handler.ContextHandler$Context.addListener(ContextHandler.java:2357)
[INFO] 	at org.eclipse.jetty.servlet.ServletContextHandler$Context.addListener(ServletContextHandler.java:1462)
[INFO] 	at ninja.servlet.NinjaServletContainerInitializer.onStartup(NinjaServletContainerInitializer.java:35)
[INFO] 	at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup(ContainerInitializer.java:140)
[INFO] 	at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart(ServletContainerInitializersStarter.java:63)
[INFO] 	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
....

@overengineered
Copy link

overengineered commented Sep 19, 2018

OK. I finally got it work. After generating archetype I manually downgrade ninja version:

<properties>
    <ninja.version>6.1.0</ninja.version>
    <ninja-appengine.version>1.9.54</ninja-appengine.version>
    <appengine.version>1.9.54</appengine.version>
    <appengine.generated.dir>target/${project.artifactId}-${project.version}/WEB-INF/appengine-generated</appengine.generated.dir>
</properties>

Since ninja 6.2.0 there's Programmatic initializing of NinjaFramework so that a web.xml is not required and it causes problems on my system. Without it I can run ninja with app engine.

@raphaelbauer do you know if there's a possibility to disable this programmatic initializing, so that appengine-web.xml is specifying initialization?

@raphaelbauer
Copy link
Contributor

I can reproduce the problem.
We just released version 1.9.65 that should fix the issue (and also features Ninja 6.3.0).
Please try that version and check whether that works for you... Thanks!

@overengineered
Copy link

It works, thanks!

@raphaelbauer
Copy link
Contributor

👍 Thanks for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants