Win a copy of Event Streams in Action this week in the Java in General forum!
    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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

how to compile servelts

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Report post to moderator
It's been a long time since I've programmed using servlets, can someone tell me how I can compile servlets?
I am running Win2K and I have regualr applets working. How can I compile servlets? Which .jar file should I look for?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Report post to moderator
The file you want is still servlet.jar - if you already have a servlet engine it should have a copy - otherwise download Tomcat from jakarta.apache.org
Once you have the right library, compilation is just like other Java programs.
Bill
[ January 29, 2002: Message edited by: William Brogden ]
 
Shuaib Gill
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have installed Tomcat 4.0, however I have to shutdown and restart Tomcat everytime I make a change to a servlet and recompile it. Why? I changed the xml file, server.xml but still I have to restart the servlet engine everytime I make a change to the servlet.
How can I fix this?
[ February 09, 2002: Message edited by: Shuaib Gill ]
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm closing this and moving it to the Apache / Tomcat forum. It has changed into a Tomcat configuration question.

As the first question I'd have... what change to server.xml? No change should be required for Tomcat to dynamically reload servlets. By default, Tomcat checks the servlet to see if it has changed, and reloads it.
 
Shuaib Gill
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Report post to moderator
I added this line:
<DefaultContext reloadable="true"/>
below this block of code:
<!-- Define properties for each web application. This is only needed
if you want to set non-default properties, or have web application
document roots in places other than the virtual host's appBase
directory. -->
and inserted the following line just below it:
<DefaultContext reloadable="true"/>
This should let the servlet engine recompile new versions of the servlet.
[ February 11, 2002: Message edited by: Shuaib Gill ]
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
I had to do a bit of reading to find that element. I've never needed to set this.

Did you only add this line after you discovered Tomcat wasn't reloading changed classes? If not, remove the line you added and see if the reloading starts to work.

have you tried making an explicit <context> element and setting it's reloadable=true, for each webapp you have? ie: don't rely on Tomcat's infrastructure to use a 'default'. If you try this, I'd remove the DefaultContext.

The other thing to try is using the manager application to 'kick' a webapp when you are done making modifications. This is a simple URL, so it can be bookmarked. A single click and your app is restarted, without you needing to shut down and restart Tomcat.
 
Shuaib Gill
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Report post to moderator
I took that line out of server.xml, still no luck. Why would this happen anyways? I followed the instructions on this site to install and configure Tomcat on my machine.
http://www.moreservlets.com/Using-Tomcat-4.html
Hope you can help...
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
I don't know why it's happening. I've never needed to include that DefaultContext myself, so not sure why yours isn't working with *or* without it.

Have you made sure your browser isn't caching the page? That is sometimes the culprit. If it's IE, you can tell IE to cache a page and then *never* check for changes again. Ridiculous, but the setting is there.

So check that out, and then that's my last thought. Sorry.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!