• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Servlet reloading

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Tomcat forum
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic