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

javax.servlet dependency not compatible with tomcat 10 #114

Open
siropa opened this issue Jan 25, 2023 · 8 comments
Open

javax.servlet dependency not compatible with tomcat 10 #114

siropa opened this issue Jan 25, 2023 · 8 comments

Comments

@siropa
Copy link

siropa commented Jan 25, 2023

The pom includes a dependency for javax.servlet-api version 4.0.1. When compiling for target of tomcat 10, getting errors about missing javax.servlet.jsp.tagext.BodyTagSupport. It should be using jakarta.servlet.jsp.tagext.BodyTagSupport which is in jakarta.servlet-api version 6.0.0. Can this old dependency be updated please?

@leonardehrenfried
Copy link
Owner

Sure, could you please send a pull request?

@leonardehrenfried
Copy link
Owner

I just released version 4.1.0 which upgrades a bunch of dependencies including the one you mention. Can you check if it solves your problem?

@siropa
Copy link
Author

siropa commented Feb 2, 2023

I see it pulling the 6.0.0 version of the servlet-api now, but i'm still having the issue. here is what i'm getting:
SEVERE: Compilation error
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/BodyTagSupport
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.jasper.JspC.execute(JspC.java:1498)
at io.leonard.maven.plugins.jspc.JspcWorker.call(JspcWorker.java:27)
at io.leonard.maven.plugins.jspc.JspcWorker.call(JspcWorker.java:9)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/BodyTagSupport
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1236)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1469)
at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:245)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:106)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:211)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:396)
at org.apache.jasper.JspC.processFile(JspC.java:1343)
at org.apache.jasper.JspC$ProcessFile.call(JspC.java:1858)
at org.apache.jasper.JspC$ProcessFile.call(JspC.java:1849)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
... 4 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.jsp.tagext.BodyTagSupport
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 26 more

I used the debug flag with the maven command and don't see any of the old versions of the servlet jars being pulled anymore.

@leonardehrenfried
Copy link
Owner

To be honest, I have no idea how this should work correctly since I haven't touched JSP in over 10 years. If you could send a PR with the correct pom.xml I'm happy to merge it in.

The thing is, there isn't any code in this repo that is referencing javax/servlet/jsp/tagext/BodyTagSupport.

Do you maybe write some custom tags like these https://github.com/leonardehrenfried/jspc-maven-plugin/blob/master/src/it/project_multimodule_with%20space/moduleB/src/main/java/com/example/plugin/jspc/tag/HelloTag.java and have an import on the javax namespace there?

@siropa
Copy link
Author

siropa commented Feb 2, 2023

We do have custom tags like that, but they are all using jakarta references. I even cleaned out my maven repo and then searched everything that was imported with a fresh build for old javax references and didn't find any. I have no idea where that is coming from.

If I had a fix, i'd gladly submit it, but i'm stumped at this point. When i've got some time i'll keep looking it to. thanks for the help.

@leonardehrenfried
Copy link
Owner

leonardehrenfried commented Feb 2, 2023

Ah, I remembered something from last night. I had to change some namespace definition when moving from javax to jakarta in the test projects.

c25931f

Do you have old URIs in your JSPs somewhere?

@siropa
Copy link
Author

siropa commented Feb 2, 2023

Good idea, but no. to test, I created a fake javax.servlet.jsp.tagext.BodyTagSupport.java file in my project. Ran the jsp compiler and found the issue. We use this old pdf library and apparently that has some imbedded references to the old version. So my fix is dealing with that 12year old out of data lib.

thanks for your help and getting the project updated with the newer versions.

@leonardehrenfried
Copy link
Owner

Good detective work!

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