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

Auto reloading of any edited class/servlet

Ashish Kataria
Greenhorn

Joined: Aug 06, 2011
Posts: 14

Hi guys,

I am developing an Java Web Application. We all know we have to do several changes in the class/servlet at times.
Everytime i make any change to my Class/Servlet, i have to restart my Tomcat server.
So, is there any way i can reload the class automatically on every SAVED change?


PS:In Netbeans IDE, i would never face such problem, but I don't use that anymore.

Thanks..


Everything's tough until you try your best
-Ashish Kataria,
Software Engineer
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
there is a reload option in the container. you can reload the container or tomcat by using it.

you can open it with writing url of http://localhost:8080/ and than on "Manager App"

you will be asked for the usename and password give it and you can see you application name deployed on the server and on the right side you will see reload button don't ever press undeploy button...
Ashish Kataria
Greenhorn

Joined: Aug 06, 2011
Posts: 14

Dear prashant chindhade,

thank you for your kind advice..
I tried the the Tomcat Manager, it asked me for my username and password.
As mentioned in the tomcat-users.xml, I tried both the users, but it showed this error

HTTP Status 403 - Access to the requested resource has been denied

--------------------------------------------------------------------------------

type Status report

message Access to the requested resource has been denied

description Access to the specified resource (Access to the requested resource has been denied) has been forbidden.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.33




Please help me out..
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
check that this code is in your tomcat-useer.xml file

-->
- <tomcat-users>
- <!-- NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.

-->
- <!-- NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.

-->
- <!-- <role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>

-->
<user name="admin" password="admin" roles="admin-gui,manager-gui,manager-script,admin" />
</tomcat-users>

if not than re install tomcat and properly give usename and password..

regs

Prashant
Stoian Azarov
Ranch Hand

Joined: Jun 01, 2011
Posts: 113
Thnaks prashant,

I have always wondered how to enter the administration section, but hadn't time to check further. Who will expect that everything is explained in great details in the right place next to the role definitions in a comment
I added the admin user with manager-gui role and now I can access the manager section. Thanks again!
Ashish Kataria
Greenhorn

Joined: Aug 06, 2011
Posts: 14

Dear prashant chindhade,

Thank you again for your feedback..
My code was already un-commented but this part was missing..

<user name="admin" password="admin" roles="admin-gui,manager-gui,manager-script,admin" />

You have saved me a ton of work..thank you again!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Auto reloading of any edited class/servlet