aspose file tools*
The moose likes Tomcat and the fly likes Custom JSP Complier in Tomcat 6 ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Custom JSP Complier in Tomcat 6 ? " Watch "Custom JSP Complier in Tomcat 6 ? " New topic
Author

Custom JSP Complier in Tomcat 6 ?

Reinwald Warapen
Greenhorn

Joined: Dec 09, 2010
Posts: 6
Hey,
Im moving my application server from Resin to Tomcat 6. In the process i am facing lots of problems wrt to JSP compilation. (receive loads of JasperExceptions due to syntax errors).
My JSP's using JSTL 1.1 compile and run smootly in Resin .

Is there any way i can use Resin's JSP complition class i.e "com.caucho.jsp.JspCompiler" instead of the Jasper compiler provided in Tomcat 6.

In short Tomcat to use a specific complier instead of Jasper

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Welcome to the JavaRanch, Rein!

What kind of errors are you getting? JSP syntax errors should not be dependent on the JSP compiler, since the JSP syntax is defined in the JEE JSP standard spec. The only exception is if you had a version mismatch on JSP spec levels between the compiler and the source JSPs.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

It's most likely a configuration issue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Reinwald Warapen
Greenhorn

Joined: Dec 09, 2010
Posts: 6
Hey thanks for the quick response.
I am migrating my web app that has approx around 200 jsps from Resin 3.1.3 to Tomcat 6. The problem is that we have not conformed to JSP spec and the Resin compiler was not throwing any exceptions (com.caucho.jsp.JspCompiler present in Resin.jar) .Now in Tomcat the articles tell me it very strict wrt to the JSP standard spec.
When running our web app in Tomcat 6 some of the exceptions we get are :
* /general/_quickLinksElement.jsp(25,16) The function contains must be used with a prefix when a default namespace is not specified
* Attribute value is quoted with " which must be escaped when used within the value.

Also ive read that we can replace Tomcat's default JSP compiler with Jikes

So for a quick fix is there any way I can disable the Jasper compiler and use com.caucho.jsp.JspCompiler present in Resin.jar as the JSP compiler in Tomcat.

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Oh boy. This sounds like a "Git 'R Dun!" edict from Management.

Never time or budget to do it right, just "fix it" and wait for it to break again. Well, as they say, you can pay now or you can pay later, but you'll still pay.

There's a hint in your error message that what you may actually need is some custom JSP taglib(s). If that's the case, maybe you don't need such extreme measures. You may just need to setup the taglib. Also maybe fix some stuff where you've got quotes embedded within quotes, since THAT problem is only going to get worse as time goes by.

Jikes is/was an IBM JDK noted for high performance. I actually don't know if it's still around under that name, although IBM does still field JDK products. I think the one they recommend these days is J9. Regardless, while IBM does have its quirks, I doubt replacing the Java compiler will help.

As for replacing the JSP compiler, there used to be instructions in the documentation at http://tomcat.apache.org, I think. Should still be, if this is still a supported feature. Whether you can bodily substitute the resin JAR into Tomcat without it getting into classpath fights over servlets and other stuff I don't know.

Reinwald Warapen
Greenhorn

Joined: Dec 09, 2010
Posts: 6
thanks for all the help.I fixed all the code breaks and now the application works brilliantly with Tomcat 6.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Custom JSP Complier in Tomcat 6 ?