0

我正在使用带有 Spring 的 Kundera。kundera 版本是 2.10,与其他版本我得到不同的错误。我尝试在 kundera.properties 中声明 Client 类,但没有效果。对于 2.8 版,即使来自网站外的示例也不起作用。

错误信息

2014-02-11 13:20:13,763 INFO  org.springframework.web.context.ContextLoader.initWebApplicationContext:273 - Root WebApplicationContext: initialization started
2014-02-11 13:20:13,956 INFO  org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh:510 - Refreshing Root WebApplicationContext: startup date [Tue Feb 11 13:20:13 EET 2014]; root of context hierarchy
2014-02-11 13:20:14,079 INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions:315 - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-service.xml]
2014-02-11 13:20:14,174 INFO  org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions:315 - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
2014-02-11 13:20:15,475 INFO  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory:285 - Building JPA container EntityManagerFactory for persistence unit 'fastoryDatastore_pu'
2014-02-11 13:20:15,488 INFO  com.impetus.kundera.persistence.EntityManagerFactoryImpl.<init>:108 - Loading Core
2014-02-11 13:20:15,490 INFO  com.impetus.kundera.loader.CoreLoader.load:41 - Loading Kundera Core Metdata ... 
2014-02-11 13:20:15,496 INFO  com.impetus.kundera.persistence.EntityManagerFactoryImpl.configurePersistenceUnit:650 - Loading Persistence Unit MetaData For Persistence Unit(s) fastoryDatastore_pu.
2014-02-11 13:20:15,501 INFO  com.impetus.kundera.configure.PersistenceUnitConfiguration.configure:108 - Loading Metadata from persistence.xml ...
2014-02-11 13:20:15,509 ERROR com.impetus.kundera.configure.PersistenceUnitConfiguration.configure:135 - kundera.client property is missing for persistence unit:fastoryDatastore_pu
2014-02-11 13:20:15,531 INFO  org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons:444 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1c904f75: defining beans [jaxb2Marshaller,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,dataDaoImpl,startController,datastoreServiceEndpoint,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,EsperConfig,httpEndpoint,transactionManager,transactionManagerContextDatabase,entityManagerFactory,emfContext,rawConveyorNotification,rawEnergyMeterA,rawEnergyMeterB,rawEnergyMeterC,rawEquipmentChangeState,rawEquipmentChangeStateRobot,rawQualityInspection,rawTHLValue,cellProductionRate,kpiCamxStates,kpiTotalProducts,kpiPalletProductionTime,parserUtility,endpointService,dateUtils,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; root of factory hierarchy
2014-02-11 13:20:15,533 ERROR org.springframework.web.context.ContextLoader.initWebApplicationContext:319 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: kundera.client property is missing for persistence unit:fastoryDatastore_pu
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [tut.fi.dpe.fast.datastore.configuration.EsperConfig] for bean with name 'EsperConfig' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:922)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: kundera.client property is missing for persistence unit:fastoryDatastore_pu
    at com.impetus.kundera.configure.PersistenceUnitConfiguration.configure(PersistenceUnitConfiguration.java:136)
    at com.impetus.kundera.persistence.EntityManagerFactoryImpl.configurePersistenceUnit(EntityManagerFactoryImpl.java:656)
    at com.impetus.kundera.persistence.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:111)
    at com.impetus.kundera.KunderaPersistence.createContainerEntityManagerFactory(KunderaPersistence.java:63)
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:288)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
    ... 20 more

Persistence.xml 部分

<persistence-unit name="fastoryDatastore_pu">
    <provider>com.impetus.kundera.KunderaPersistence</provider>
    <properties>
        <property name="kundera.nodes" value="130.230.141.228" />
        <property name="kundera.port" value="9160" />
        <property name="kundera.keyspace" value="FastoryDatastore" />
        <property name="kundera.dialect" value="cassandra" />
        <property name="kundera.client.lookup.class"
            value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
        <property name="kundera.cache.provider.class"
            value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
        <property name="kundera.ddl.auto.prepare" value="update" />
    </properties>
</persistence-unit>

应用上下文部分

<bean id="transactionManagerContextDatabase" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="emfContext" />
</bean>
<bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="fastoryDatastore_pu" />
    <property name="loadTimeWeaver">
        <bean
            class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
    </property>
</bean>

谢谢你的帮助!

4

1 回答 1

0

rg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: kundera.client property is missing for persistence unit:fastoryDatastore_pu Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [tut.fi.dpe.fast.datastore.configuration.EsperConfig] for bean with name 'EsperConfig' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware

Looks like Spring core jar is missing from classpath?

-Vivek

于 2014-02-14T10:49:13.780 回答