You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Wilson <jn...@dallas.photronics.com> on 2004/10/11 22:51:59 UTC

reloading JSP files without reloading classes/beans

Hello,

    I'm running 3.3.1 (and yes, I'll be upgrading to 5.x in the next few 
weeks as time allows) and want to reload JSP files, but not any class 
files. The root of the problem is that during beta testing I'm making 
lots of changes quickly(to JSP and classes/beans), but my system is in 
use. Everytime I recompile a classes/beans class it forces everyone to 
re-login to my system(context reloadable="true"). Now, if I set 
reloadable to "false" the JSP files won't get recompiled...and I have to 
restart tomcat to effect the changes...no savings. Any ideas?

Thanks and Regards,
  JW

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: reloading JSP files without reloading classes/beans

Posted by Jonathan Wilson <jn...@dallas.photronics.com>.
Just an FYI for anybody else that is trying to learn the "standard" way 
of doing things in Tomcat development. The following article is out of 
date with respect to the most recent version of Tomcat, but it does 
provide a framework for doing JSP development using Tomcat. It also  
provides code/scripts that create WAR's and deploys them for you.

http://jakarta.apache.org/tomcat/tomcat-3.2-doc/appdev/contents.html

--JW

QM wrote:

>On Mon, Oct 11, 2004 at 05:27:05PM -0500, Jonathan Wilson wrote:
>:     New Question (While I've got ya :): Given that I can use a WAR file 
>: to "deploy," would you advise using Tomcat 5.x as my test server, 
>: creating a WAR and then deploying that to a production 3.3.1 server? 
>: This would kinda let me test using 5.x and still support a 3.3.1 box. 
>
>Not really.  To run an app under Tomcat 5, you should build against the
>Tomcat 5 JARs and such, which would limit the chances of that same WAR
>file working transparently under Tomcat 3.
>
>Not to mention, you really want your dev and production environments to
>mirror one another.  Otherwise, how can you be certain the app will act
>the same in the two environments?  To experiment with Tomcat 5, setup a
>separate instance and rebuild your app there.  You can run both Tomcat
>versions on the same machine, if you play your cards right.
>
>For your other questions (e.g. how to create a WAR file, how to deploy),
>you may want to review the servlet spec and the Tomcat docs.  
>
>-QM
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: reloading JSP files without reloading classes/beans

Posted by QM <qm...@brandxdev.net>.
On Mon, Oct 11, 2004 at 05:27:05PM -0500, Jonathan Wilson wrote:
:     New Question (While I've got ya :): Given that I can use a WAR file 
: to "deploy," would you advise using Tomcat 5.x as my test server, 
: creating a WAR and then deploying that to a production 3.3.1 server? 
: This would kinda let me test using 5.x and still support a 3.3.1 box. 

Not really.  To run an app under Tomcat 5, you should build against the
Tomcat 5 JARs and such, which would limit the chances of that same WAR
file working transparently under Tomcat 3.

Not to mention, you really want your dev and production environments to
mirror one another.  Otherwise, how can you be certain the app will act
the same in the two environments?  To experiment with Tomcat 5, setup a
separate instance and rebuild your app there.  You can run both Tomcat
versions on the same machine, if you play your cards right.

For your other questions (e.g. how to create a WAR file, how to deploy),
you may want to review the servlet spec and the Tomcat docs.  

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: reloading JSP files without reloading classes/beans

Posted by Jonathan Wilson <jn...@dallas.photronics.com>.
Bob, thanks for all the good pointers. This is just the information 
about web-app development I've been needing but didn't know how to 
find(or what to look for). I've played with ANT a bit before, but I 
didn't know there was an applet to do the deployment for me(is that 
process portable to diff web-app servers?).

I've got the same problem with session retention after a reload(if 
contexts' reloadable="true" that is) - and it sounds like it will still 
be a problem after I upgrade my development practices and start using 
WARs. Since you seem like a free thinker :) do you have any ideas on a 
solution for that problem? I was researching load-balancing Monday and 
came across a solution that mentioned sessions were retained on a 
different instance of tomcat(but were accessible to all, somehow - too 
much for me to digest); perhaps that will provide a path? Here's the 
link: http://www.onjava.com/pub/a/onjava/2004/04/14/clustering.html

Regards,
  JW

Robert Bateman wrote:

>On Mon, 2004-10-11 at 18:27, Jonathan Wilson wrote:
>  
>
>>Bob,
>>
>>    You just answered my follow up to your previous email :)
>>    Hmm, so I run a concurrent version of my production app(being 
>>careful not to impact the databases) either on a different instance of 
>>Tomcat or just a different context within the same instance of Tomcat. 
>>    
>>
>
>Yes.  I use a tool called ANT to process, build and deploy my
>applications via WAR files.  In my ANT build file, I have separate tasks
>that deploy to production and test.  Because I am deploying using a WAR
>file, each application has it's own configuration file (server.xml)
>called context.xml.  In my case, I have two different configuration
>files - each specifically tailored to the environment I will deploy
>into.  All my ANT task does is copy the appropriate config during the
>build.
>
>  
>
>>Then when I'm ready I package up the source code into a WAR(what tool do 
>>I use for that? - must do research), copy it into the production servers 
>>    
>>
>
>You build the WAR file with a program called JAR.  WAR files are zip
>files with different extensions (in fact, you can rename a WAR file to
>.ZIP and open the file for inspection.)
>
>As you build the WAR file, you want to compile any source modules that
>need compiling and place them into WEB-INF/classes.  JAR files go into
>WEB-INF/lib so that the WAR file is self contained.
>
>  
>
>>webapps directory(and hopefully have all the configuration set properly 
>>    
>>
>
>If your version of Tomcat supports it, instead of copying into the
>WEBAPPS folder, you can use the manager applets' UNDEPLOY/DEPLOY
>capability.  This allows the server to take your WAR file and put it
>into the appropriate place on the server.  Under TC 4.1 and newer, I've
>been using a task in ANT that communicated with the manager applet for
>me and does all of the un/deploying - quite spiffy.
>
>  
>
>>to auto-expand) and then what? If the WAR is automatically expanded do 
>>the new files take effect immediately
>>    
>>
>
>I'm not sure about TC version 3 (I use 4.1 and 5.0), but on my server,
>the WAR file is placed into the appropriate place and put "live" as soon
>as it's deployed.  I've found in my environment, that I have to be
>careful not to deploy when there are active sessions because my
>application doesn't handle the refresh gracefully.
>
>  
>
>>or do I need to restart tomcat still. Does the context in the server.xml 
>>need reloadable="true" set for a WAR file expansion to take effect 
>>immediately?
>>    
>>
>
>With WAR files, you don't touch server.xml any more.  All of your web
>application specific configuration parameters are placed into
>context.xml in a folder called META-INF within the WAR.  The server
>parses this file to determine how to deploy your application, what
>resources it needs, logging, etc.  Nicely self contained.
>
>  
>
>>    Thanks for the info..connected some dots for me.
>>
>>    New Question (While I've got ya :): Given that I can use a WAR file 
>>to "deploy," would you advise using Tomcat 5.x as my test server, 
>>creating a WAR and then deploying that to a production 3.3.1 server? 
>>    
>>
>
>I gotta agree with QM on this one...  Test with the version that is in
>production.
>
>Is it possible for you folks to atleast migrate up to TC 4.1.xx in
>production?  Your closer to current that way and migrating to 5.xx might
>be easier once you feel comfortable with TC 5.
>
>  
>
>>This would kinda let me test using 5.x and still support a 3.3.1 box. 
>>The app is very self-contained, except for a load of jar's in the lib.
>>
>>Thanks for you time!!
>>    JW
>>
>>   
>>
>>
>>    
>>
>
>Bob
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>

Re: reloading JSP files without reloading classes/beans

Posted by Robert Bateman <bo...@sequoiallc.com>.
On Mon, 2004-10-11 at 18:27, Jonathan Wilson wrote:
> Bob,
> 
>     You just answered my follow up to your previous email :)
>     Hmm, so I run a concurrent version of my production app(being 
> careful not to impact the databases) either on a different instance of 
> Tomcat or just a different context within the same instance of Tomcat. 

Yes.  I use a tool called ANT to process, build and deploy my
applications via WAR files.  In my ANT build file, I have separate tasks
that deploy to production and test.  Because I am deploying using a WAR
file, each application has it's own configuration file (server.xml)
called context.xml.  In my case, I have two different configuration
files - each specifically tailored to the environment I will deploy
into.  All my ANT task does is copy the appropriate config during the
build.

> Then when I'm ready I package up the source code into a WAR(what tool do 
> I use for that? - must do research), copy it into the production servers 

You build the WAR file with a program called JAR.  WAR files are zip
files with different extensions (in fact, you can rename a WAR file to
.ZIP and open the file for inspection.)

As you build the WAR file, you want to compile any source modules that
need compiling and place them into WEB-INF/classes.  JAR files go into
WEB-INF/lib so that the WAR file is self contained.

> webapps directory(and hopefully have all the configuration set properly 

If your version of Tomcat supports it, instead of copying into the
WEBAPPS folder, you can use the manager applets' UNDEPLOY/DEPLOY
capability.  This allows the server to take your WAR file and put it
into the appropriate place on the server.  Under TC 4.1 and newer, I've
been using a task in ANT that communicated with the manager applet for
me and does all of the un/deploying - quite spiffy.

> to auto-expand) and then what? If the WAR is automatically expanded do 
> the new files take effect immediately

I'm not sure about TC version 3 (I use 4.1 and 5.0), but on my server,
the WAR file is placed into the appropriate place and put "live" as soon
as it's deployed.  I've found in my environment, that I have to be
careful not to deploy when there are active sessions because my
application doesn't handle the refresh gracefully.

> or do I need to restart tomcat still. Does the context in the server.xml 
> need reloadable="true" set for a WAR file expansion to take effect 
> immediately?

With WAR files, you don't touch server.xml any more.  All of your web
application specific configuration parameters are placed into
context.xml in a folder called META-INF within the WAR.  The server
parses this file to determine how to deploy your application, what
resources it needs, logging, etc.  Nicely self contained.

> 
>     Thanks for the info..connected some dots for me.
> 
>     New Question (While I've got ya :): Given that I can use a WAR file 
> to "deploy," would you advise using Tomcat 5.x as my test server, 
> creating a WAR and then deploying that to a production 3.3.1 server? 

I gotta agree with QM on this one...  Test with the version that is in
production.

Is it possible for you folks to atleast migrate up to TC 4.1.xx in
production?  Your closer to current that way and migrating to 5.xx might
be easier once you feel comfortable with TC 5.

> This would kinda let me test using 5.x and still support a 3.3.1 box. 
> The app is very self-contained, except for a load of jar's in the lib.
> 
> Thanks for you time!!
>     JW
> 
>    
> 
> 

Bob


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: reloading JSP files without reloading classes/beans

Posted by Jonathan Wilson <jn...@dallas.photronics.com>.
Bob,

    You just answered my follow up to your previous email :)
    Hmm, so I run a concurrent version of my production app(being 
careful not to impact the databases) either on a different instance of 
Tomcat or just a different context within the same instance of Tomcat. 
Then when I'm ready I package up the source code into a WAR(what tool do 
I use for that? - must do research), copy it into the production servers 
webapps directory(and hopefully have all the configuration set properly 
to auto-expand) and then what? If the WAR is automatically expanded do 
the new files take effect immediately
or do I need to restart tomcat still. Does the context in the server.xml 
need reloadable="true" set for a WAR file expansion to take effect 
immediately?

    Thanks for the info..connected some dots for me.

    New Question (While I've got ya :): Given that I can use a WAR file 
to "deploy," would you advise using Tomcat 5.x as my test server, 
creating a WAR and then deploying that to a production 3.3.1 server? 
This would kinda let me test using 5.x and still support a 3.3.1 box. 
The app is very self-contained, except for a load of jar's in the lib.

Thanks for you time!!
    JW

   


Robert Bateman wrote:

>The best advice I can give you is to investigate running your "test"
>application in a different context on the server.  That way, you can
>recompile / alter the JSP files and everything else to your hearts
>content.  IF that isn't possible, Tomcat runs quite nicely on my
>development machine where I can make changes without affecting anyone
>else.
>
>Bob
>
>On Mon, 2004-10-11 at 16:51, Jonathan Wilson wrote:
>  
>
>>Hello,
>>
>>    I'm running 3.3.1 (and yes, I'll be upgrading to 5.x in the next few 
>>weeks as time allows) and want to reload JSP files, but not any class 
>>files. The root of the problem is that during beta testing I'm making 
>>lots of changes quickly(to JSP and classes/beans), but my system is in 
>>use. Everytime I recompile a classes/beans class it forces everyone to 
>>re-login to my system(context reloadable="true"). Now, if I set 
>>reloadable to "false" the JSP files won't get recompiled...and I have to 
>>restart tomcat to effect the changes...no savings. Any ideas?
>>
>>Thanks and Regards,
>>  JW
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>

Re: reloading JSP files without reloading classes/beans

Posted by Robert Bateman <bo...@sequoiallc.com>.
The best advice I can give you is to investigate running your "test"
application in a different context on the server.  That way, you can
recompile / alter the JSP files and everything else to your hearts
content.  IF that isn't possible, Tomcat runs quite nicely on my
development machine where I can make changes without affecting anyone
else.

Bob

On Mon, 2004-10-11 at 16:51, Jonathan Wilson wrote:
> Hello,
> 
>     I'm running 3.3.1 (and yes, I'll be upgrading to 5.x in the next few 
> weeks as time allows) and want to reload JSP files, but not any class 
> files. The root of the problem is that during beta testing I'm making 
> lots of changes quickly(to JSP and classes/beans), but my system is in 
> use. Everytime I recompile a classes/beans class it forces everyone to 
> re-login to my system(context reloadable="true"). Now, if I set 
> reloadable to "false" the JSP files won't get recompiled...and I have to 
> restart tomcat to effect the changes...no savings. Any ideas?
> 
> Thanks and Regards,
>   JW
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org