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

Issue with JDK11 and Apache Tomcat 10 #239

Closed
drveresh opened this issue Nov 17, 2020 · 7 comments · Fixed by #242
Closed

Issue with JDK11 and Apache Tomcat 10 #239

drveresh opened this issue Nov 17, 2020 · 7 comments · Fixed by #242

Comments

@drveresh
Copy link

Hi,

My servlet application is unable to get deployed due to the below error. It was working fine with JDK8 and Apache Tomcat 8.

--------------- /apache-tomcat-10/logs/localhost.2020-11-17.log ----------------

17-Nov-2020 09:39:43.241 SEVERE [main] org.apache.catalina.core.StandardContext.filterStart Exception starting filter [UrlRewriteFilter]
	java.lang.ClassCastException: class org.tuckey.web.filters.urlrewrite.UrlRewriteFilter cannot be cast to class jakarta.servlet.Filter (org.tuckey.web.filters.urlrewrite.UrlRewriteFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @1b73be9f; jakarta.servlet.Filter is in unnamed module of loader java.net.URLClassLoader @5f9d02cb)
		at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:250)
		at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
		at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4515)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5152)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)

Please help me out.

@marco-brandizi
Copy link

marco-brandizi commented Feb 24, 2021

I've just met the same problem with the latest version of the Jetty plug-in. Presumably, the problem is that web container developers have decided to move the javax.* namespace to the jakarta.* namespace (which breaks tons of packages, many thanks!!!), details here.

What it happens, I believe, is that Tomcat or Jetty see the UrlRewriteFilter in web.xml and then they try to verify that the configured filter implements the right interface, which isn't javax.servlet.Filter anymore.

I think it can be fixed by adding implements jakarta.servlet.Filter to the current declaration. The two interfaces should be identical, apart from the namespace.

Another possible solution, which could be implemented outside of the urlrewriter package (but it would be worth to file a PR if you do), could be writing a JakartaUrlRewriter, which would extend the existing rewrite and implement the jakarta interface.

@paultuckey could you try it, please?

@paultuckey
Copy link
Owner

I'm unfortunately not in a position to do development on this right now. I'm happy to accept a pull-request though.

@jetztgradnet
Copy link

Any further work on this issue? Anything we can do to help?
Apparently, there was a problem with the provided PR #242, but the error log is no longer available...
With many projects now making the switch to JakartaEE having this variant would be greatly desirable. Alternatively, we need to migrate to another solution which I would like to avoid, as the Tuckey URLRewriteFilter has all we need...

@jetztgradnet
Copy link

Great, thanks, @paultuckey! Would you mind releasing this as a new version in Maven Central as well so we can make use of this in our softwre?

@paultuckey
Copy link
Owner

Hi @jetztgradnet, I got your multiple messages via email, linkedin and here. I would like to help however I don't have a lot of spare time due to family, my paying job etc.

In recent years the container tests (in /container-test) for the library non longer run.  I would like to upgrade these so they actually verify the release before submitting it to maven central.

I have started this work here: #248

If you have any time to help it would be appreciated.

@jetztgradnet
Copy link

Hi @paultuckey, sorry for trying different ways to reach you and thanks for getting back to me! I totally understand that you do not have too much time to spend here and very much appreciate all your work on this project and putting out a new release after completing this change.

I will help trying to get those tests running again.

@paultuckey
Copy link
Owner

I'm also working on upgrading maven dependencies: #249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants