1

We are developing a webapp using WebLogic 10.3.4. our UI team is experiencing pain with the slow turnaround times between a JSP edit and seeing the results in their browser. Things are a lot easier with Tomcat 7.0 but this uses a different JSP compiler from the one we are targetting.

My question is, is it possible to swap out the default compiler in Tomcat and replace with the one from WebLogic? If so, how would I do this? We know that the WebLogic compiler can be called from the command line (we have it in our build). It looked like you could do this with the IBM Jikes compiler in the past, but I can't find any mention of WebLogic.

Andrew Harmel-Law
  • 7,739
  • 12
  • 44
  • 55

1 Answers1

4

--- Edited as question changed slightly ---

You cannot easily swap out the Tomcat JSP compiler for another JSP compiler, as the Tomcat JSP compiler is integrated into Tomcat. While all JSP compilers function in a similar manner, the cost of reworking the integration of one system with another compiler is the reason such a swap is not easily performed. Most web containers do not call these compilers out-of-process, but rather they launch them on dedicated threads in the web container.

That said, perhaps you can avoid compilation in the web container alltogether. If you pre-compile your JSP pages with either the Tomcat or the Weblogic JSP compiler, then you can simply package the previous JSP pages into the WAR as .class files, and when the time comes for the first-access of the previously mentioned JSP file, the web container will not have to pause an additional amount above class access time to compile the JSP into a .class file.

JSP compilers are very much like regular Java compilers, with the main exception being that they take JSP files as "source code" instead of .java files. Once you work out the arguments, CLASSPATH, and parameters for your JSP compiler, you can integrate it into your build chain just like you do your regular .java files.

Details on precompiling with Tomcat's JSP compiler.

Some information on precompiling with Weblogic's JSP compiler.

--- Original Post follows ---

Yes, it is possible; provided that the compilers for both support the same release of java, and are configured to compile to the same release of Java.

Edwin Buck
  • 69,361
  • 7
  • 100
  • 138
  • Thanks @Edwin. can you post how to do this? (I'm editing the question to make this clearer) – Andrew Harmel-Law Feb 15 '11 at 15:17
  • @Andrew, your changes lead me to believe that you want to swap out the compiler in the web container. That's not the best way to go about it, as you need to reprogram the web container to understand the compiler's parameters. A better way to go about it is to pre-compile your JSP pages so the web container doesn't have to compile your JSPs on demand (as people ask for the web pages). – Edwin Buck Feb 15 '11 at 15:34
  • Thanks again @Edwin. This is the route we are likely to have to take. Lickily we already have the precompile step in our build so we'll do this and test. Thanks again for your help. – Andrew Harmel-Law Feb 17 '11 at 09:14