You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gary Lawrence Murphy <ga...@canada.com> on 2002/02/07 07:55:42 UTC

Can a servlet exit?

can a servlet remove itself?  I have a situation where a servlet's
configuration file may require on-the-fly edits, but the site runs
dozens of servlets and we don't want to restart tomcat just to
restart one webapp.  

Long term, we plan to re-write the servlet to include a "reload"
function (the proper way to do this), but for now the easiest path
would seem to be to have the servlet purge itself from the servlet
container such that it will be completely reloaded on the next
request.  Is this possible?

-- 
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless.  They can only give you answers."(Pablo Picasso)


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Can a servlet exit?

Posted by Bo Xu <bo...@cybershop.ca>.
----- Original Message ----- 
From: "Gary Lawrence Murphy" <ga...@canada.com>
To: "Tomcat Users" <to...@jakarta.apache.org>
Sent: Thursday, February 07, 2002 1:55 AM
Subject: Can a servlet exit?


> 
> can a servlet remove itself?  I have a situation where a servlet's
> configuration file may require on-the-fly edits, but the site runs
> dozens of servlets and we don't want to restart tomcat just to
> restart one webapp.  
> 
> Long term, we plan to re-write the servlet to include a "reload"
> function (the proper way to do this), but for now the easiest path
> would seem to be to have the servlet purge itself from the servlet
> container such that it will be completely reloaded on the next
> request.  Is this possible?
>[...]


I think one of the ways is use "Manager",   good doc for you :-)

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/manager-howto.html 


Bo
Feb072002



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Can a servlet exit? (Dynamic deploy ?)

Posted by Eli Spizzichino <jd...@javanet.info>.
Hi to all,
reading this mail and other I understand the version 3.3 and previous are 
unable to dynamic reload classes or init parameter without restart the 
whole application server.
Instead the nightly build of Tomcat the 4.0-20020124 is able dynamic load 
classes and web.xml etc.
Is this correct?
I not have big experience but what automatic WAR deploy is for?
And reloadable=true in server.xml?

Probably I misunderstand something, let me know

Eli


At 08.49 07/02/2002 -0800, you wrote:


>On 7 Feb 2002, Gary Lawrence Murphy wrote:
>
> > Date: 07 Feb 2002 01:55:42 -0500
> > From: Gary Lawrence Murphy <ga...@canada.com>
> > Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
> >      Gary Lawrence Murphy <ga...@canada.com>
> > To: Tomcat Users <to...@jakarta.apache.org>
> > Subject: Can a servlet exit?
> >
> >
> > can a servlet remove itself?
>
>No.  Java provides no means to remove an existing class from a class
>loader, once it has been loaded.
>
> >  I have a situation where a servlet's
> > configuration file may require on-the-fly edits, but the site runs
> > dozens of servlets and we don't want to restart tomcat just to
> > restart one webapp.
> >
> > Long term, we plan to re-write the servlet to include a "reload"
> > function (the proper way to do this), but for now the easiest path
> > would seem to be to have the servlet purge itself from the servlet
> > container such that it will be completely reloaded on the next
> > request.  Is this possible?
> >
>
>The only choice (and the one that Tomcat implements when you reload a
>webapp) is to shut down the application, throw away its class loader, and
>load things up again.
>
>Craig
>
> > --
> > Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
> > Business Innovations Through Open Source Systems: http://www.teledyn.com
> > "Computers are useless.  They can only give you answers."(Pablo Picasso)
> >
> >
> > --
> > To unsubscribe:   <ma...@jakarta.apache.org>
> > For additional commands: <ma...@jakarta.apache.org>
> > Troubles with the list: <ma...@jakarta.apache.org>
> >
> >
>
>
>--
>To unsubscribe:   <ma...@jakarta.apache.org>
>For additional commands: <ma...@jakarta.apache.org>
>Troubles with the list: <ma...@jakarta.apache.org>



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Session Timeout

Posted by Hari S <ha...@yahoo.com>.
I hope that in your
TOMCAT_HOME/webapps/manager/web.xml file in /manager
application, You should create a Manager role.


i.e Your security constraint should look like
following

<security-constraint>
 <web-resource-collection>
  <web-resource-name> Entire Application
</web-resource-name>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
 <auth-constraint>
    <role-name>manager </role-name>
 </auth-constraint>
</security-constraint>

once you have created this role in web.xml of manager
application, you need to add the user with role as
manager as you have already done.

Restart Tomcat.

It should work now.

Thanks
Hari

--- Sunil Mathew <st...@cisco.com> wrote:
> Hi All,
> 
> How can I see the current session timeout and set a
> new value. The
> documentation gives the following url
> 
>
http://localhost:8080/manager/sessions?path=/examples
> 
> But I am not able to see /manager eventhough I have
> setup user with manager
> role as:
> 
> <user name="admin" password="admin"
> roles="standard,manager" />
> 
> Can somebody help me on this?
> 
> Thanks,
> Sunil Mathew.
> 
> 
> 
> 
> --
> To unsubscribe:  
> <ma...@jakarta.apache.org>
> For additional commands:
> <ma...@jakarta.apache.org>
> Troubles with the list:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


RE: Tomcat and JSP

Posted by James McCall <ja...@bellsouth.net>.
Hi,

When I edit a working JSP file in the Tomcat directory I get a java null
pointer error. Most times if I just rename the file it works under the new
name, but mostly it doesn't. I have tried several things with no success.
Any help would be appreciated.

-James

The error is below:

Location: /examples/jsp/test/NPPU.jsp
Internal Servlet Error:

javax.servlet.ServletException: Database not found or no system permission.
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown
Source)
	at jsp.test.NPPU_2._jspService(NPPU_2.java:158)
	at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
	at org.apache.tomcat.core.Handler.invoke(Unknown Source)
	at org.apache.tomcat.core.Handler.service(Unknown Source)
	at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
	at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
	at org.apache.tomcat.core.ContextManager.service(Unknown Source)
	at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown
Source)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:484)
Root cause:
java.sql.SQLException: Database not found or no system permission.
	at com.informix.jdbc.IfxSqliConnect.(IfxSqliConnect.java:587)
	at java.lang.reflect.Constructor.newInstance(Native Method)
	at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:194)
	at java.sql.DriverManager.getConnection(DriverManager.java:517)
	at java.sql.DriverManager.getConnection(DriverManager.java:199)
	at jsp.test.NPPU_2._jspService(NPPU_2.java:66)
	at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
	at org.apache.tomcat.core.Handler.invoke(Unknown Source)
	at org.apache.tomcat.core.Handler.service(Unknown Source)
	at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
	at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
	at org.apache.tomcat.core.ContextManager.service(Unknown Source)
	at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown
Source)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:484)


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Tomcat and JSP

Posted by James McCall <ja...@bellsouth.net>.
Hi,

When I edit a working JSP file in the Tomcat directory I get a java null
pointer error. Most times if I just rename the file it works under the new
name, but mostly it doesn't. I have tried several things with no success.
Any help would be appreciated.

-James

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Session Timeout

Posted by Sunil Mathew <st...@cisco.com>.
Hi All,

How can I see the current session timeout and set a new value. The
documentation gives the following url

http://localhost:8080/manager/sessions?path=/examples

But I am not able to see /manager eventhough I have setup user with manager
role as:

<user name="admin" password="admin" roles="standard,manager" />

Can somebody help me on this?

Thanks,
Sunil Mathew.




--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Can a servlet exit?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On 7 Feb 2002, Gary Lawrence Murphy wrote:

> Date: 07 Feb 2002 14:12:25 -0500
> From: Gary Lawrence Murphy <ga...@canada.com>
> To: Craig R. McClanahan <cr...@apache.org>
> Cc: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Re: Can a servlet exit?
>
> >>>>> "C" == Craig R McClanahan <cr...@apache.org> writes:
>
>     C> The only choice (and the one that Tomcat implements when you
>     C> reload a webapp) is to shut down the application, throw away
>     C> its class loader, and load things up again.
>
> Short of upgrading to Tomcat 4 to get the Container Manager, this
> sounds like exactly the process we'd need; where can I learn more
> about this process?
>

The best thing would be to look at the Tomcat source code.  Both 3.3 and
4.x support web application reloading, although they differ in the
implementation details.  For Tomcat 4, see the reload() method of class
org.apache.catalina.core.StandardContext.

Note that, if you are thinking about building your own class loader
*inside* your application so that you can do this, you should be aware
that servlet containers running under a security manager (which includes
all J2EE servers) are unlikely to allow you do do this.


> --
> Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
> Business Innovations Through Open Source Systems: http://www.teledyn.com
> "Computers are useless.  They can only give you answers."(Pablo Picasso)
>
>

Craig



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Can a servlet exit?

Posted by Gary Lawrence Murphy <ga...@canada.com>.
>>>>> "C" == Craig R McClanahan <cr...@apache.org> writes:

    C> The only choice (and the one that Tomcat implements when you
    C> reload a webapp) is to shut down the application, throw away
    C> its class loader, and load things up again.

Short of upgrading to Tomcat 4 to get the Container Manager, this
sounds like exactly the process we'd need; where can I learn more
about this process?

-- 
Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
Business Innovations Through Open Source Systems: http://www.teledyn.com
"Computers are useless.  They can only give you answers."(Pablo Picasso)


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Can a servlet exit?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On 7 Feb 2002, Gary Lawrence Murphy wrote:

> Date: 07 Feb 2002 01:55:42 -0500
> From: Gary Lawrence Murphy <ga...@canada.com>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>,
>      Gary Lawrence Murphy <ga...@canada.com>
> To: Tomcat Users <to...@jakarta.apache.org>
> Subject: Can a servlet exit?
>
>
> can a servlet remove itself?

No.  Java provides no means to remove an existing class from a class
loader, once it has been loaded.

>  I have a situation where a servlet's
> configuration file may require on-the-fly edits, but the site runs
> dozens of servlets and we don't want to restart tomcat just to
> restart one webapp.
>
> Long term, we plan to re-write the servlet to include a "reload"
> function (the proper way to do this), but for now the easiest path
> would seem to be to have the servlet purge itself from the servlet
> container such that it will be completely reloaded on the next
> request.  Is this possible?
>

The only choice (and the one that Tomcat implements when you reload a
webapp) is to shut down the application, throw away its class loader, and
load things up again.

Craig

> --
> Gary Lawrence Murphy <ga...@teledyn.com> TeleDynamics Communications Inc
> Business Innovations Through Open Source Systems: http://www.teledyn.com
> "Computers are useless.  They can only give you answers."(Pablo Picasso)
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>