Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 46529 invoked from network); 2 Nov 2009 09:00:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Nov 2009 09:00:17 -0000 Received: (qmail 41648 invoked by uid 500); 2 Nov 2009 09:00:17 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 41604 invoked by uid 500); 2 Nov 2009 09:00:16 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 41594 invoked by uid 99); 2 Nov 2009 09:00:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Nov 2009 09:00:16 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_HI,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Nov 2009 09:00:13 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id ABDB3234C48D for ; Mon, 2 Nov 2009 00:59:53 -0800 (PST) Message-ID: <1220362270.1257152393698.JavaMail.jira@brutus> Date: Mon, 2 Nov 2009 00:59:53 -0800 (PST) From: "Gary Tully (JIRA)" To: dev@activemq.apache.org Subject: [jira] Assigned: (AMQ-2472) NullPointerException during startup of DiscoveryNetworkConnector when using an HTTP URL for an inactive remote broker. In-Reply-To: <1782719352.1257108052697.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c [ https://issues.apache.org/activemq/browse/AMQ-2472?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary Tully reassigned AMQ-2472: ------------------------------- Assignee: Gary Tully > NullPointerException during startup of DiscoveryNetworkConnector when using an HTTP URL for an inactive remote broker. > ---------------------------------------------------------------------------------------------------------------------- > > Key: AMQ-2472 > URL: https://issues.apache.org/activemq/browse/AMQ-2472 > Project: ActiveMQ > Issue Type: Bug > Components: Connector > Affects Versions: 5.3.0 > Environment: ActiveMQ 5.3.0 release (08/10/2009), Windows XP > Reporter: Stirling Chow > Assignee: Gary Tully > Attachments: patch.txt > > > Symptom > ======== > When starting a statically-configured network of two AMQ brokers, each of which uses HTTP as their transport, if one of the brokers is not running when the other starts up, the following NPE appears in the logs: > 2009-11-01 11:05:53,626 [AlarmPoint Node-main] INFO - - Using Persistence Adapter: MemoryPersistenceAdapter > 2009-11-01 11:05:53,626 [AlarmPoint Node-main] INFO - - ActiveMQ 5.3.0 JMS Message Broker (localhost) is starting > 2009-11-01 11:05:53,626 [AlarmPoint Node-main] INFO - - For help or more information please see: http://activemq.apache.org/ > 2009-11-01 11:05:53,829 [AlarmPoint Node-main] WARN - - 2009-11-01 11:05:53.445::INFO: Logging to STDERR via org.mortbay.log.StdErrLog > 2009-11-01 11:05:53,876 [AlarmPoint Node-main] WARN - - 2009-11-01 11:05:53.492::INFO: jetty-6.1.9 > 2009-11-01 11:05:53,922 [AlarmPoint Node-main] WARN - - 2009-11-01 11:05:53.538::INFO: Started SocketConnector@localhost:50000 > 2009-11-01 11:05:53,922 [AlarmPoint Node-main] INFO - - Connector http://localhost:50000 Started > 2009-11-01 11:05:53,922 [AlarmPoint Node-main] INFO - - Establishing network connection from vm://localhost to http://192.168.168.44:50001 > 2009-11-01 11:05:53,938 [AlarmPoint Node-main] DEBUG - - binding to broker: localhost > 2009-11-01 11:05:53,938 [AlarmPoint Node-main] INFO - - Connector vm://localhost Started > 2009-11-01 11:05:57,954 [AlarmPoint Node-main] DEBUG - - Shutting down VM connectors for broker: localhost > 2009-11-01 11:05:57,954 [ActiveMQ Transport Stopper: vm://localhost#0] DEBUG - - Stopping connection: vm://localhost#0 > 2009-11-01 11:05:57,954 [ActiveMQ Transport Stopper: vm://localhost#0] DEBUG - - Stopped transport: vm://localhost#0 > 2009-11-01 11:05:57,954 [ActiveMQ Transport Stopper: vm://localhost#0] DEBUG - - Connection Stopped: vm://localhost#0 > 2009-11-01 11:05:57,954 [AlarmPoint Node-main] INFO - - Connector vm://localhost Stopped > 2009-11-01 11:05:57,954 [AlarmPoint Node-main] ERROR - - Could not stop service: HTTP Reader http://192.168.168.44:50001. Reason: java.lang.NullPointerException > java.lang.NullPointerException > at org.apache.activemq.transport.http.HttpClientTransport.doStop(HttpClientTransport.java:202) > at org.apache.activemq.util.ServiceSupport.stop(ServiceSupport.java:69) > at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:64) > at org.apache.activemq.transport.TransportFilter.stop(TransportFilter.java:64) > at org.apache.activemq.transport.ResponseCorrelator.stop(ResponseCorrelator.java:125) > at org.apache.activemq.util.ServiceSupport.dispose(ServiceSupport.java:43) > at org.apache.activemq.network.DiscoveryNetworkConnector.onServiceAdd(DiscoveryNetworkConnector.java:134) > at org.apache.activemq.transport.discovery.simple.SimpleDiscoveryAgent.start(SimpleDiscoveryAgent.java:77) > at org.apache.activemq.network.DiscoveryNetworkConnector.handleStart(DiscoveryNetworkConnector.java:182) > at org.apache.activemq.network.NetworkConnector$1.doStart(NetworkConnector.java:56) > at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:53) > at org.apache.activemq.network.NetworkConnector.start(NetworkConnector.java:199) > at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:1933) > at org.apache.activemq.broker.BrokerService.start(BrokerService.java:471) > at com.invoqsystems.foundation.component.communication.MessageBusImpl.startJmsBroker(MessageBusImpl.java:602) > at com.invoqsystems.foundation.component.communication.MessageBusImpl.start(MessageBusImpl.java:364) > at com.invoqsystems.apex.component.communication.NodeMessageBusImpl.start(NodeMessageBusImpl.java:207) > at com.invoqsystems.apex.component.node.manager.NodeManager.startMessagingServer(NodeManager.java:975) > at com.invoqsystems.apex.component.node.manager.NodeManager.start(NodeManager.java:199) > at com.invoqsystems.apex.AlarmPointNode.startNodeManager(AlarmPointNode.vaja:162) > at com.invoqsystems.apex.AlarmPointNode.run(AlarmPointNode.java:62) > at java.lang.Thread.run(Thread.java:595) > Reproduction > =========== > Configure one broker to listen to http://localhost:50000 and the other broker to list to http://localhost:50001. Network the brokers together using the SimpleDiscoveryAgent (static) configuration: > > > > > > > > > > > > and the other broker as: > > > > > > > > > > > > Start broker1, but do not start broker2. Observe the stacktrace in broker1's logs. > Cause > ====== > During startup, the following code executes in DiscoveryNetworkConnector#onServiceAdd(DiscoveryEvent event): > NetworkBridge bridge = createBridge(localTransport, remoteTransport, event); > try { > bridge.start(); > bridges.put(uri, bridge); > } catch (Exception e) { > ServiceSupport.dispose(localTransport); > ServiceSupport.dispose(remoteTransport); > LOG.warn("Could not start network bridge between: " + localURIName + " and: " + uri + " due to: " + e); > A bridge is created to connect broker1 to broker2 (http://localhost:50000 to http://localhost:50001), but since broker2 is not started, bridge.start() will throw a "Connection refused" exception. In handling this exception, ServiceSupport.dispose(remoteTransport) is called, which eventually calls through to HttpClientTransport#doStop(ServiceStopper stopper): > protected void doStop(ServiceStopper stopper) throws Exception { > httpMethod.abort(); > } > The NPE is caused becuase httpMethod is null. > When bridge.start() is called, it will pass through to HttpClientTransport#doStart(): > LOG.trace("HTTP GET consumer thread starting: " + this); > HttpClient httpClient = getReceiveHttpClient(); > URI remoteUrl = getRemoteUrl(); > HeadMethod httpMethod = new HeadMethod(remoteUrl.toString()); > configureMethod(httpMethod); > int answer = httpClient.executeMethod(httpMethod); > The httpClient.executeMethod(httpMethod) throws the "connection refused" exception because the HEAD command cannot connect. The httpMethod in doStart() is a local var, while the object-scope httpMethod is only set once the transport starts running, which never occurs due to the HEAD failure. > Solution > ======= > Check that httpMethod is not null before disposing in HttpClientTransport: > protected void doStop(ServiceStopper stopper) throws Exception { > if(httpMethod != null) > { > httpMethod.abort(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.