3 Replies Latest reply on Mar 5, 2013 4:29 AM by davsclaus

    Trouble getting the jpa-osgi project example work with MySQL

    jelramzy_jelramzy

      Hi everyone!

       

      Well as the title of the issue mention it, i am experiencing serious troubles to get the jpa-osgi project example functionnal by replacing the HSQLDB with MYSQL.

       

      Obvliously ( i hope i am not mistaking) i had to modify 2 files : "persistence.xml" and "beans.xml" in the wsdl-first-cxfse-bundle sub-project.

      Here are the modifications i brought to the 2 files:

       

      • beans.xml file

       

       

       

      • persistence.xml file:

       

       

                      <property name="hibernate.connection.password" value="mypass" />

                     <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test" />

                     <property name="hibernate.connection.username" value="myuser" />

                </properties>

           </persistence-unit>

      </persistence>

       

       

      I reinstalles the bundles via the  console , as described in the readme.txt file , but i got the following exception in the fuse console:

       

      karaf@root> Exception in thread "SpringOsgiExtenderThread-14" org.springframewor

      k.beans.factory.BeanCreationException: Error creating bean with name 'org.apache

      .servicemix.cxfse.CxfSeEndpoint#0' defined in URL [bundle://267.0:0/META-INF/spr

      ing/beans.xml]: Cannot create inner bean 'org.apache.servicemix.samples.wsdl_fir

      st.PersonImpl#0' of type w

      hile setting bean property 'pojo'; nested exception is org.springframework.beans

      .factory.BeanCreationException: Error creating bean with name 'org.apache.servic

      emix.samples.wsdl_first.PersonImpl#0' defined in URL [bundle://267.0:0/META-INF/

      spring/beans.xml]: Instantiation of bean failed; nested exception is org.springf

      ramework.beans.BeanInstantiationException: Could not instantiate bean class [org

      .apache.servicemix.samples.wsdl_first.PersonImpl]: Constructor threw exception;

      nested exception is java.lang.UnsupportedOperationException: Not supported by Ba

      sicDataSource

              at org.springframework.beans.factory.support.BeanDefinitionValueResolver

      .resolveInnerBean(BeanDefinitionValueResolver.java:281)

              at org.springframework.beans.factory.support.BeanDefinitionValueResolver

      .resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb

      ject(AbstractBeanFactory.java:291)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr

      y.getSingleton(DefaultSingletonBeanRegistry.java:222)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe

      an(AbstractBeanFactory.java:288)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean

      (AbstractBeanFactory.java:190)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.

      preInstantiateSingletons(DefaultListableBeanFactory.java:580)

              at org.springframework.context.support.AbstractApplicationContext.finish

      BeanFactoryInitialization(AbstractApplicationContext.java:895)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

      plicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:6

      9)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

      plicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)

              at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCus

      tomTCCL(PrivilegedUtils.java:85)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp

      plicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.ja

      va:320)

              at org.springframework.osgi.extender.internal.dependencies.startup.Depen

      dencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterAp

      plicationContextExecutor.java:132)

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

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creati

      ng bean with name 'org.apache.servicemix.samples.wsdl_first.PersonImpl#0' define

      d in URL bundle://267.0:0/META-INF/spring/beans.xml: Instantiation of bean fai

      led; nested exception is org.springframework.beans.BeanInstantiationException: C

      ould not instantiate bean class [org.apache.servicemix.samples.wsdl_first.Person

      Impl]: Constructor threw exception;

              at org.springframework.beans.factory.support.ConstructorResolver.autowir

      eConstructor(ConstructorResolver.java:288)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBean

      Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)

              at org.springframework.beans.factory.support.BeanDefinitionValueResolver

      .resolveInnerBean(BeanDefinitionValueResolver.java:270)

              ... 17 more

      Caused by: org.springframework.beans.BeanInstantiationException: Could not insta

      ntiate bean class : Constru

      ctor threw exception; nested exception is java.lang.UnsupportedOperationExceptio

      n: Not supported by BasicDataSource

              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1

      41)

              at org.springframework.beans.factory.support.SimpleInstantiationStrategy

      .instantiate(SimpleInstantiationStrategy.java:108)

              at org.springframework.beans.factory.support.ConstructorResolver.autowir

      eConstructor(ConstructorResolver.java:280)

              ... 22 more

      Caused by: java.lang.UnsupportedOperationException: Not supported by BasicDataSo

      urce

              at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource

      .java:900)

              at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.get

      Connection(InjectedDataSourceConnectionProvider.java:43)

              at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager

      .java:446)

              at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.

      java:167)

              at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)

              at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:

      85)

              at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354

      )

              at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:38)

              at org.apache.servicemix.samples.wsdl_first.PersonImpl.(PersonImpl

      .java:36)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

       

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct

      orAccessorImpl.java:39)

              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC

      onstructorAccessorImpl.java:27)

              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

              at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1

      26)

              ... 24 more

       

       

      I am using   +"apache-servicemix-4.4.1-fuse-08-15" +and the hsqld worked fine for me and did not have any trouble to test it.

       

      I have the MYSQL database running locally and i don't really see where is the problem? is it related to the driver? is there a step by step tutorial in that case showing how to deploy it ( if it si the problem) ?

       

       

      I am discovering Fuse  ESB so please any help or explanation will be more than welcome here.

       

      Regrads