activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ron55test <rkn...@gmail.com>
Subject Re: Stopping ActiveMQ programmatically
Date Tue, 19 Dec 2006 21:12:29 GMT

I got a stacktrace on this and seems to be that log4j that is creating this
problem. 

This is what happens when I stop tomcat:
--I stop tomcat with the service shutdown command
--my program stops activemq broker programmatically as oulined below
--after a while, I get a nullpointerexception from log4j class as shown
below.

Exception in thread "ActiveMQ Transport: tcp://localhost/127.0.0.1:61617"
java.lang.NullPointerException
        at org.apache.log4j.LogManager.getLogger(LogManager.java:188)
        at org.apache.log4j.Logger.getLogger(Logger.java:104)
        at
org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:229)
        at
org.apache.commons.logging.impl.Log4JLogger.isDebugEnabled(Log4JLogger.java:239)
        at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:85)
        at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:65)
        at
org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:133)
        at
org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:122)
        at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
        at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)
        at java.lang.Thread.run()V(Unknown Source)

--tomcat process hangs. I've to manually kill the tomcat process

There is an issue similar to this reported on apache issues repository:
http://issues.apache.org/bugzilla/show_bug.cgi?id=40212

What is the best way to resolve this issue?  

1) Should I get the activemq code and comment out the call to
Log4jLogger.isDebugEnabled from
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:85)

2) Anyother way I can disable logging so I won't get this
nullpointerexception?

Any suggestions will be highly appreciated. 


ron55test wrote:
> 
> Hi,
> 
> I've been trying to start and stop ActiveMQ service programmatically...I
> wrote some code to start and stop activemq. It works fine on my windows
> machine. However, if I run the same program on a linux machine...it works
> fine starting but does not stop the activemq service. As a result, the
> tomcat process does not stop.
> 
> Here are the details:
> --We are building a web application and want to start ActiveMQ service
> when the app is deployed and tomcat is started.  We want to stop the
> activemq service when we stop tomcat.  So, my start/stop code is deployed
> with the war file and want to run the activemq service within the tomcat
> jvm. On our linux machine, we are using JRockit as the JVM.
> --Here are my start and stop methods:
> 
>     public void start()
>     {
>         BrokerService brokerService = new BrokerService();
>         try
>         {
>             File file = new File(_activemqDataDir);
>             brokerService.setDataDirectory(file);
>             brokerService.setBrokerName(_brokerName);
>             brokerService.addConnector(_brokerURL);
>             brokerService.start();
>         }
>         catch (Exception e)
>         {
>             e.printStackTrace(System.out);
>         }
>     }
> 
>     public void stop()
>     {
>         BrokerService brokerService =
> BrokerRegistry.getInstance().lookup(_brokerName);
>         try
>         {
>             if (brokerService != null)
>             {
>                 brokerService.stop();
>             }
>             else
>             {
>                 _log.info("Could not stop ActiveMQ broker.  It was never
> started");
>             }
>         }
>         catch (Exception e)
>         {
>             e.printStackTrace(System.out);
>         }
>     }
> 
> --Any help will be highly appreciated. If I cannot stop the activemq
> service programmatically, is there any other way I can stop it on our
> linux machine.  The only way we have been killing the activemq service is
> by manually killing the tomcat process.
> 
> Thanks
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Stopping-ActiveMQ-programmatically-tf2791601.html#a7954950
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message