You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by robottaway <ro...@musiciansfriend.com> on 2006/11/08 22:39:34 UTC

networkConnectors causing NPE

I get a null pointer exception from the parsing of the XBean file
(activemq.xml) when I try to configure a 'networkConnector' element under
'networkConnectors'. I am using 4.0.2.

ACTIVEMQ_HOME:
/opt/MFApps/ServiceMix/activemq_installs/incubator-activemq-4.0.2
Loading message broker from: xbean:activemq.xml
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.activemq.xbean.XBeanBrokerService' defined in class
path resource [activemq.xml]: Error setting property values; nested
exception is org.springframework.beans.PropertyAccessExceptionsException:
PropertyAccessExceptionsException (1 errors); nested
propertyAccessExceptions are:
[org.springframework.beans.MethodInvocationException: Property
'networkConnectors' threw exception; nested exception is
java.lang.NullPointerException: null]
ERROR: java.lang.Exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'org.apache.activemq.xbean.XBeanBrokerService' defined in class
path resource [activemq.xml]: Error setting property values; nested
exception is org.springframework.beans.PropertyAccessExceptionsException:
PropertyAccessExceptionsException (1 errors); nested
propertyAccessExceptions are:
[org.springframework.beans.MethodInvocationException: Property
'networkConnectors' threw exception; nested exception is
java.lang.NullPointerException: null]
-- 
View this message in context: http://www.nabble.com/networkConnectors-causing-NPE-tf2598042.html#a7247527
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: networkConnectors causing NPE

Posted by robottaway <ro...@musiciansfriend.com>.
I was using the version of 4.0.2 under the 'Binary for Unix' section of this
page:

http://www.activemq.org/site/activemq-402-release.html

I checked out the RC6 version from the link at the top of this page and now
I then had a problem with a second broker being created. I changed the
'brokerName' element to not contain period characters. Then things worked
perfect. I am now bridging to a Servicemix 3.0 instance running on the same
machine!

I think I may have been using a early 4.0.2 release? Obviously not a
'stable' release. The RC6 release is working fine :)

the .NET NMS api also worked with this release candidate.

Thank you for the help.
-- 
View this message in context: http://www.nabble.com/networkConnectors-causing-NPE-tf2598042.html#a7266120
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: networkConnectors causing NPE

Posted by Bruce Snyder <br...@gmail.com>.
On 11/8/06, robottaway <ro...@musiciansfriend.com> wrote:
>
> Thanks taking the spaces out of the <brokerName/> element did fix that
> problem. Now I am having a problem with an extra broker starting up, LOL!
> All I do to get this behavior is enable the 'networkConnector' element.
> Using the exact same config I posted earlier.

After removing the spaces from the broker name, I did not see this
behavior at all using the configuration you provided when testing
against ActiveMQ 4.0.2. What version of ActiveMQ are you using?

Out of curiosity I begain testing against the ActiveMQ trunk and I'm
still not seeing this behavior. To test against the trunk, I've made a
few minor changes as shown below:

<beans>

    <!-- Allows us to use system properties as variables in this
configuration file -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

    <!-- <broker useJmx="true"> -->
    <!-- <broker brokerName="localhost" useJmx="true"
xmlns="http://activemq.org/config/1.0"> -->
    <broker brokerName="Robs_AMQ_broker" useJmx="true"
xmlns="http://activemq.org/config/1.0">
     <!-- <brokerName>Robs_AMQ_broker</brokerName> -->
        <!--  Use the following to set the broker memory limit (in bytes)
            <memoryManager>
            <usageManager id="memory-manager" limit="1048576"/>
            </memoryManager>
        -->

        <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
        <managementContext>
            <managementContext connectorPort="1098"
jmxDomainName="org.apache.activemq"/>
        </managementContext>

        <!-- In ActiveMQ 4, you can setup destination policies -->
        <destinationPolicy>
            <policyMap><policyEntries>

                <policyEntry topic="FOO.>">
                    <dispatchPolicy>
                        <strictOrderDispatchPolicy/>
                    </dispatchPolicy>
                    <subscriptionRecoveryPolicy>
                        <lastImageSubscriptionRecoveryPolicy/>
                    </subscriptionRecoveryPolicy>
                </policyEntry>

            </policyEntries></policyMap>
        </destinationPolicy>

        <persistenceAdapter>
            <!--  <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.home}/activemq-data"/> -->
            <!-- To use a different datasource, use th following syntax : -->
            <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data"
dataSource="#derby-ds"/>
        </persistenceAdapter>

        <transportConnectors>
            <transportConnector name="tcp" uri="tcp://localhost:61605"
discoveryUri="multicast://default"/>
            <transportConnector name="stomp" uri="stomp://localhost:61606"/>
        </transportConnectors>

        <networkConnectors>
          <!-- by default just auto discover the other brokers -->
          <networkConnector name="default" uri="multicast://default"/>
          <!--
          <networkConnector name="host1 and host2"
uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
          -->
        </networkConnectors>

    </broker>

  <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
    <property name="databaseName" value="derbydb"/>
    <property name="createDatabase" value="create"/>
  </bean>

</beans>

Give this configuration a whirl and let's see what kind of results you get.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://incubator.apache.org/activemq/
Apache ServiceMix - http://incubator.apache.org/servicemix/
Castor - http://castor.org/

Re: networkConnectors causing NPE

Posted by robottaway <ro...@musiciansfriend.com>.
Thanks taking the spaces out of the <brokerName/> element did fix that
problem. Now I am having a problem with an extra broker starting up, LOL!
All I do to get this behavior is enable the 'networkConnector' element.
Using the exact same config I posted earlier.

ACTIVEMQ_HOME:
/opt/MFApps/ServiceMix/activemq_installs/incubator-activemq-4.0.2
Loading message broker from: xbean:activemq.xml
INFO  BrokerService                  - ActiveMQ 4.0.2 JMS Message Broker
(BSDdev4.0.2AMQbroker) is starting
INFO  BrokerService                  - For help or more information please
see: http://incubator.apache.org/activemq/
INFO  JDBCPersistenceAdapter         - Database driver recognized:
[apache_derby_embedded_jdbc_driver]
INFO  JournalPersistenceAdapter      - Journal Recovery Started from: Active
Journal: using 5 x 20.0 Megs at:
/opt/MFApps/ServiceMix/activemq_installs/activemq-data/journal
INFO  JournalPersistenceAdapter      - Journal Recovered: 0 message(s) in
transactions recovered.
INFO  TransportServerThreadSupport   - Listening for connections at:
tcp://bsddev.musiciansfriend.com:61605
WARN  MulticastDiscoveryAgent        - brokerName not set
INFO  TransportConnector             - Connector default Started
INFO  TransportServerThreadSupport   - Listening for connections at:
stomp://bsddev.musiciansfriend.com:61606
INFO  TransportConnector             - Connector stomp Started
INFO  NetworkConnector               - Network Connector multicastordeaux
Started
INFO  BrokerService                  - ActiveMQ JMS Message Broker
(BSDdev4.0.2AMQbroker,
ID:bsddev.musiciansfriend.com-58540-1163031439033-1:0) started
INFO  NetworkConnector               - Establishing network connection
between from vm:?network=true to tcp://robert-ottaways-computer.local:61616
INFO  BrokerService                  - ActiveMQ 4.0.2 JMS Message Broker
(null) is starting
INFO  BrokerService                  - For help or more information please
see: http://incubator.apache.org/activemq/
INFO  JDBCPersistenceAdapter         - Database driver recognized:
[apache_derby_embedded_jdbc_driver]
INFO  JournalPersistenceAdapter      - Journal Recovery Started from: Active
Journal: using 2 x 20.0 Megs at:
/opt/MFApps/ServiceMix/activemq_installs/incubator-activemq-4.0.2/activemq-data/null/journal
INFO  JournalPersistenceAdapter      - Journal Recovered: 0 message(s) in
transactions recovered.
INFO  BrokerService                  - ActiveMQ JMS Message Broker (null,
ID:bsddev.musiciansfriend.com-58540-1163031439033-1:1) started
INFO  TransportConnector             - Connector vm://null Started
WARN  NetworkConnector               - Could not start network bridge
between: vm:?network=true and: tcp://robert-ottaways-computer.local:61616
due to: java.net.UnknownHostException: robert-ottaways-computer.local
INFO  NetworkConnector               - Establishing network connection
between from vm:?network=true to tcp://robert-ottaways-computer.local:61616
INFO  TransportConnector             - Connector vm://null Stopped
INFO  BrokerService                  - ActiveMQ 4.0.2 JMS Message Broker
(null) is starting
INFO  BrokerService                  - For help or more information please
see: http://incubator.apache.org/activemq/
ERROR BrokerService                  - Failed to start ActiveMQ JMS Message
Broker. Reason: org.apache.activeio.journal.active.JournalLockedException:
Journal is already opened by this application.
org.apache.activeio.journal.active.JournalLockedException: Journal is
already opened by this application.
        at
org.apache.activeio.journal.active.ControlFile.lock(ControlFile.java:77)
        at
org.apache.activeio.journal.active.LogFileManager.initialize(LogFileManager.java:121)
        at
org.apache.activeio.journal.active.LogFileManager.<init>(LogFileManager.java:102)
        at
org.apache.activeio.journal.active.JournalImpl.<init>(JournalImpl.java:101)
        at
org.apache.activemq.store.DefaultPersistenceAdapterFactory.createJournal(DefaultPersistenceAdapterFactory.java:199)
        at
org.apache.activemq.store.DefaultPersistenceAdapterFactory.getJournal(DefaultPersistenceAdapterFactory.java:135)
        at
org.apache.activemq.store.DefaultPersistenceAdapterFactory.createPersistenceAdapter(DefaultPersistenceAdapterFactory.java:64)
        at
org.apache.activemq.broker.BrokerService.createPersistenceAdapter(BrokerService.java:969)
        at
org.apache.activemq.broker.BrokerService.getPersistenceAdapter(BrokerService.java:560)
        at
org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:930)
        at
org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:889)
        at
org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:459)
        at
org.apache.activemq.broker.BrokerService.start(BrokerService.java:362)
        at
org.apache.activemq.transport.vm.VMTransportFactory.doCompositeConnect(VMTransportFactory.java:106)
        at
org.apache.activemq.transport.vm.VMTransportFactory.doConnect(VMTransportFactory.java:52)
        at
org.apache.activemq.transport.TransportFactory.connect(TransportFactory.java:64)
        at
org.apache.activemq.network.NetworkConnector.createLocalTransport(NetworkConnector.java:283)
        at
org.apache.activemq.network.DiscoveryNetworkConnector.onServiceAdd(DiscoveryNetworkConnector.java:110)
        at
org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent$2.run(MulticastDiscoveryAgent.java:342)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
WARN  NetworkConnector               - Could not connect to local URI:
vm:?network=true: Journal is already opened by this application.


-- 
View this message in context: http://www.nabble.com/networkConnectors-causing-NPE-tf2598042.html#a7250150
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: networkConnectors causing NPE

Posted by Bruce Snyder <br...@gmail.com>.
On 11/8/06, robottaway <ro...@musiciansfriend.com> wrote:
>
> Sorry didn't post cuz I thought I was doing things pretty standard like, here
> is my conf:
>
> <beans xmlns="http://activemq.org/config/1.0">
>
>   <!-- Allows us to use system properties as variables in this configuration
> file -->
>   <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>
>   <broker useJmx="true">
>     <brokerName>Rob's Computer AMQ 4.0.2 broker</brokerName>
...
> Everything works dandy until I throw in the 'networkConnector' element under
> 'networkConnectors'.

Everything you're doing is OK except for the text you're using for the
broker name. It cannot have spaces in it.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://incubator.apache.org/activemq/
Apache ServiceMix - http://incubator.apache.org/servicemix/
Castor - http://castor.org/

Re: networkConnectors causing NPE

Posted by robottaway <ro...@musiciansfriend.com>.
Sorry didn't post cuz I thought I was doing things pretty standard like, here
is my conf:

<beans xmlns="http://activemq.org/config/1.0">

  <!-- Allows us to use system properties as variables in this configuration
file -->
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

  <broker useJmx="true">
    <brokerName>Rob's Computer AMQ 4.0.2 broker</brokerName>
    <!--  Use the following to set the broker memory limit (in bytes)
    <memoryManager>  
        <usageManager id="memory-manager" limit="1048576"/>
    </memoryManager>
    -->

    <!-- Use the following to configure how ActiveMQ is exposed in JMX -->
    <managementContext>
       <managementContext connectorPort="1098"
jmxDomainName="org.apache.activemq"/>
    </managementContext>

    <!-- In ActiveMQ 4, you can setup destination policies -->
    <destinationPolicy>
      <policyMap><policyEntries>

          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>

<persistenceAdapter>
      <!--  <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.home}/activemq-data"/> -->
      <!-- To use a different datasource, use th following syntax : -->
      <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
dataSource="#derby-ds"/>
    </persistenceAdapter>

    <transportConnectors>
       <transportConnector name="default" uri="tcp://localhost:61605"
discoveryUri="multicast://default"/>
       <transportConnector name="stomp"   uri="stomp://localhost:61606"/>
    </transportConnectors>

    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector name="default" uri="multicast://default"/>
      <!--
      <networkConnector name="host1 and host2"
uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
      -->
    </networkConnectors>

  </broker>

Everything works dandy until I throw in the 'networkConnector' element under
'networkConnectors'.
-- 
View this message in context: http://www.nabble.com/networkConnectors-causing-NPE-tf2598042.html#a7248306
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: networkConnectors causing NPE

Posted by Bruce Snyder <br...@gmail.com>.
On 11/8/06, robottaway <ro...@musiciansfriend.com> wrote:
>
> I get a null pointer exception from the parsing of the XBean file
> (activemq.xml) when I try to configure a 'networkConnector' element under
> 'networkConnectors'. I am using 4.0.2.
>
> ACTIVEMQ_HOME:
> /opt/MFApps/ServiceMix/activemq_installs/incubator-activemq-4.0.2
> Loading message broker from: xbean:activemq.xml
> ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.apache.activemq.xbean.XBeanBrokerService' defined in class
> path resource [activemq.xml]: Error setting property values; nested
> exception is org.springframework.beans.PropertyAccessExceptionsException:
> PropertyAccessExceptionsException (1 errors); nested
> propertyAccessExceptions are:
> [org.springframework.beans.MethodInvocationException: Property
> 'networkConnectors' threw exception; nested exception is
> java.lang.NullPointerException: null]
> ERROR: java.lang.Exception:
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.apache.activemq.xbean.XBeanBrokerService' defined in class
> path resource [activemq.xml]: Error setting property values; nested
> exception is org.springframework.beans.PropertyAccessExceptionsException:
> PropertyAccessExceptionsException (1 errors); nested
> propertyAccessExceptions are:
> [org.springframework.beans.MethodInvocationException: Property
> 'networkConnectors' threw exception; nested exception is
> java.lang.NullPointerException: null]

Without the configuration file, it's difficult to say just exactly
what the problem might be. Is the <networkConnectors> element inside
of the <broker> element? Please post the activemq.xml file that is
causing the error.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://incubator.apache.org/activemq/
Apache ServiceMix - http://incubator.apache.org/servicemix/
Castor - http://castor.org/