Compatibility with Tomcat 8?

Installation Forum (Inactive)
Compatibility with Tomcat 8? Alex Taylor  2015-07-02 12:41
Status: Closed
 
I am attempting a new v15.1 server installation on MacOS X and when I try to use Tomcat 8 (8.0.23) it fails to start the labkey webapp: catalina.out:
02-Jul-2015 10:03:16.729 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more Filters failed to start. Full details will be found in the appropriate container log file
02-Jul-2015 10:03:16.729 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/labkey] startup failed due to previous errors
labkey.log:
ERROR ModuleLoader             2015-07-02 10:03:16,726    localhost-startStop-1 : Failure occurred during ModuleLoader init.
java.lang.NullPointerException
        at java.io.File.<init>(File.java:277)
        at org.labkey.api.module.ModuleLoader.webappFilesExist(ModuleLoader.java:449)
        at org.labkey.api.module.ModuleLoader.verifyProductionModeResources(ModuleLoader.java:433)
        at org.labkey.api.module.ModuleLoader.doInit(ModuleLoader.java:313)
        at org.labkey.api.module.ModuleLoader.init(ModuleLoader.java:258)
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
        at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
        at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4574)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5193)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:586)
        at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1750)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
The version of Java is 1.8.0_25. The problem does not occur if I use a Tomcat 7 instance instead of the Tomcat 8. Digging in the Tomcat 8 source code for org.apache.catalina.core.StandardContext it appears that this may be due to sending Strings (specified in ModuleLoader's verifyProductionModeResources()) to getRealPath() that are not prepended with a '/' and hence result in it returning null:
4443    public String More ...getRealPath(String path) {
4444        // The WebResources API expects all paths to start with /. This is a
4445        // special case for consistency with earlier Tomcat versions.
4446        if ("".equals(path)) {
4447            path = "/";
4448        }
4449        if (resources != null) {
4450            try {
4451                return resources.getResource(path).getCanonicalPath();
4452            } catch (IllegalArgumentException iae) {
4453                // ServletContext.getRealPath() does not allow this to be thrown
4454            }
4455        }
4456        return null;
4457    }
Are there plans to add Tomcat 8 compatibility? Regards, Alex
 
 
adam responded:  2015-07-02 13:03
Hi Alex,

As you've found, we don't yet support Tomcat 8, only Tomcat 7. I actually installed Tomcat 8 and started working through this issue (and others) a few weeks ago, but put that work on the shelf given the number of issues I found. (For example, after fixing the path issue the next problem is that setResources() is not getting called on LabKeyBoostrapClassLoader... which is a problem.) I hope to revisit this after we ship 15.2... we would like to support Tomcat 8 soon. Another problem we usually have with these transitions is pre-compiled JSPs: there's no guarantee that a JSP compiled against one version of Tomcat will run correctly against a different version.

We would be happy to take any contributions or suggestions you might have in this area.

Cheers,
Adam
 
adam responded:  2015-07-07 13:08
FYI: I just added support for Tomcat 8 in SVN commit r38691. It's available on trunk now and should be released officially in 15.3, after thorough testing.

We'll continue to support Tomcat 7 for the foreseeable future; official LabKey distributions will be built against Tomcat 7 but they should run on either Tomcat 7 or 8.

Adam