how to cause tomcat to automatically reload a changed javabean?

A

Alex Hunsley

I'm using Apache Tomcat/5.0.27 to test some JSPs, that in turn use some
javabeans I have written.
Tomcat seems to recompile changed jsp files just fine, and AFAIK it would
reload a servlet if the class file had changed (recompiled), but it's not
noticing that I have recompiled the classes that define javabeans. At the
moment I am stopping and restarting tomcat to force a reload of the javabean
classes.

I've tried closing my browser then loading the page again in a new instance of
the browser (because my jsp pages have the 'session' scope and I wondered if
this was the problem) but tomcat is still not using the new javabean class file.

Any hints anyone? Currently plunging through the docs as googling didn't bring
up much...

thanks
alex
 
W

William Brogden

I'm using Apache Tomcat/5.0.27 to test some JSPs, that in turn use some
javabeans I have written.
Tomcat seems to recompile changed jsp files just fine, and AFAIK it
would reload a servlet if the class file had changed (recompiled), but
it's not noticing that I have recompiled the classes that define
javabeans. At the moment I am stopping and restarting tomcat to force a
reload of the javabean classes.

I've tried closing my browser then loading the page again in a new
instance of the browser (because my jsp pages have the 'session' scope
and I wondered if this was the problem) but tomcat is still not using
the new javabean class file.

Any hints anyone? Currently plunging through the docs as googling didn't
bring up much...

thanks
alex

Use the Management application to force a complete reload of
your application. I'm assuming your javabeans are part of this
application and are not shared by other applications.

Bill
 
A

Alex Hunsley

William said:
Use the Management application to force a complete reload of
your application. I'm assuming your javabeans are part of this
application and are not shared by other applications.

Bill

Yup, it's standalone, so that would work. Maybe I'll just go with that then if
it's the best way.

ta
alex
 
C

Chris Riesbeck

Alex Hunsley said:
I'm using Apache Tomcat/5.0.27 to test some JSPs, that in turn use some
javabeans I have written.
Tomcat seems to recompile changed jsp files just fine, and AFAIK it would
reload a servlet if the class file had changed (recompiled), but it's not
noticing that I have recompiled the classes that define javabeans. At the
moment I am stopping and restarting tomcat to force a reload of the javabean
classes.

Make an XML Context fragment for your webapp.

E.g., if you have a GraderServlet, with URL /grader, create
grader.xml with


<Context path="/grader" docBase="../webapps/grader" debug="0"
reloadable="true" />


and put this file in

<tomcat-directory>/conf/Catalina/localhost/
 
A

Alex Hunsley

Chris said:
Make an XML Context fragment for your webapp.

E.g., if you have a GraderServlet, with URL /grader, create
grader.xml with


<Context path="/grader" docBase="../webapps/grader" debug="0"
reloadable="true" />


and put this file in

<tomcat-directory>/conf/Catalina/localhost/

Ah, thank you! That worked a treat.

alex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top