aspose file tools*
The moose likes Tomcat and the fly likes Servlet reloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Servlet reloading" Watch "Servlet reloading" New topic
Author

Servlet reloading

Mike Jenkins
Ranch Hand

Joined: Jul 23, 2006
Posts: 57
I noticed I have to start and restart the Tomcat 5.5.15 Container on each change to my java classes. I would like to have Servlet reloading working but cant get it to work.

I read in a book where I can put this into my conf\server.xml
<DefaultContext reloadable="true">

After I save this in the server.xml file the Apache Tomcat Start button stays highlighted and wont let me Stop it. And if I recompile a java file the changes dont show up in my url page.

Please advise how I can turn on Servlet reloading for my development environment?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Moving to the Tomcat forum


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The "reloadable" attribute goes in the context for YOUR app.

Context entries can be added directly to server.xml but the preferred way to do this with more recent versions is to create a context fragment file.

The name of the file should match your context path (plus the .xml extension)

Example:
In {tomcat-install}/conf/Catalina/localhost, I have a file named myApp.xml
Here are the contents:
Mike Jenkins
Ranch Hand

Joined: Jul 23, 2006
Posts: 57
I did as suggested and now my Tomcat Container wont start and it stays permaently on stopped mode.

Apache Tomcat Service status now says "stopped" and wont start.

I deleted the file you suggested to create because it started to go bad after I created that file and it still wont work.

How do I fix my Tomcat container so it will work again???

Thanks for any suggestions.
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
Place your Context file as Ben suggested and then try starting tomcat from bin directory.

Run startup or tomcat5 (whatever file you have) from bin directory. What it says?. Does your server gets started? If any error is coming then post it here.

Thanks

Naseem
[ July 23, 2006: Message edited by: Naseem Khan ]

Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Mike Jenkins
Ranch Hand

Joined: Jul 23, 2006
Posts: 57
Thanks,

The Tomcat service is now working but still cant get reload to work so I dont have to restart Tomcat after each compile.

Here is my test.xml for my webapp called test:


There are 2 other xml files in the \conf\Catalina\localhost
manager.xml
host-manager.xml
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809

The Tomcat service is now working but still cant get reload to work so I dont have to restart Tomcat after each compile.


Not clear from your post.

Solved or still reloading is not working.

Naseem
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Tomcat will autoDeploy an app if it's located in the webapps directory. When it does this, it may be ignoring your context fragment.

Three things to try:

1.)
Move your application out of the webapps directory (out from under the tomcat directory tree altogether), fix the docBase attribute to match your new location, and restart Tomcat.
This is how my normal dev environment is set up and reloadable works.

2.)
When Tomcat autodeploys from a war file, it looks for the context fragment file in the {app root}/META-INF directory and moves it to conf/Catalina/localhost.
Moving your context fragment file to META-INF may also help.

3.)You can turn off the autodeploy feature by setting it to false in the <Host ../> entry in server.xml.1.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet reloading