线程" main"中的例外情况org.springframework.jmx.export.UnableToRegisterMBeanException:无法注册MBean

时间:2016-09-08 13:15:39

标签: java spring hibernate

我已在我的应用程序中将hibernate 3.x升级到5.2.1。升级后,我在运行应用程序时出现以下错误

2016-09-08 18:25:38.575 INFO net.spy.memcached.MemcachedConnection:  Connection state changed for sun.nio.ch.SelectionKeyImpl@572b4072
Exception in thread "main" org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [Statistics[start time=1473339335820,sessions opened=1,sessions closed=1,transactions=1,successful transactions=1,optimistic lock failures=0,flushes=0,connections obtained=1,statements prepared=1,statements closed=0,second level cache puts=0,second level cache hits=0,second level cache misses=0,entities loaded=0,entities updated=0,entities inserted=0,entities deleted=0,entities fetched=0,collections loaded=0,collections updated=0,collections removed=0,collections recreated=0,collections fetched=0,naturalId queries executed to database=0,naturalId cache puts=0,naturalId cache hits=0,naturalId cache misses=0,naturalId max query time=0,queries executed to database=1,query cache puts=0,query cache hits=0,query cache misses=0,update timestamps cache puts=0,update timestamps cache hits=0,update timestamps cache misses=0,max query time=18]] with key 'com.vervewireless.dao.hibernate:type=HibernateStatistics,name=SessionFactoryStatistics'; nested exception is org.springframework.jmx.export.MBeanExportException: Could not create ModelMBean for managed resource [Statistics[start time=1473339335820,sessions opened=1,sessions closed=1,transactions=1,successful transactions=1,optimistic lock failures=0,flushes=0,connections obtained=1,statements prepared=1,statements closed=0,second level cache puts=0,second level cache hits=0,second level cache misses=0,entities loaded=0,entities updated=0,entities inserted=0,entities deleted=0,entities fetched=0,collections loaded=0,collections updated=0,collections removed=0,collections recreated=0,collections fetched=0,naturalId queries executed to database=0,naturalId cache puts=0,naturalId cache hits=0,naturalId cache misses=0,naturalId max query time=0,queries executed to database=1,query cache puts=0,query cache hits=0,query cache misses=0,update timestamps cache puts=0,update timestamps cache hits=0,update timestamps cache misses=0,max query time=18]] with key 'com.vervewireless.dao.hibernate:type=HibernateStatistics,name=SessionFactoryStatistics'; nested exception is org.springframework.jmx.export.metadata.InvalidMetadataException: No ManagedResource attribute found for class: class org.hibernate.stat.internal.ConcurrentStatisticsImpl
    at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625)
    at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:550)
    at org.springframework.jmx.export.MBeanExporter.afterSingletonsInstantiated(MBeanExporter.java:432)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:796)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
    at com.vervewireless.ingester.exec.IngesterCamel.main(IngesterCamel.java:40)
Caused by: org.springframework.jmx.export.MBeanExportException: Could not create ModelMBean for managed resource [Statistics[start time=1473339335820,sessions opened=1,sessions closed=1,transactions=1,successful transactions=1,optimistic lock failures=0,flushes=0,connections obtained=1,statements prepared=1,statements closed=0,second level cache puts=0,second level cache hits=0,second level cache misses=0,entities loaded=0,entities updated=0,entities inserted=0,entities deleted=0,entities fetched=0,collections loaded=0,collections updated=0,collections removed=0,collections recreated=0,collections fetched=0,naturalId queries executed to database=0,naturalId cache puts=0,naturalId cache hits=0,naturalId cache misses=0,naturalId max query time=0,queries executed to database=1,query cache puts=0,query cache hits=0,query cache misses=0,update timestamps cache puts=0,update timestamps cache hits=0,update timestamps cache misses=0,max query time=18]] with key 'com.vervewireless.dao.hibernate:type=HibernateStatistics,name=SessionFactoryStatistics'; nested exception is org.springframework.jmx.export.metadata.InvalidMetadataException: No ManagedResource attribute found for class: class org.hibernate.stat.internal.ConcurrentStatisticsImpl
    at org.springframework.jmx.export.MBeanExporter.createAndConfigureMBean(MBeanExporter.java:820)
    at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:677)
    at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:621)
    ... 8 more
Caused by: org.springframework.jmx.export.metadata.InvalidMetadataException: No ManagedResource attribute found for class: class org.hibernate.stat.internal.ConcurrentStatisticsImpl
    at org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler.populateMBeanDescriptor(MetadataMBeanInfoAssembler.java:305)
    at org.springframework.jmx.export.assembler.AbstractMBeanInfoAssembler.getMBeanInfo(AbstractMBeanInfoAssembler.java:70)
    at org.springframework.jmx.export.MBeanExporter.getMBeanInfo(MBeanExporter.java:842)
    at org.springframework.jmx.export.MBeanExporter.createAndConfigureMBean(MBeanExporter.java:815)
    ... 10 more

我正在使用带有hibernate 5.2.1的spring 4.3.2版本用于我的应用程序。

XML文件: -

<bean id="httpTransportJmxExporter" class="org.springframework.jmx.export.MBeanExporter">
    <property name="beans">
        <map>
            <entry key="com.test.hibernate:type=HibernateStatistics,name=SessionFactoryStatistics"
                   value-ref="sessionFactoryStatistics"/>
            <entry key="com.test.hibernate:type=HibernateStatistics,name=ReadingSessionFactoryStatistics"
                   value-ref="readingSessionFactoryStatistics"/>
        </map>
    </property>
</bean>

如何解决上述问题?

0 个答案:

没有答案