Tomcat 11 and Tuckey

Today I noticed that Tuckey 4.0.3 and Tomcat 11 do not want to play nicely with each other. If you add Tuckey like described here, Tomcat throws an error during startup:
java.lang.ClassCastException: class org.tuckey.web.filters.urlrewrite.UrlRewriteFilter cannot be cast to class jakarta.servlet.Filter

Any advice on how to make this work again? I’ll add the full stack trace below.

Thanks in advance!

Stack trace:

13-May-2025 15:00:07.483 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 and jakarta.servlet.Filter are in unnamed module of loader java.net.URLClassLoader @63c12fb0)
		at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
		at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:97)
		at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3865)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4464)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
		at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1164)
		at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1160)
		at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
		at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
		at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
		at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:716)
		at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:769)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
		at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1164)
		at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1160)
		at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
		at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
		at java.base/java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
		at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:716)
		at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:203)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
		at org.apache.catalina.core.StandardService.startInternal(StandardService.java:412)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
		at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:866)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164)
		at org.apache.catalina.startup.Catalina.start(Catalina.java:759)
		at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
		at java.base/java.lang.reflect.Method.invoke(Unknown Source)
		at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:342)
		at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:473)

Have you tried with the latest Tuckey? I think 5.1.3 is available and should work…

Thanks @seb - no, I have not tried yet. I was being lazy, thought you guys may have a drop in solution already. :wink:

Out of curiosity, which Lucee and Tomcat versions do you use for your deployments?

Hi,

bringing this up again. Installed a new server with Tomcat 11, tuckeyrewrite 4.x doesn’t work, installed tuckeyrewrite 5.1.3 instead.

Having the following effect: Whatever subfolder url is called, always the homepage is returned. This is also for files served bei the assetmanager (images) and assetfiles like .js and .css.

The urlrewrite basically works, I can toggle on/off the rule for the lucee admin and also the add trailing slash works.

I narrowed it down to these two rules:

    <rule>
        <note>
            All request to *.html or ending in / will be rewritten to /index.cfm
        </note>
        <from>^(/((.*?)(\.html|/))?)$</from>
        <to last="true">%{context-path}/index.cfm</to>
    </rule>

    <rule>
        <note>
            All request to system static assets that live under /preside/system/assets
            should go through CFML and will be rewritten to /index.cfm
        </note>
        <from>^/preside/system/assets/.*$</from>
        <to last="true">%{context-path}/index.cfm</to>
    </rule>

Some website said, that %{context-path} may is the issue and should be removed. Didn’t work.

Any hint what could be wrong here?
Any other variable tha must be handled through tomcat to preside?

Thanks
Michi

SOLVED

The issue was not tuckey here. Please find the solution here: Solution: How to get CGI.X-Original-URL if it is missing

We do not use Tomcat. But we use both latest stable Lucee 5 and Lucee 6. We use nginx to proxy.

Question: What do you use instead of Tomcat?

We use our own Undertow based servlet. Super light weight and just does what we need it to do.