Unfortunately there  are a lot of developers who'd like to dictate the
load order of servlets.  The best answer I or any one else can offer is
don't do it.  It's not safe programming and all the servlets that depend
on it will sooner or later need to deal with the chance it isn't
available for some reason.

Can you offer some details of your use case?  Maybe there's an
alternative design you haven't considered.

--David

suchitha koneru wrote:
> Hello Tomcat Users ,
>                     I am facing a problem starting  a servlet from
> tomcat's
> web.xml . I am using Tomcat 5.5.20. The reason , I am placing this
> servlet
> in tomcat's web.xml instead of a web app is because I want , this
> servlet to
> start before  tomcat loads any of the web application contexts. I have
> java
> 1.5  on my system
> The following is the code for the servlet.
>
> *
>
> public* *class* ActiveMQBrokerServlet *extends* GenericServlet{
>
> BrokerService broker ;
>
> *public* *void* init(ServletConfig config)* **throws*
> ServletException* *{
>
> *try*{
>
> broker = *new* BrokerService();
>
> System.*out*.println("Starting ActiveMQ Broker Service...");
>
> broker.addConnector(
> "tcp://localhost:61616?trace=true&wireFormat.maxInactivityDuration=-1");
>
> broker.start();
>
> System.*out*.println("Active MQ Broker Started at local host port
> 61616");
>
> }*catch*(Exception e){
>
> e.printStackTrace();
>
> }
>
> }
>
> *public* *void* destroy(){
>
> *try*{
>
> broker.stop();
>
> System.*out*.println("Active MQ Broker Stopped at localhost port 61616");
>
> }*catch*(Exception e){
>
> *throw* *new* RuntimeException(e);
>
> }
>
> }
>
> *public* *void* service(ServletRequest req , ServletResponse resp){
>
> }
>
> }
>
> This servet is specified as follows in tomcat's conf/web.xml
>
> <servlet>
>        <servlet-name>activemqbroker</servlet-name>
>
>        <servlet-class>
>          com.cisco.cpnm.common.messaging.ActiveMQBrokerServlet
>        </servlet-class>
>
>        <load-on-startup>6</load-on-startup>
> </servlet>
>
> For some reason , the servlet is not loaded , and I do not see any error
> messages.
>
> The servlet class file and the required jars are placed in
> Tomcat/common/lib.
>
> Please let me know, if Iam missing anything.
>
> thanks,
>
> Suchitha.
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to