Projects tigase _server tigase-http-api Issues #45
Running http-api in setup mode causes NoClassDefFoundError (#45)
Daniel Wisnewski opened 8 years ago

Starting server in default setup mode causes the following error

2017-04-06 20:31:03.016 [WrapperSimpleAppMain]  ConfiguratorAbstract.parseArgs()   CONFIG:   Setting defaults: --property-file = etc/init.properties
2017-04-06 20:31:03.714 [WrapperSimpleAppMain]  DNSResolverDefault.<init>()        WARNING:  Resolving default host name: birdbox took: 13
WrapperSimpleApp: 
WrapperSimpleApp Error: Encountered an error running main:
WrapperSimpleApp Error: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
WrapperSimpleApp Error: 	at java.lang.ClassLoader.defineClass1(Native Method)
WrapperSimpleApp Error: 	at java.lang.ClassLoader.defineClass(Unknown Source)
WrapperSimpleApp Error: 	at java.security.SecureClassLoader.defineClass(Unknown Source)
WrapperSimpleApp Error: 	at java.net.URLClassLoader.defineClass(Unknown Source)
WrapperSimpleApp Error: 	at java.net.URLClassLoader.access$100(Unknown Source)
WrapperSimpleApp Error: 	at java.net.URLClassLoader$1.run(Unknown Source)
WrapperSimpleApp Error: 	at java.net.URLClassLoader$1.run(Unknown Source)
WrapperSimpleApp Error: 	at java.security.AccessController.doPrivileged(Native Method)
WrapperSimpleApp Error: 	at java.net.URLClassLoader.findClass(Unknown Source)
WrapperSimpleApp Error: 	at java.lang.ClassLoader.loadClass(Unknown Source)
WrapperSimpleApp Error: 	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
WrapperSimpleApp Error: 	at java.lang.ClassLoader.loadClass(Unknown Source)
WrapperSimpleApp Error: 	at tigase.http.modules.setup.SetupModeRedirectModule.start(SetupModeRedirectModule.java:107)
WrapperSimpleApp Error: 	at tigase.http.AbstractHttpModule.initialize(AbstractHttpModule.java:78)
WrapperSimpleApp Error: 	at tigase.http.modules.AbstractBareModule.initialize(AbstractBareModule.java:191)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.initBean(Kernel.java:155)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.injectDependencies(Kernel.java:579)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.injectDependencies(Kernel.java:766)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel$DelayedDependenciesInjection.inject(Kernel.java:1341)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.finishDependecyDelayedInjection(Kernel.java:1010)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.initBean(Kernel.java:146)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.injectDependencies(Kernel.java:579)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.initBean(Kernel.java:150)
WrapperSimpleApp Error: 	at tigase.kernel.core.Kernel.getInstance(Kernel.java:385)
WrapperSimpleApp Error: 	at tigase.server.Bootstrap.start(Bootstrap.java:114)
WrapperSimpleApp Error: 	at tigase.server.XMPPServer.start(XMPPServer.java:141)
WrapperSimpleApp Error: 	at tigase.server.XMPPServer.main(XMPPServer.java:122)
WrapperSimpleApp Error: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
WrapperSimpleApp Error: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
WrapperSimpleApp Error: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
WrapperSimpleApp Error: 	at java.lang.reflect.Method.invoke(Unknown Source)
WrapperSimpleApp Error: 	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:325)
WrapperSimpleApp Error: 	at java.lang.Thread.run(Unknown Source)
WrapperSimpleApp Error: Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet
WrapperSimpleApp Error: 	at java.net.URLClassLoader.findClass(Unknown Source)
WrapperSimpleApp Error: 	at java.lang.ClassLoader.loadClass(Unknown Source)
WrapperSimpleApp Error: 	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
WrapperSimpleApp Error: 	at java.lang.ClassLoader.loadClass(Unknown Source)
WrapperSimpleApp Error: 	... 33 more

Possibly related to commit 07311ea (no SetupModeRedirectModule.java loaded?)

Andrzej Wójcik (Tigase) commented 8 years ago

I'm having trouble with replication of this issue as I do not have access to computer with Windows.

However looking at provided stacktrace, I think that there is some issue with classloader when Wrapper is used or in Wrapper settings as class javax.servlet.http.HttpServlet is part of javax.servlet-api.jar which is located inside /jars/ directory of Tigase XMPP Server dist-max package but is not part of -dist package.

Please let me know which package where you using for testing. Was it -dist-max or @-dist@?

Also I'm having trouble to decide how to fix this issue. As I should add javax.servlet-api.jar to -dist package. At the same time there is still tigase-http-api-jetty which requires Jetty which is missing from -dist package as well. Should we add dependencies for Jetty or remove tigase-http-api-jetty from -dist package?

For now I've added javax.servlet-api to -dist package and it should solve this issue. Change will be part of a next snapshot build

Daniel Wisnewski commented 8 years ago

Your fix solved the issue. I've also added the jetty-api to -dist as well in case users want to use jetty to prevent that issue occurring.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
RedmineID
5246
Version
tigase-server-8.0.0
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/tigase-http-api#45
Please wait...
Page is in error, reload to recover