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.

Reply via email to