2 Replies Latest reply on Aug 27, 2010 8:27 PM by Willem Jiang

    Using camel with hibernate / hsql to store exchanges

    Mohsen GHARBI Newbie

      I want to trace exchanges and store them in a database, I've written a program (inspired from camel-tracer-example), but when i try to run it , i got the following errors:

      karaf@root> Exception in thread "SpringOsgiExtenderThread-72" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionTemplate' defined in URL

      bundleentry://222.fwk8970973/META-INF/spring/camel-context.xml: Cannot create inner bean 'org.springframework.orm.jpa.JpaTransactionManager#1d7a7b3' of type [org.springframework.orm.

      jpa.JpaTransactionManager] while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '

      org.springframework.orm.jpa.JpaTransactionManager#1d7a7b3' defined in URL bundleentry://222.fwk8970973/META-INF/spring/camel-context.xml: Cannot resolve reference to bean 'entityManag

      erFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerF

      actory' defined in URL bundleentry://222.fwk8970973/META-INF/spring/camel-context.xml: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Pr

      ovider error. Provider: null

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:117)

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

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

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

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

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

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

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

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

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

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

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

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

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

      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)

      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)

      at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)

      at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.

      java:136)

      at java.lang.Thread.run(Thread.java:595)

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.orm.jpa.JpaTransactionManager#1d7a7b3' defined in URL [bundleentry

      ://222.fwk8970973/META-INF/spring/camel-context.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org

      .springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://222.fwk8970973/META-INF/spring/camel-context.xml

      ]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Provider error. Provider: null

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)

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

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

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

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

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

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

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:219)

      ... 20 more

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL [bundleentry://222.fwk8970973/META-INF/spring/cam

      el-context.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Provider error. Provider: null

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)

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

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

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

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

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

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

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

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

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

      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)

      ... 28 more

      Caused by: javax.persistence.PersistenceException: Provider error. Provider: null

      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:109)

      at org.springframework.orm.jpa.LocalEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalEntityManagerFactoryBean.java:91)

      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:291)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)

      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)

      ... 38 more

      Caused by: <openjpa-0.0.0-rnull fatal user error> org.apache.openjpa.persistence.ArgumentException: Could not invoke the static newInstance method on the named factory class "<<openjpa-

      0.0.0-rnull fatal user error> org.apache.openjpa.util.UserException: The named BrokerFactory "org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory" is not valid.>".

      at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:70)

      at org.apache.openjpa.persistence.PersistenceProviderImpl.getBrokerFactory(PersistenceProviderImpl.java:102)

      at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:81)

      at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:109)

      at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:53)

      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:105)

      ... 42 more

      Caused by: <openjpa-0.0.0-rnull fatal user error> org.apache.openjpa.persistence.ArgumentException: The named BrokerFactory "org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory" is not val

      id.

      at org.apache.openjpa.kernel.Bootstrap.getFactoryClass(Bootstrap.java:159)

      at org.apache.openjpa.kernel.Bootstrap.invokeFactory(Bootstrap.java:111)

      at org.apache.openjpa.kernel.Bootstrap.newBrokerFactory(Bootstrap.java:62)

      ... 47 more

      Caused by: java.lang.ClassNotFoundException: org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory not found from bundle

      at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)

      at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)

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

      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

      at java.lang.Class.forName0(Native Method)

      at java.lang.Class.forName(Class.java:242)

      at org.apache.openjpa.kernel.Bootstrap.getFactoryClass(Bootstrap.java:157)

      ... 49 more

      Caused by: java.lang.ClassNotFoundException: org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory

      at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)

      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)

      at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)

      at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)

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

      at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)

      at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)

      at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)

      at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)

      ... 55 more

       

      here is my Spring file

       

       

       

      <!-- ***********************************ROUTE*******************************************-->

       

      <!-- ***********************************END ROUTE*******************************************-->

       

      </camelContext>

       

      <!-- ***********************************TRACE*******************************************-->

       

      <!-- ***********************************TRACE END*******************************************-->

       

      <!-- ***********************************JPA*******************************************-->

       

      <!-- ***********************************JPA END*******************************************-->