Opened 12 years ago

Closed 12 years ago

#1636 closed task (fixed)

Test BASE with Tomcat 7

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 3.0
Component: web Version:
Keywords: Cc:

Description

Check if BASE works with Tomcat 7 and if not, see if we can fix any problems.

Change History (9)

comment:1 by Nicklas Nordborg, 12 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 by Nicklas Nordborg, 12 years ago

It seems to be working fairly good. Tomcat is able to start and it is possible to login to BASE. There is a warning message in catalina.out:

Nov 1, 2011 12:44:16 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. 
Enable debug logging for this logger for a complete list of JARs 
that were scanned but no TLDs were found in them. Skipping unneeded 
JARs during scanning can improve startup time and JSP compilation time.

After investigating this issue it seems like Tomcat is scanning all JAR files in WEB-INF/lib. To get rid of that the catalina.properties file must include a setting that lists which files to ignore. The debug message in the log says:

Nov 1, 2011 12:47:55 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar
FINE: No TLD files were found in [file:/home/jersild/nicklas/program/tomcat/
webapps/trunk/WEB-INF/lib/base-core-3.0.0.jar]. 
Consider adding the JAR to the tomcat.util.scan.DefaultJarScanner.jarsToSkip 
property in CATALINA_BASE/conf/catalina.properties file.

So, it is nothing that we can control from the BASE side. It is probably not too important either...

comment:3 by Nicklas Nordborg, 12 years ago

There are four JSP files that can't be compiled (using the CompileAll servlet):

  • /admin/extensions/details.jsp (line: 291, column: 55) Attribute qualified names must be unique within an element
  • /admin/services/services.jsp (line: 119, column: 58) Attribute qualified names must be unique within an element
  • /biomaterials/biosources/edit_biosource.jsp (line: 177, column: 73) The JSP specification requires that an attribute name is preceded by whitespace
  • /views/trashcan/list_trash.jsp (line: 214, column: 11) Attribute qualified names must be unique within an element

comment:4 by Nicklas Nordborg, 12 years ago

(In [5839]) References #1636: Test BASE with Tomcat 7

Fixes JSP compilation problems.

comment:5 by Nicklas Nordborg, 12 years ago

Milestone: BASE 3.1BASE 3.0

comment:6 by Nicklas Nordborg, 12 years ago

The extensions system seems to be working fine, except for the XJSP compiler (when testing the "Hello X-JSP world" example):

tried to access field org.apache.jasper.compiler.JDTCompiler.log from class net.sf.basedb.clients.web.extensions.XJspCompiler
Stack trace 	

java.lang.IllegalAccessError
...at net.sf.basedb.clients.web.extensions.XJspCompiler.generateClass(XJspCompiler.java:129)
...at org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
...at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
...at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
...at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:644)
...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)

It seems like the JDTCompiler.log field is now a private field, which can probably be fixed by creating our own logger.

comment:7 by Nicklas Nordborg, 12 years ago

(In [5840]) References #1636: Test BASE with Tomcat 7

Using a private logger instead of relying on the one in the superclass.

comment:8 by Nicklas Nordborg, 12 years ago

The XJSP compiler still doesn't work:

org.apache.jasper.compiler.JspRuntimeContext.getParentClassLoader()Ljava/net/URLClassLoader;
Stack trace 	

java.lang.NoSuchMethodError
...at net.sf.basedb.clients.web.extensions.XJspCompiler.getWebAppClassLoader(XJspCompiler.java:209)
...at net.sf.basedb.clients.web.extensions.XJspCompiler.getPluginsDir(XJspCompiler.java:222)
...at net.sf.basedb.clients.web.extensions.XJspCompiler.init(XJspCompiler.java:117)
...at org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:228)
...at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:636)
...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)

It seems like the JspRuntimeContext.getParentClassLoader() now returns a ClassLoader instead of a URLClassLoader. The problem can be fixed by re-compiling the XJSP compiler against jasper.jar that ships with Tomcat 7. No code changes are required. Unfortunately, this creates an XJSP compiler that is not compatible with Tomcat 6. No matter what we do we will need different versions for Tomcat 6 and 7. So, let's stick to Tomcat 6 for the moment. If anyone absolutely needs an XJSP compiler for Tomcat 7, it is relatively easy to compile BASE for that.

comment:9 by Nicklas Nordborg, 12 years ago

Resolution: fixed
Status: assignedclosed

(In [5841]) Fixes #1636: Test BASE with Tomcat 7

Updated documentation with information about Tomcat 7.

Note: See TracTickets for help on using tickets.