1.ActiveMQ 启动失败,错误日志如下
Exception thrown from LifecycleProcessor on context close | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.apache.activemq.xbean.XBeanBrokerFactory$1@191d8c1: startup date [Mon Jul 30 20:07:28 CST 2012]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010) at org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.java:30) at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:782) at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:122) at org.apache.activemq.broker.BrokerService.start(BrokerService.java:574) at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73) 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) ...
上网查好半天看到一个人说是机器名字带有下划线
修改机器名:
1.查看机器名:uname -a
2.#vi /etc/sysconfig/network //修改HOSTNAME=XX
3.#vi /etc/hosts //把默认的机器名localhost localhost.localhost localhst改为XX
4.#reboot //修改后重启机器
2.持久化配置
broker节点中
<persistenceAdapter> <jdbcPersistenceAdapter dataSource="#mysql-ds" createTablesOnStartup="true" /> </persistenceAdapter>
<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://hostip:port/invest?useUnicode=true&characterEncoding=utf-8"/> <property name="username" value="username"/> <property name="password" value="password"/> <property name="poolPreparedStatements" value="true"/> </bean>
java.sql.SQLException: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
4.安全权限配置
参考:http://activemq.apache.org/security.html
http://log-cd.iteye.com/blog/585616
<plugins> <!-- Configure authentication; Username, passwords and groups --> <simpleAuthenticationPlugin> <users> <authenticationUser username="system" password="manager" groups="users,admins"/> <authenticationUser username="user" password="password" groups="users"/> <authenticationUser username="guest" password="password" groups="guests"/> <authenticationUser username="invest" password="invest" groups="investQueue"/> </users> </simpleAuthenticationPlugin> <!-- Lets configure a destination based authorization mechanism --> <authorizationPlugin> <map> <authorizationMap> <authorizationEntries> <authorizationEntry queue="queue.group.uum" read="users" write="users" admin="users" /> <authorizationEntry queue=">" read="admins" write="admins" admin="admins" /> <authorizationEntry queue="USERS.>" read="users" write="users" admin="users" /> <authorizationEntry queue="GUEST.>" read="guests" write="guests,users" admin="guests,users" /> <authorizationEntry queue="TEST.Q" read="guests" write="guests" /> <authorizationEntry queue="queue_invest" read="investQueue " write="investQueue " admin="investQueue"/> <authorizationEntry topic=">" read="admins" write="admins" admin="admins" /> <authorizationEntry topic="USERS.>" read="users" write="users" admin="users" /> <authorizationEntry topic="GUEST.>" read="guests" write="guests,users" admin="guests,users" /> <authorizationEntry topic="ActiveMQ.Advisory.>" read="guests,users,investQueue" write="guests,users,investQueue" admin="guests,users,investQueue"/> </authorizationEntries> </authorizationMap> </map> </authorizationPlugin> </plugins>