Thanks for posting the solution - we need to make the error message more explicit

cheers,

Rob

'Go Get Integrated - ride the Camel! - http://activemq.apache.org/ camel/'
http://rajdavies.blogspot.com/



On Jul 31, 2007, at 3:59 PM, j0llyr0g3r wrote:


Hi,

after hours of searching i found the error:

DO NOT USE UNDERSCORES IN YOUR BROKERNAMES.

This really took me hours until i stumbled occasionally over it in the
documentation.

This is quite logical, IF you are aware of the fact, that brokernames get
translated to URLs.

Well, i was aware of that, but i didn't think of it.

The error message was not really helping. In fact, the error message was quite the opposite because it kept me on searching why the hack i would get
journal errors although i had disabled all journalling.

Anyway, here is the working config if somebody is interested. Hopefully
another beginner like me will find it usefull:

<!--
    Broker-architecture:

          Consumer              Consumer
             |                      |
     firstReceiverBroker      secondReceiverBroker
                       \       /
                        \     /
                         \  /
                      middleBroker
                           ^
                           |
                        Producer

    CLI-Calls for testing:

ant consumer -Durl=tcp://localhost:61626 -Dsubject=FOO - Dtopic=true
        ant consumer -Durl=tcp://localhost:61636 -Dsubject=FOO -Dtopic=true
        
        ant producer -Durl=tcp://localhost:61616 -Dsubject=FOO -Dtopic=true
        
-->

<beans>

  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderCon figurer"/>

  <broker brokerName="firstReceiverBroker" useJmx="true"
xmlns="http://activemq.org/config/1.0";>

    <managementContext>
       <managementContext connectorPort="4444"
jmxDomainName="org.apache.activemq"/>
    </managementContext>

    <destinationPolicy>
      <policyMap><policyEntries>

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

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

    <transportConnectors>

       <transportConnector  uri="tcp://localhost:61636"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector  uri="static://(tcp://localhost:61616)"
failover="true" networkTTL="99"/>
    </networkConnectors>

  </broker>

  <broker brokerName="secondReceiverBroker" useJmx="true"
xmlns="http://activemq.org/config/1.0";>

    <managementContext>
       <managementContext connectorPort="6666"
jmxDomainName="org.apache.activemq"/>
    </managementContext>

    <destinationPolicy>
      <policyMap><policyEntries>

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

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


    <transportConnectors>

       <transportConnector  uri="tcp://localhost:61626"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector  uri="static://(tcp://localhost:61616)"
failover="true" networkTTL="99"/>
    </networkConnectors>

  </broker>
 <broker brokerName="middleBroker" useJmx="true"
xmlns="http://activemq.org/config/1.0";>

    <managementContext>
       <managementContext connectorPort="6666"
jmxDomainName="org.apache.activemq"/>
    </managementContext>

    <destinationPolicy>
      <policyMap><policyEntries>

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

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


    <transportConnectors>

       <transportConnector  uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector
uri="static://(tcp://localhost:61626,tcp://localhost:61636)" failover="true"
networkTTL="99"/>
    </networkConnectors>

  </broker>

</beans>



ttmdev wrote:

I ran across a similar set of problems when setting up a 3-broker NoB on my Windows XP machine and addressed it by simply assigning each broker it's own separate ${activemq.base}. If you don't do that, you end up with a shared file system Master/Slave configuration. Here's my configuration:

<broker brokerName="localhost" useJmx="true"
xmlns="http://activemq.org/config/1.0";>


<!-- Use the following to configure how ActiveMQ is exposed in JMX -->
    <managementContext>
       <managementContext connectorPort="1099"
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.base}/activemq-data"/>
    </persistenceAdapter>

    <transportConnectors>
<transportConnector name="openwire" uri="tcp://localhost: 61616"
discoveryUri="multicast://default"/>
<transportConnector name="ssl" uri="ssl://localhost: 61617"/> <transportConnector name="stomp" uri="stomp://localhost: 61613"/>
    </transportConnectors>

    <networkConnectors>
      <!-- This broker is going to just listen for other brokers -->
      <!--
<networkConnector name="default-nc" uri="multicast:// default"/>
      -->
    </networkConnectors>

    <plugins>

    <!--  use JAAS to authenticate using the login.config file on the
classpath to configure JAAS -->
<!-- <jaasAuthenticationPlugin configuration="activemq- domain" /> -->
    </plugins>

  </broker>


  <broker brokerName="localhost2" useJmx="true"
xmlns="http://activemq.org/config/1.0";>

<!-- 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="/tmp/amq-base2/activemq-data"/>
    </persistenceAdapter>

    <transportConnectors>
<transportConnector name="openwire2" uri="tcp://localhost: 61618"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector name="localhost2"
uri="static://(tcp://localhost:61616)" />
    </networkConnectors>

    <plugins>
    <!--  use JAAS to authenticate using the login.config file on the
classpath to configure JAAS -->
<!-- <jaasAuthenticationPlugin configuration="activemq- domain" /> -->
    </plugins>

  </broker>


  <broker brokerName="localhost3" useJmx="true"
xmlns="http://activemq.org/config/1.0";>


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

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

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

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

    <persistenceAdapter>
        <journaledJDBC journalLogFiles="5"
dataDirectory="/tmp/amq-base3/activemq-data"/>
    </persistenceAdapter>

    <transportConnectors>
<transportConnector name="openwire3" uri="tcp://localhost: 61619"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector name="localhost3"
uri="static://(tcp://localhost:61616)" />
    </networkConnectors>

    <plugins>
    <!--  use JAAS to authenticate using the login.config file on the
classpath to configure JAAS -->
<!-- <jaasAuthenticationPlugin configuration="activemq- domain" /> -->
    </plugins>

  </broker>

Hope this helps,
Joe


j0llyr0g3r wrote:

Hey folks,

i am really getting desperate with the configuration of a simple network
of brokers...

What i wanted to do was:

- One instance of activeMQ
- 3 brokers running within that instance
- 1 Producer and 2 Consumers

In Ascii:

               Consumer    Consumer
                     |              |
                broker_A    broker_C
                         \        /
                           \    /
                             \/
                         broker_B
                              ^
                              |
                         Producer

So i thought the following broker-config.xml would do the trick:

Broker_B listens on Port 61616 and knows the brokers "A" and "C" which
should be listening on 61617 and 61618:

Broker_B:

  <broker brokerName="broker_B" useJmx="true"
xmlns="http://activemq.org/config/1.0";>

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

    <persistenceAdapter>
            <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data/broker_B/"/>
    </persistenceAdapter>

    <destinationPolicy>
      <policyMap><policyEntries>

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

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


    <transportConnectors>
       <transportConnector  uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector
uri="static://(tcp://localhost:61617,tcp://localhost:61618)"
networkTTL="99" />
    </networkConnectors>

  </broker>


Broker_A:

 <broker brokerName="broker_A" useJmx="true"
xmlns="http://activemq.org/config/1.0";>

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

    <persistenceAdapter>
            <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data/broker_A/"/>
    </persistenceAdapter>

    <!-- In ActiveMQ 4, you can setup destination policies -->
    <destinationPolicy>
      <policyMap><policyEntries>
          <policyEntry topic="FOO">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>
      </policyEntries></policyMap>
    </destinationPolicy>

    <transportConnectors>
       <transportConnector  uri="tcp://localhost:61617"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector  uri="static://(tcp://localhost:61616)"
networkTTL="99"/>
    </networkConnectors>

  </broker>


Broker_C:

 <broker brokerName="broker_C" useJmx="true"
xmlns="http://activemq.org/config/1.0";>

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

    <persistenceAdapter>
            <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data/broker_C/"/>
    </persistenceAdapter>

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

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

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


    <transportConnectors>

       <transportConnector  uri="tcp://localhost:61618"
discoveryUri="multicast://default"/>
    </transportConnectors>

    <networkConnectors>
      <networkConnector  uri="static://(tcp://localhost:61616)"
networkTTL="99"/>
    </networkConnectors>

  </broker>

Unfortunately, if i try to start to start active-mq via:

./activemq

i get the following output:

ACTIVEMQ_HOME: /opt/apache-activemq-4.1.1
ACTIVEMQ_BASE: /opt/apache-activemq-4.1.1
Loading message broker from: xbean:activemq.xml
INFO BrokerService - ActiveMQ 4.1.1 JMS Message Broker
(broker_A) is starting
INFO  BrokerService                  - For help or more information
please see: http://incubator.apache.org/activemq/
INFO  ManagementContext              - JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:4444/jmxrmi
INFO  JDBCPersistenceAdapter         - Database driver recognized:
[apache_derby_embedded_jdbc_driver]
INFO  DefaultDatabaseLocker          - Attempting to acquire the
exclusive lock to become the Master broker
INFO DefaultDatabaseLocker - Becoming the master on dataSource:
[EMAIL PROTECTED]
INFO JournalPersistenceAdapter - Journal Recovery Started from:
Active Journal: using 5 x 20.0 Megs at:
/opt/apache-activemq-4.1.1/activemq-data/broker_A/journal
INFO JournalPersistenceAdapter - Journal Recovered: 0 message(s) in
transactions recovered.
INFO  TransportServerThreadSupport   - Listening for connections at:
tcp://debln099:61617
INFO TransportConnector - Connector tcp://localhost: 61617
Started
INFO NetworkConnector - Establishing network connection
between from vm:?network=true to tcp://localhost:61616
INFO BrokerService - ActiveMQ 4.1.1 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  ManagementContext              - JMX consoles can connect to
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi
INFO  DefaultDatabaseLocker          - Attempting to acquire the
exclusive lock to become the Master broker
INFO DefaultDatabaseLocker - Becoming the master on dataSource:
[EMAIL PROTECTED]
INFO JournalPersistenceAdapter - Journal Recovery Started from:
Active Journal: using 2 x 20.0 Megs at:
/opt/apache-activemq-4.1.1/bin/activemq-data/null/journal
INFO JournalPersistenceAdapter - Journal Recovered: 0 message(s) in
transactions recovered.
INFO BrokerService - ActiveMQ JMS Message Broker (null,
ID:debln099-46244-1185883671408-1:1) started
INFO  TransportConnector             - Connector vm://null Started
WARN NetworkConnector - Could not start network bridge
between: vm:?network=true and: tcp://localhost:61616 due to:
java.net.ConnectException: Connection refused
INFO NetworkConnector - Network Connector bridge Started
INFO  BrokerService                  - ActiveMQ JMS Message Broker
(broker_A, ID:debln099-46244-1185883671408-1:0) started
INFO NetworkConnector - Establishing network connection
between from vm:?network=true to tcp://localhost:61616
INFO  TransportConnector             - Connector vm://null Stopped
INFO BrokerService - ActiveMQ 4.1.1 JMS Message Broker
(null) is starting
INFO  BrokerService                  - For help or more information
please see: http://incubator.apache.org/activemq/
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
WARN ManagementContext - Failed to start jmx connector:
Cannot bind to URL [rmi://localhost:1099/jmxrmi]:
javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is
java.rmi.AlreadyBoundException: jmxrmi]
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.
INFO faultPersistenceAdapterFactory - Journal is locked... waiting 10
seconds for the journal to be unlocked.


As you can see, only broker_A is starting.

Furthermore, every broker has a separate journal directory which is empty
before starting AMQ:


    <persistenceAdapter>
            <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.base}/activemq-data/broker_C/"/>
    </persistenceAdapter>

What the hack is wrong? To me the configuration seems to be right, can
somebody release me from my misery?
Why do the journal lock error?

Thx in advance.....




--
View this message in context: http://www.nabble.com/Simple-network- of-brokers-%2B-faultPersistenceAdapterFactory---Journal-is-locked- tf4192402s2354.html#a11925818
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Reply via email to