问答详情
源自:-

演练生产者发送消息报错

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/activemq/ActiveMQConnectionFactory : Unsupported major.minor version 52.0

at java.lang.ClassLoader.defineClass1(Native Method)

at java.lang.ClassLoader.defineClass(ClassLoader.java:791)

at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

at java.lang.ClassLoader.loadClass(ClassLoader.java:423)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

at com.Jms.queue.AppConsuner.main(AppConsuner.java:22)

JDK:1.7

ActiveMQ:5.14.4可以正常启动(之前下载的5.15.0不支持)

我百度说是版本不支持,但是不知道是怎么匹配



提问者:小提提la 2017-08-26 16:04

个回答

  • jovezhao
    2017-08-28 23:04:09

    确实是版本问题,你引用的jar包是1.8的,你的环境是1.7的。 建议你在本地使用1.8的版本

  • 小提提la
    2017-09-10 15:43:24

    targetFaction为啥set错误,单独演练ActiveMQ时"127.0.0.1:61616"地址没问题?????演练spring JMS这个地方一直报错


    配置:

    <!--ActiveMQ为我们提供的ConnectionFaction  -->

    <bean id="targetConnectionFaction" class="org.apache.activemq.ActiveMQConnectionFactory">

    <property name="brokerURL" value="tcp://127.0.0.1:61616"/>

    </bean>

    <!--spring jms为我们提供连接池  -->

    <bean id="connectionFaction" class="org.springframework.jms.connection.SingleConnectionFactory">

    <property name="targetFaction" ref="targetConnectionFaction"/>

    </bean>

    -----------------------------------------------------------------------------------------

    Exception: 

    WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFaction' defined in class path resource [productor.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'targetFaction' of bean class [org.springframework.jms.connection.SingleConnectionFactory]: Bean property 'targetFaction' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFaction' defined in class path resource [productor.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'targetFaction' of bean class [org.springframework.jms.connection.SingleConnectionFactory]: Bean property 'targetFaction' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1512)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1220)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)

    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)

    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)

    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)

    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)

    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

    at com.imocc.jms.productor.AppProductor.main(AppProductor.java:9)

    Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'targetFaction' of bean class [org.springframework.jms.connection.SingleConnectionFactory]: Bean property 'targetFaction' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1076)

    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:927)

    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)

    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)

    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1508)

    ... 13 more