activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-3396) ActiveMQ fails to restart when there is a zero broker sequence ID
Date Mon, 31 Oct 2011 19:39:32 GMT

    [ https://issues.apache.org/jira/browse/AMQ-3396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13140481#comment-13140481
] 

Timothy Bish commented on AMQ-3396:
-----------------------------------

We could use a test case, or some other info on how your broker got into this situation.
                
> ActiveMQ fails to restart when there is a zero broker sequence ID
> -----------------------------------------------------------------
>
>                 Key: AMQ-3396
>                 URL: https://issues.apache.org/jira/browse/AMQ-3396
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.5.0
>         Environment: ActiveMQ v5.5.0 on Sun's JDK 1.6.0_23
> OS: Windows XP 2002 with sp3
> Database:  Oracle10g using JDBC driver ojdbc6_g.jar v11.2.0.2
>            Reporter: Michael Alford
>            Priority: Blocker
>              Labels: jdbc, oracle
>
> ActiveMQ broker server fails to start as a Windows Service.
> A NullPointerException happens during startup and then ActiveMQ shuts down automatically.
> Only workaround discovered so far is to drop all the database tables before starting
up the server.
> {code:title=JDBCPersistenceAdapter.java}
>     public long getLastMessageBrokerSequenceId() throws IOException {
>         TransactionContext c = getTransactionContext();
>         try {
>             long seq =  getAdapter().doGetLastMessageStoreSequenceId(c);
>             sequenceGenerator.setLastSequenceId(seq);
>             long brokerSeq = 0;
>             if (seq != 0) {
>                 byte[] msg = getAdapter().doGetMessageById(c, seq);
>                 if (msg != null) {
>                     Message last = (Message)wireFormat.unmarshal(new ByteSequence(msg));
>                     brokerSeq = last.getMessageId().getBrokerSequenceId();
>                 } else {
>                    LOG.warn("Broker sequence id wasn't recovered properly, possible duplicates!");
>                 }
>             }
>             return brokerSeq;
>         } catch (SQLException e) {
>             JDBCPersistenceAdapter.log("JDBC Failure: ", e);
>             throw IOExceptionSupport.create("Failed to get last broker message id: "
+ e, e);
>         } finally {
>             c.close();
>         }
>     }
> {code}
> When the byte array "msg" is not null but is populated with zeros, the wireFormat unmarshal
call will return null.
> This then causes a NullPointerException on line 237 of JDBCPersiistenceAdapter.
> {noformat}
> 2011-07-07 11:20:02,618 | DEBUG | Locking Query is SELECT * FROM V550_ACTIVEMQ_LOCK FOR
UPDATE | org.apache.activemq.store.jdbc.DefaultDatabaseLocker | WrapperSimpleAppMain
> 2011-07-07 11:20:02,649 | INFO  | Becoming the master on dataSource: oracle.jdbc.pool.OracleDataSource@1557ee8
| org.apache.activemq.store.jdbc.DefaultDatabaseLocker | WrapperSimpleAppMain
> 2011-07-07 11:20:02,649 | INFO  | ActiveMQ 5.5.0-fuse-00-27 JMS Message Broker (FuseActiveMQ-Broker-550)
is starting | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
> 2011-07-07 11:20:02,649 | INFO  | For help or more information please see: http://activemq.apache.org/
| org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
> 2011-07-07 11:20:04,774 | ERROR | Failed to start ActiveMQ JMS Message Broker. Reason:
java.lang.NullPointerException | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain
> java.lang.NullPointerException
> 	at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.getLastMessageBrokerSequenceId(JDBCPersistenceAdapter.java:237)
> 	at org.apache.activemq.broker.region.DestinationFactoryImpl.getLastMessageBrokerSequenceId(DestinationFactoryImpl.java:145)
> 	at org.apache.activemq.broker.region.RegionBroker.<init>(RegionBroker.java:122)
> 	at org.apache.activemq.broker.jmx.ManagedRegionBroker.<init>(ManagedRegionBroker.java:104)
> 	at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1838)
> 	at org.apache.activemq.broker.BrokerService.createRegionBroker(BrokerService.java:1832)
> 	at org.apache.activemq.broker.BrokerService.createBroker(BrokerService.java:1789)
> 	at org.apache.activemq.broker.BrokerService.getBroker(BrokerService.java:763)
> 	at org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.start(JDBCPersistenceAdapter.java:296)
> 	at org.apache.activemq.broker.BrokerService.start(BrokerService.java:490)
> 	at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:60)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
> 	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
> 	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
> 	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
> 	at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
> 	at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
> 	at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:106)
> 	at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:106)
> 	at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:71)
> 	at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
> 	at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
> 	at org.apache.activemq.console.command.StartCommand.startBroker(StartCommand.java:115)
> 	at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:74)
> 	at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
> 	at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:143)
> 	at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
> 	at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:85)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.activemq.console.Main.runTaskClass(Main.java:251)
> 	at org.apache.activemq.console.Main.main(Main.java:107)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
> 	at java.lang.Thread.run(Thread.java:662)
> 2011-07-07 11:20:04,837 | INFO  | ActiveMQ Message Broker (FuseActiveMQ-Broker-550, null)
is shutting down | org.apache.activemq.broker.BrokerService | WrapperSimpleAppMain 
> {noformat}
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message