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

Build uberwar with jakarta servlet #517

Open
madoxas opened this issue Dec 1, 2024 · 3 comments · May be fixed by weavejester/lein-ring#224
Open

Build uberwar with jakarta servlet #517

madoxas opened this issue Dec 1, 2024 · 3 comments · May be fixed by weavejester/lein-ring#224

Comments

@madoxas
Copy link

madoxas commented Dec 1, 2024

Hi, how should I build a war archive which would use Jakarta Servlets?
Building the war by following documentation does not work. I get the following error when deploying to Tomcat 11:

01-Dec-2024 16:17:55.871 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class [hello_world.listener]
	java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
		at java.base/java.lang.ClassLoader.defineClass1(Native Method)
		at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
		at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
		...

Any help would be much appreciated .

@weavejester
Copy link
Member

My guess is that this is running afoul of the move from javax.servlet to jakarta.servlet.

If you're using Lein-Ring, that project will need to be updated to use jakarta.servlet.ServletContextListener and ring.util.jakarta.servlet, instead of the older javax.servlet.ServletContextListener and ring.util.servlet.

Lein-Ring can either be fixed, or you can create the war manually.

@madoxas
Copy link
Author

madoxas commented Dec 2, 2024

Yes, I was trying to use Lein-Ring to create a war.

Let's assume it will not be updated fast. Do you have some how-to I could follow to create the war myself for the Ring app I have?

@weavejester
Copy link
Member

weavejester commented Dec 2, 2024

Perhaps the easiest way would be to clone Lein-Ring, then do a search and replace for the namespaces and classes I listed above. Replace them with the Jakarta version, then install locally using lein install. If it works, you can submit a pull request with the changes.

Otherwise, a quick search reveals this page. There's likely other tutorials out there as well.

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

Successfully merging a pull request may close this issue.

2 participants