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

ERROR: Failed to start i2ptunnel java.lang.NoClassDefFoundError: jakarta/servlet/ServletException #42

Closed
demaniak opened this issue Mar 22, 2023 · 4 comments

Comments

@demaniak
Copy link

I previously, for version 2.0.0 I believe, followed the instructions for installation on debian here.

I built this as a docker image.
Everything worked fine.

Today I basically rebuilt it all, to pull in the latest i2p packages.

When starting i2p router, I see errors like these in the logs:

2023/03/22 16:31:23 | ERROR: Failed to start i2ptunnel java.lang.NoClassDefFoundError: jakarta/servlet/ServletException
2023/03/22 16:31:23 | java.lang.NoClassDefFoundError: jakarta/servlet/ServletException
2023/03/22 16:31:23 | 	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
2023/03/22 16:31:23 | 	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
2023/03/22 16:31:23 | 	at java.base/java.lang.Class.getConstructor0(Class.java:3578)
2023/03/22 16:31:23 | 	at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2754)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.server.handler.ContextHandler$StaticContext.createInstance(ContextHandler.java:2902)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletContextHandler$Context.createInstance(ServletContextHandler.java:1299)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.server.handler.ContextHandler$StaticContext.createServlet(ContextHandler.java:2919)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletHolder.newInstance(ServletHolder.java:1202)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:592)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:415)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletHandler.lambda$initialize$0(ServletHandler.java:750)
2023/03/22 16:31:23 | 	at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
2023/03/22 16:31:23 | 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
2023/03/22 16:31:23 | 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
2023/03/22 16:31:23 | 	at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
2023/03/22 16:31:23 | 	at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:735)
2023/03/22 16:31:23 | 	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:774)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:379)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:916)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
2023/03/22 16:31:23 | 	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
2023/03/22 16:31:23 | 	at net.i2p.router.web.WebAppStarter.startWebApp(WebAppStarter.java:126)
2023/03/22 16:31:23 | 	at net.i2p.router.web.WebAppStarter.startWebApp(WebAppStarter.java:101)
2023/03/22 16:31:23 | 	at net.i2p.router.web.RouterConsoleRunner.startConsole(RouterConsoleRunner.java:844)
2023/03/22 16:31:23 | 	at net.i2p.router.web.RouterConsoleRunner.startup(RouterConsoleRunner.java:239)
2023/03/22 16:31:23 | 	at net.i2p.router.startup.RouterAppManager.addAndStart(RouterAppManager.java:54)
2023/03/22 16:31:23 | 	at net.i2p.router.startup.LoadClientAppsJob$RunApp.run(LoadClientAppsJob.java:303)
2023/03/22 16:31:23 | 	at java.base/java.lang.Thread.run(Thread.java:833)
2023/03/22 16:31:23 | 	at net.i2p.util.I2PThread.run(I2PThread.java:103)
2023/03/22 16:31:23 | Caused by: java.lang.ClassNotFoundException: jakarta.servlet.ServletException
2023/03/22 16:31:23 | 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
2023/03/22 16:31:23 | 	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
2023/03/22 16:31:23 | 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
2023/03/22 16:31:23 | 	... 33 more

Obviously nothing works.

This feels like a missed dependency in the i2p package, but maybe I'm mistaken and there is some way to fix this from the OS/container side?

OS used: debian bookworm (slim base image tag)
JDK: OpenJDK 17-jre (installed as dependency for i2p)

The same behaviour exist on x86 and armhf.

@themonk14
Copy link

Hi, I was facing the same issue and managed to find a fix, it's just that you need to install libjakarta-servelet-api-java package using apt. Then find the jakarta jar file and copy it to i2p lib directory. While doing this make sure your i2prouter is not running. Once the said jar file is copied, start your i2prouter instance. This should fix the issue. If you still need help sorting this issue, I'm happy to share a bash script. Enjoy privacy, do good stuff. ✌🏻

@themonk14
Copy link

themonk14 commented Mar 25, 2023

#!/bin/bash

sudo apt install -y libjakarta-servlet-api-java

#this is optional
#if you can't locate jakarta-servlet-api-5.0.0.jar then use the following command to find it
#find / -name jakarta-servlet-api-5.0.0.jar 2>/dev/null

sudo cp /usr/share/java/jakarta-servlet-api-5.0.0.jar /usr/share/i2p/lib/

@demaniak
Copy link
Author

Hi, I was facing the same issue and managed to find a fix, it's just that you need to install libjakarta-servelet-api-java package using apt. Then find the jakarta jar file and copy it to i2p lib directory. While doing this make sure your i2prouter is not running. Once the said jar file is copied, start your i2prouter instance. This should fix the issue. If you still need help sorting this issue, I'm happy to share a bash script. Enjoy privacy, do good stuff. ✌🏻

My dude, thanks!
This did indeed fix things :)

@demaniak
Copy link
Author

Issue resolved by manually installing jakarta-servlet-api, and adding jar to i2p lib folder, as suggested by @themonk14

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

2 participants