1

这让我发疯。我只是想在 Mac OSX 10.5.7 上运行 activemq。我有 java 版本 1.5.0_19 和 activemq 5.2.0。下面是我在运行 bin/activemq 时遇到的异常。似乎无法找到 log4j,这很奇怪,因为它带有 activemq,并且肯定在 lib/optionals 目录中。我唯一能想到的就是我在某个地方发生了冲突,但我无法想象这怎么可能。如果有人有任何提示,无论我是否全心全意,谷歌搜索几乎没有产生相同错误的结果,并且有确切错误的人没有解决方案。

> brad-robertsons-macbook-pro:apache-activemq-5.2.0
> bradrobertson$ ./bin/activemq
> ACTIVEMQ_HOME:
> /Users/bradrobertson/Java/apache-activemq-5.2.0
> ACTIVEMQ_BASE:
> /Users/bradrobertson/Java/apache-activemq-5.2.0
> Loading message broker from:
> xbean:activemq.xml ERROR:
> java.lang.RuntimeException: Failed to
> execute start task. Reason:
> java.io.IOException: Could not load
> xbean
> factory:java.lang.ExceptionInInitializerError
> java.lang.RuntimeException: Failed to
> execute start task. Reason:
> java.io.IOException: Could not load
> xbean
> factory:java.lang.ExceptionInInitializerError
>   at
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:98)
>   at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>   at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
>   at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>   at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
>   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:585)
>   at
> org.apache.activemq.console.Main.runTaskClass(Main.java:225)
>   at
> org.apache.activemq.console.Main.main(Main.java:106)
> Caused by: java.io.IOException: Could
> not load xbean
> factory:java.lang.ExceptionInInitializerError
>   at
> org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
>   at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
>   at
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:70)
>   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)
>   ... 10 more Caused by:
> java.lang.ExceptionInInitializerError
>   at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)   at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>   at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>   at
> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>   at
> java.lang.Class.newInstance0(Class.java:350)
>   at
> java.lang.Class.newInstance(Class.java:303)
>   at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:55)
>   at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:42)
>   at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
>   ... 14 more Caused by:
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException:
> No suitable Log constructor
> [Ljava.lang.Class;@abcc03 for
> org.apache.commons.logging.impl.Log4JLogger
> (Caused by
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category) (Caused by
> org.apache.commons.logging.LogConfigurationException:
> No suitable Log constructor
> [Ljava.lang.Class;@abcc03 for
> org.apache.commons.logging.impl.Log4JLogger
> (Caused by
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category))   at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
>   at
> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
>   at
> org.apache.activemq.xbean.XBeanBrokerFactory.<clinit>(XBeanBrokerFactory.java:43)
>   ... 23 more Caused by:
> org.apache.commons.logging.LogConfigurationException:
> No suitable Log constructor
> [Ljava.lang.Class;@abcc03 for
> org.apache.commons.logging.impl.Log4JLogger
> (Caused by
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category)    at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
>   ... 27 more Caused by:
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category     at
> java.lang.Class.getDeclaredConstructors0(Native
> Method)   at
> java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>   at
> java.lang.Class.getConstructor0(Class.java:2671)
>   at
> java.lang.Class.getConstructor(Class.java:1629)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
>   ... 28 more ERROR:
> java.lang.Exception:
> java.io.IOException: Could not load
> xbean
> factory:java.lang.ExceptionInInitializerError
> java.lang.Exception:
> java.io.IOException: Could not load
> xbean
> factory:java.lang.ExceptionInInitializerError
>   at
> org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
>   at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>   at
> org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:129)
>   at
> org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
>   at
> org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:79)
>   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:585)
>   at
> org.apache.activemq.console.Main.runTaskClass(Main.java:225)
>   at
> org.apache.activemq.console.Main.main(Main.java:106)
> Caused by: java.io.IOException: Could
> not load xbean
> factory:java.lang.ExceptionInInitializerError
>   at
> org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27)
>   at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:43)
>   at
> org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:70)
>   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)
>   ... 10 more Caused by:
> java.lang.ExceptionInInitializerError
>   at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)   at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>   at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>   at
> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>   at
> java.lang.Class.newInstance0(Class.java:350)
>   at
> java.lang.Class.newInstance(Class.java:303)
>   at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:55)
>   at
> org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:42)
>   at
> org.apache.activemq.broker.BrokerFactory.createBrokerFactoryHandler(BrokerFactory.java:41)
>   ... 14 more Caused by:
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException:
> No suitable Log constructor
> [Ljava.lang.Class;@abcc03 for
> org.apache.commons.logging.impl.Log4JLogger
> (Caused by
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category) (Caused by
> org.apache.commons.logging.LogConfigurationException:
> No suitable Log constructor
> [Ljava.lang.Class;@abcc03 for
> org.apache.commons.logging.impl.Log4JLogger
> (Caused by
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category))   at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
>   at
> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
>   at
> org.apache.activemq.xbean.XBeanBrokerFactory.<clinit>(XBeanBrokerFactory.java:43)
>   ... 23 more Caused by:
> org.apache.commons.logging.LogConfigurationException:
> No suitable Log constructor
> [Ljava.lang.Class;@abcc03 for
> org.apache.commons.logging.impl.Log4JLogger
> (Caused by
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category)    at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
>   ... 27 more Caused by:
> java.lang.NoClassDefFoundError:
> org/apache/log4j/Category     at
> java.lang.Class.getDeclaredConstructors0(Native
> Method)   at
> java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>   at
> java.lang.Class.getConstructor0(Class.java:2671)
>   at
> java.lang.Class.getConstructor(Class.java:1629)
>   at
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
>   ... 28 more
4

2 回答 2

2

因此,这绝对是与另一个 log4j jar 文件的冲突。我认为这可能是我的 eclipse 插件 log4j 冲突。当我从 activemq lib/optional 中删除 log4j 时,它可以工作。

于 2009-06-29T18:23:12.833 回答
1

这看起来像是由NoClassDefFoundErrorfor引起的异常org.apache.log4j.Category。您应该确保log4jjar 在类路径中。

编辑:有什么方法可以检查ACTIVEMQ_CLASSPATH变量的值?如果您通过设置变量的脚本调用它,您可能需要深入研究脚本以确保它将您认为的所有目录添加到类路径中。

于 2009-06-29T16:22:42.233 回答