That is very odd, if the lock acquire fails, the network adapters are not started, so you should not be able to connect to the broker with a jms client to send messages.
On 4 July 2011 16:31, farhad <m...@farhad.eu> wrote: > Hi, > Sorry for the previous email. Here it is in a readable format: > We've been running activemq embedded brokers (5.4.2) with jboss 6.0 for a > while now without any problems. We've been using four brokers in a > master/slave configuration mixed with broker networks topoloy. > Now we are going to run activemq 5.5.0 as sandalone broker. In the meantime > we have an odd problem which apparantly should have been resolved in > previous versions, but still show up in v. 5.5.0. Here is a short > description of the problem when running with a single broker: > - When booting the server machine, the activemq broker comes up and acquire > the lock to the database, becomes the master and voila. > - When you stop the broker, and restart it, then the broker is unable to > acquire the lock and stays as slave. There is no error when stopping the > broker: > ----------------------------------------------- > # /etc/init.d/activemq stop > Shutting down ActiveMQ: INFO: Loading '/etc/default/activemq' > INFO: Using java '/usr/local/java/bin/java' > INFO: Waiting at least 30 seconds for regular process termination of pid > '3195' : > Java Runtime: Sun Microsystems Inc. 1.6.0_16 /usr/local/jdk1.6.0_16/jre > Heap sizes: current=251264k free=249951k max=251264k > JVM args: -Xms256M -Xmx256M > -Dorg.apache.activemq.UseDedicatedTaskRunner=true > -Djava.util.logging.config.file=logging.properties > -Dactivemq.classpath=/usr/local/activemq/conf; > -Dactivemq.home=/usr/local/activemq -Dactivemq.base=/usr/local/activemq > ACTIVEMQ_HOME: /usr/local/activemq > ACTIVEMQ_BASE: /usr/local/activemq > Connecting to pid: 3195 > Stopping broker: satellite1 > . FINISHED > [ OK ] > ----------------------------------------------- > Although jconsole tell that the broker is "slave", I am able to send > messages to it and they get stored in the database!! > > Here is the setup: > Server: Linux qa1.dibs.dk 2.6.32-131.4.1.el6.x86_64 #1 SMP Fri Jun 10 > 10:54:26 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux > Database: mysql Ver 14.14 Distrib 5.1.52, for redhat-linux-gnu (x86_64) > using readline 5.1 > Mysql driver: mysql-connector-java-5.1.13.jar > Activemq: 5.5.0 > Java: 1.6.0_16 > > activemq.xml: > <beans > xmlns="http://www.springframework.org/schema/beans" > xmlns:amq="http://activemq.apache.org/schema/core" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd > http://activemq.apache.org/schema/core > http://activemq.apache.org/schema/core/activemq-core.xsd"> > > <bean > class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> > <property name="locations"> > <value>file:${activemq.base}/conf/credentials.properties</value> > </property> > </bean> > > <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" > useShutdownHook="false" advisorySupport="true" brokerName="satellite1" > dataDirectory="${activemq.base}/data"> > > <destinationPolicy> > <policyMap> > <policyEntries> > <policyEntry queue=">"> > <deadLetterStrategy> > <sharedDeadLetterStrategy processExpired="false" > processNonPersistent="false" /> > </deadLetterStrategy> > <dispatchPolicy> > <roundRobinDispatchPolicy /> > </dispatchPolicy> > </policyEntry> > </policyEntries> > </policyMap> > </destinationPolicy> > > <managementContext> > <managementContext connectorPort="11099" rmiServerPort="11098" /> > </managementContext> > > > > <persistenceAdapter> > <jdbcPersistenceAdapter > dataDirectory="${activemq.base}/activemq-data" dataSource="#mysql-ds"/> > </persistenceAdapter> > > <transportConnectors> > <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> > </transportConnectors> > > </broker> > > <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" > destroy-method="close"> > <property name="driverClassName" value="com.mysql.jdbc.Driver"/> > <property name="url" > value="jdbc:mysql://0.0.0.0:3306/activemq?characterEncoding=utf-8&autoReconnect=true"/> > <property name="username" value="xxx"/> > <property name="password" value="xxx"/> > <property name="poolPreparedStatements" value="true"/> > </bean> > > </beans> > =============================================== > Log messages when activemq is restarted: > ----------------------------------------------------- > 2011-07-04 16:02:44,655 | INFO | Refreshing > org.apache.activemq.xbean.XBeanBrokerFactory$1@6f25844f: startup date [Mon > Jul 04 16:02:44 CEST 2011]; root of context hierarchy | > org.apache.activemq.xbean.XBeanBrokerFactory$1 | main > 2011-07-04 16:02:45,395 | INFO | > PListStore:/usr/local/activemq/data/satellite1/tmp_storage started | > org.apache.activemq.store.kahadb.plist.PListStore | main > 2011-07-04 16:02:45,478 | INFO | JMX consoles can connect to > service:jmx:rmi://localhost:11098/jndi/rmi://localhost:11099/jmxrmi | > org.apache.activemq.broker.jmx.ManagementContext | JMX connector > 2011-07-04 16:02:45,481 | INFO | Using Persistence Adapter: > JDBCPersistenceAdapter(org.apache.commons.dbcp.BasicDataSource@6d46b6db) | > org.apache.activemq.broker.BrokerService | main > 2011-07-04 16:02:45,746 | INFO | Database adapter driver override > recognized for : [mysql-ab_jdbc_driver] - adapter: class > org.apache.activemq.store.jdbc.adapter.MySqlJDBCAdapter | > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main > 2011-07-04 16:03:36,840 | INFO | Database lock driver override not found > for : [mysql-ab_jdbc_driver]. Will use default implementation. | > org.apache.activemq.store.jdbc.JDBCPersistenceAdapter | main > 2011-07-04 16:03:36,842 | INFO | Attempting to acquire the exclusive lock > to become the Master broker | > org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main > 2011-07-04 16:04:27,862 | INFO | Failed to acquire lock. Sleeping for 1000 > milli(s) before trying again... | > org.apache.activemq.store.jdbc.DefaultDatabaseLocker | main > ..... > ----------------------------------------------------- > > I'd appreciate any help, > -Farhad > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Fail-to-acquire-lock-Stays-as-slave-tp3643888p3643900.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > -- http://fusesource.com http://blog.garytully.com