16boke - 一路博客

ActiveMQ安装出错

使用ActiveMQ来开发时,启动生产者程序,程序报错:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/activemq/ActiveMQConnectionFactory : Unsupported major.minor version 51.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at com.mq.test.Sender.main(Sender.java:30)

原因是jdk版本过低。

摘自activemq官网说明:

What platforms does ActiveMQ Support?

ActiveMQ 5.0-5.7 supports any Java platform of Java 5.0 or later. To run on 1.4 see these instructions. ActiveMQ 5.8-5.10 require Java 6 or higher and the releases from 5.11 onwards require Java 7 or later. 

ActiveMQ is based on J2EE 1.4 or later and so implements JMS 1.1 and a JCA 1.5 Resource Adaptor.

We regularly test ActiveMQ on Windows, OS X, Linux though we're aware of folks who use AIX and Solaris too.

ActiveMQ 5.0-5.7  要求jdk5以上

ActiveMQ 5.8-5.10 要求jdk6以上

ActiveMQ 5.11     要求jdk7以上