This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet reloading

 
Mike Jenkins
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 809
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Mike Jenkins
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 809
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic