You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by lightbulb432 <ve...@hotmail.com> on 2007/05/25 19:31:09 UTC

Excluding JSP compiler from Tomcat

The JSP spec says that if you precompile JSPs you can reduce the JSP
container footprint by excluding the JSP compiler. How can this be done in
Tomcat?

Thanks.
-- 
View this message in context: http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10807251
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Excluding JSP compiler from Tomcat

Posted by Len Popp <le...@gmail.com>.
Well, you didn't say what version of Tomcat you're using. Those files
do indeed exist, in Tomcat 5.5. For Tomcat 6, in the lib directory
you'll see 3 Jasper jars. Try removing those. I don't know if it'll
cause any problems, but you'll only save a couple of MB of disk space,
and no runtime memory (since you're not using those classes anyway),
and you'll have to maintain your own custom Tomcat install.
-- 
Len

On 5/28/07, lightbulb432 <ve...@hotmail.com> wrote:
>
> I can't seem to find either of those two files in the Tomcat 6
> distribution...interesting.
>
>
>
> Bill Barker-2 wrote:
> >
> >
> > "lightbulb432" <ve...@hotmail.com> wrote in message
> > news:10807251.post@talk.nabble.com...
> >>
> >> The JSP spec says that if you precompile JSPs you can reduce the JSP
> >> container footprint by excluding the JSP compiler. How can this be done
> >> in
> >> Tomcat?
> >
> > You should be able to remove jasper-compiler.jar and
> > jasper-compiler-jdt.jar
> > from $CATALINA_HOME/common/lib (for a whopping savings of 1.5MB).  I
> > haven't
> > tested it, so your milage may very :).
> >
> >>
> >> Thanks.
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10807251
> >> Sent from the Tomcat - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To start a new topic, e-mail: users@tomcat.apache.org
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10837532
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Excluding JSP compiler from Tomcat

Posted by lightbulb432 <ve...@hotmail.com>.
I can't seem to find either of those two files in the Tomcat 6
distribution...interesting.



Bill Barker-2 wrote:
> 
> 
> "lightbulb432" <ve...@hotmail.com> wrote in message 
> news:10807251.post@talk.nabble.com...
>>
>> The JSP spec says that if you precompile JSPs you can reduce the JSP
>> container footprint by excluding the JSP compiler. How can this be done
>> in
>> Tomcat?
> 
> You should be able to remove jasper-compiler.jar and
> jasper-compiler-jdt.jar 
> from $CATALINA_HOME/common/lib (for a whopping savings of 1.5MB).  I
> haven't 
> tested it, so your milage may very :).
> 
>>
>> Thanks.
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10807251
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10837532
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Excluding JSP compiler from Tomcat

Posted by Bill Barker <wb...@wilshire.com>.
"lightbulb432" <ve...@hotmail.com> wrote in message 
news:10807251.post@talk.nabble.com...
>
> The JSP spec says that if you precompile JSPs you can reduce the JSP
> container footprint by excluding the JSP compiler. How can this be done in
> Tomcat?

You should be able to remove jasper-compiler.jar and jasper-compiler-jdt.jar 
from $CATALINA_HOME/common/lib (for a whopping savings of 1.5MB).  I haven't 
tested it, so your milage may very :).

>
> Thanks.
> -- 
> View this message in context: 
> http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10807251
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Excluding JSP compiler from Tomcat

Posted by Rashmi Rubdi <ra...@gmail.com>.
On 5/28/07, lightbulb432 <ve...@hotmail.com> wrote:
>
> Thanks for your response. For the first of the two options you presented,
> what exactly happens during the web.xml autogeneration? Will it simply
> change only the <servlet> elements but leave everything else as is in my
> current web.xml, including <servlet-mapping>? Is there anything else it
> changes?

It depends on how you set up your Ant build to use Jasper.

In any case, the original web.xml gets modified , the original
mappings etc will be retained, the new JSP class mappings will be
~appended~ , so you won't lose anything that was already there.

If you don't want your original web.xml to be modified, using Ant you
can make an intermediate copy of your project, and run Jasper on that
intermediate copy, this way the web.xml of the source files will not
change - which is ideal for development environment settings.

Try it on a separate, small project to see how it works and what works for you.

> The less it changes, the more my development (pre-deployment) would be as
> close to production as possible, I'm guessing...
>
> Thanks.

-Regards
Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Excluding JSP compiler from Tomcat

Posted by lightbulb432 <ve...@hotmail.com>.
Thanks for your response. For the first of the two options you presented,
what exactly happens during the web.xml autogeneration? Will it simply
change only the <servlet> elements but leave everything else as is in my
current web.xml, including <servlet-mapping>? Is there anything else it
changes?

The less it changes, the more my development (pre-deployment) would be as
close to production as possible, I'm guessing...

Thanks.



Rashmi Rubdi-2 wrote:
> 
> On 5/25/07, lightbulb432 <ve...@hotmail.com> wrote:
>>
>> The JSP spec says that if you precompile JSPs you can reduce the JSP
>> container footprint by excluding the JSP compiler. How can this be done
>> in
>> Tomcat?
> 
> I know of 2 ways to pre-compile JSPs
> 
> 1) http://tomcat.apache.org/tomcat-4.1-doc/jasper-howto.html
> 
>     If you're using Ant , than you can add the above jasper task to
> your build process.
> The process first converts all JSPs to .java files, and then all .java
> files are compiled to .class files , during this process the web.xml
> is also auto-modified and there's an entry for every JSP page in your
> app.
> 
> Pre-compiling with jasper is very slow (expected behavior) , so it is
> recommended that the pre-compile should be done just before deploying
> the app to production , there's no need to pre-compile while
> developing/ testing JSPs.
> 
> 2) Use JSP Unit testing tools like HttpUnit or Apache Cactus, as the
> tools test each JSP page they acces the JSP pages for the ~first time~
> , this essentially compiles all JSP pages , then move the war file to
> production.
> 
> Many recommend the 2nd option as it makes your pre-compiled code
> portable aross containers.
> 
>> Thanks.
> 
> Regards
> Rashmi
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10837549
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Excluding JSP compiler from Tomcat

Posted by Rashmi Rubdi <ra...@gmail.com>.
On 5/25/07, lightbulb432 <ve...@hotmail.com> wrote:
>
> The JSP spec says that if you precompile JSPs you can reduce the JSP
> container footprint by excluding the JSP compiler. How can this be done in
> Tomcat?

I know of 2 ways to pre-compile JSPs

1) http://tomcat.apache.org/tomcat-4.1-doc/jasper-howto.html

    If you're using Ant , than you can add the above jasper task to
your build process.
The process first converts all JSPs to .java files, and then all .java
files are compiled to .class files , during this process the web.xml
is also auto-modified and there's an entry for every JSP page in your
app.

Pre-compiling with jasper is very slow (expected behavior) , so it is
recommended that the pre-compile should be done just before deploying
the app to production , there's no need to pre-compile while
developing/ testing JSPs.

2) Use JSP Unit testing tools like HttpUnit or Apache Cactus, as the
tools test each JSP page they acces the JSP pages for the ~first time~
, this essentially compiles all JSP pages , then move the war file to
production.

Many recommend the 2nd option as it makes your pre-compiled code
portable aross containers.

> Thanks.

Regards
Rashmi

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Excluding JSP compiler from Tomcat

Posted by Lakshmi Venkataraman <la...@foundrynet.com>.
I am a Tomcat newbie.   We use Tomcat 5.5.23, *Nix and Windows.
My recent experience was that in my development environment, if I had
the application web.xml
(as opposed to global web.xml under conf directory)
with the mappings as specified below, then Tomcat refused to compile and
was looking for
precompiled classes.
Then, I removed the mappings from the application web.xml, put ant.jar
and tools.jar in
$Catalina_HOME/commmon/lib and removed jasper-compiler-jdt.jar from the
same place for 
Tomcat to compile the JSP files on the fly.

In the production environment, with the web.xml as defined below, and
with precompiled classes
placed in the proper location, Tomcat does not try to compile at all, as
desired.

So in summary, I did not do anything special to "disable" compilation
but rather I had to do
the steps outlined above to "enable" compilation.

--Lakshmi

-----Original Message-----
From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
Sent: Friday, May 25, 2007 12:32 PM
To: users@tomcat.apache.org
Subject: RE: Excluding JSP compiler from Tomcat


In your production environment have you "disabled" or "excluded" the
actual Tomcat piece that does the JSP compilation, to decrease the size
and memory usage (no matter how small) of the production Tomcat install?
The part of the JSP spec that I referred to in my original post seemed
to indicate that it might be possible depending on your container. As
Tomcat is the RI, I'm wondering whether this capability is available.



Lakshmi Venkataraman wrote:
> 
> In our development environment we compile JSPs on the fly.
> In our production environment we have precompiled JSP classes.
> 
> In the PRODUCTION environment, webapps/WEB-INF/web.xml have <servlet> 
> and <servlet-mapping> defined for every JSP page.
> For example:
>   <servlet>
>        <servlet-name>MyAppJsp1</servlet-name>
>        <servlet-class>jsp.myAppJsp1</servlet-class>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>MyAppJsp1</servlet-name>
>         <url-pattern>/jsp/MyAppJsp1.jsp</url-pattern>
>     </servlet-mapping>
> 
> The precompiled JSP classes are placed inside WEB-INF/classes/jsp. I 
> guess you can also probably archive these files in a WAR file.
> 
> 
> --Lakshmi
> 
> -----Original Message-----
> From: lightbulb432 [mailto:veerukrishnan@hotmail.com]
> Sent: Friday, May 25, 2007 10:31 AM
> To: users@tomcat.apache.org
> Subject: Excluding JSP compiler from Tomcat
> 
> 
> The JSP spec says that if you precompile JSPs you can reduce the JSP 
> container footprint by excluding the JSP compiler. How can this be 
> done in Tomcat?
> 
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.htm
> l#
> a10807251
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, 
> e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, 
> e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

--
View this message in context:
http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#
a10809085
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Excluding JSP compiler from Tomcat

Posted by lightbulb432 <ve...@hotmail.com>.
In your production environment have you "disabled" or "excluded" the actual
Tomcat piece that does the JSP compilation, to decrease the size and memory
usage (no matter how small) of the production Tomcat install? The part of
the JSP spec that I referred to in my original post seemed to indicate that
it might be possible depending on your container. As Tomcat is the RI, I'm
wondering whether this capability is available.



Lakshmi Venkataraman wrote:
> 
> In our development environment we compile JSPs on the fly.
> In our production environment we have precompiled JSP classes.
> 
> In the PRODUCTION environment, webapps/WEB-INF/web.xml have 
> <servlet> and <servlet-mapping> defined for every JSP page.
> For example:
>   <servlet>
>        <servlet-name>MyAppJsp1</servlet-name>
>        <servlet-class>jsp.myAppJsp1</servlet-class>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>MyAppJsp1</servlet-name>
>         <url-pattern>/jsp/MyAppJsp1.jsp</url-pattern>
>     </servlet-mapping>
> 
> The precompiled JSP classes are placed inside WEB-INF/classes/jsp. I
> guess you can also probably archive
> these files in a WAR file. 
> 
> 
> --Lakshmi 
> 
> -----Original Message-----
> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
> Sent: Friday, May 25, 2007 10:31 AM
> To: users@tomcat.apache.org
> Subject: Excluding JSP compiler from Tomcat
> 
> 
> The JSP spec says that if you precompile JSPs you can reduce the JSP
> container footprint by excluding the JSP compiler. How can this be done
> in Tomcat?
> 
> Thanks.
> --
> View this message in context:
> http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#
> a10807251
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#a10809085
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Excluding JSP compiler from Tomcat

Posted by Lakshmi Venkataraman <la...@foundrynet.com>.
In our development environment we compile JSPs on the fly.
In our production environment we have precompiled JSP classes.

In the PRODUCTION environment, webapps/WEB-INF/web.xml have 
<servlet> and <servlet-mapping> defined for every JSP page.
For example:
  <servlet>
       <servlet-name>MyAppJsp1</servlet-name>
       <servlet-class>jsp.myAppJsp1</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>MyAppJsp1</servlet-name>
        <url-pattern>/jsp/MyAppJsp1.jsp</url-pattern>
    </servlet-mapping>

The precompiled JSP classes are placed inside WEB-INF/classes/jsp. I
guess you can also probably archive
these files in a WAR file. 


--Lakshmi 

-----Original Message-----
From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
Sent: Friday, May 25, 2007 10:31 AM
To: users@tomcat.apache.org
Subject: Excluding JSP compiler from Tomcat


The JSP spec says that if you precompile JSPs you can reduce the JSP
container footprint by excluding the JSP compiler. How can this be done
in Tomcat?

Thanks.
--
View this message in context:
http://www.nabble.com/Excluding-JSP-compiler-from-Tomcat-tf3817429.html#
a10807251
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org