0

I'm trying to migrate an old app from tomcat7 / Java 8 to tomcat9 / Java 11. I receive this weird error when I launch the app, which I cannot explain:

javax.servlet.ServletException: java.lang.NoSuchMethodError: 'void org.apache.jasper.runtime.JspContextWrapper.<init>(javax.servlet.jsp.JspContext, java.util.ArrayList, java.util.ArrayList, java.util.ArrayList, java.util.Map)'

I don't know much about tomcat/jsp so I really don't know what could be wrong.

I feel it could be a OS (debian) problem / dependency management issue , but I'm not so sure. This question seems related, but remained unsolved.

Any ideas on how to figure out what could be wrong ?

chloet
  • 3
  • 1
  • The question you linked is an exact duplicate of your issue. Nothing to do with Debian or dependency management. Here are some explanations on what a [NoSuchMethodError](https://stackoverflow.com/q/35186/2541560) is. As to the root cause of the issue, hard to say with the limited information. A stale compiled JSP class like suggested in the linked q would be one explanation. – Kayaman Jul 28 '21 at 14:13
  • thanks a lot for your comment. I have deleted the work and temp folder and restarted tomcat, and the error remains the same, so I don't think it could be a stale compiled jsp class, could it ? What other root causes could there be, how can I investigate further what could be wrong ? – chloet Jul 28 '21 at 14:34
  • Redeploy the app so all the JSP files are recompiled. The javax-stuff has been moved. – Thorbjørn Ravn Andersen Jul 28 '21 at 14:42

1 Answers1

1

Delete the content of the $TOMCAT_BASE/work folder (not the folder itself).

That will force recompilation of all JSPs, and discard any other stale cached information.

You might as well clear the content of the $TOMCAT_BASE/temp folder while you are at it.

Tomcat should of course be shut down when clearing folders.

Andreas
  • 154,647
  • 11
  • 152
  • 247
  • I think I was deleting the wrong work folder, which is why my fix wasn't working... So now the error is different, it seems that the files in the work folder are not regenerated, I get a "java.lang.ClassNotFoundException: org.apache.jsp.index_jsp". The work folder remains empty. What am I missing ? – chloet Jul 28 '21 at 15:12
  • I can answer my own question: I have to remove the contents of the folder, not the folder itself. – chloet Jul 28 '21 at 15:18