4 Replies Latest reply on May 21, 2013 10:42 AM by simon shen

    JPA binding issue

    simon shen Newbie

      After deployed switchyard-quickstart-camel-jpa-binding, such following output can be seen from the console.

      Everything is ok I think, data can be saved and fetched from table successfully.

      15:20:40,043 INFO  [org.switchyard.quickstarts.camel.jpa.binding.PeriodicServiceImpl] (DefaultQuartzScheduler-camel-1_Worker-5) Sending Greet [null, from David, to Keith, created on Tue May 21 15:20:40 CST 2013] to JPA _store

       

      Then I deployed my JPA binding sample,actually it's similar with the above quickstart sample.

      It started to run, but got the following WARN,

      Obviously, data failed to be saved in database.

      16:14:55,043 INFO  [com.example.switchyard.episode10.PeriodicServiceBean] (DefaultQuartzScheduler-camel-3_Worker-1) Sending Greet [null, from Magesh, to Brian, created on Tue May 21 16:14:55 CST 2013] to JPA _store

      16:14:55,043 WARN  [org.apache.camel.component.jpa.JpaComponent] (DefaultQuartzScheduler-camel-3_Worker-1) No EntityManagerFactory has been configured on this JpaComponent. Each JpaEndpoint will auto create their own EntityManagerFactory.

      16:14:55,058 WARN  [org.apache.camel.component.jpa.JpaComponent] (DefaultQuartzScheduler-camel-3_Worker-1) No TransactionManager has been configured on this JpaComponent. Each JpaEndpoint will auto create their own JpaTransactionManager.

      16:14:55,074 WARN  [org.switchyard.internal.ExchangeImpl] (DefaultQuartzScheduler-camel-3_Worker-1) Fault generated during exchange without a handler: org.switchyard.HandlerException: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: jpa://com.example.switchyard.episode10.Greet?persistenceUnit=JpaEvents&transactionManager=%23jtaTransactionManager due to: Could not find a suitable setter for property: transactionManager as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: org.springframework.transaction.PlatformTransactionManager with value #jtaTransactionManager

      --- Caused by org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: jpa://com.example.switchyard.episode10.Greet?persistenceUnit=JpaEvents&transactionManager=%23jtaTransactionManager due to: Could not find a suitable setter for property: transactionManager as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: org.springframework.transaction.PlatformTransactionManager with value #jtaTransactionManager

      --- Caused by java.lang.IllegalArgumentException: Could not find a suitable setter for property: transactionManager as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: org.springframework.transaction.PlatformTransactionManager with value #jtaTransactionManager

       

      Environment:

      switchyard-as7-0.8

       

      My source files:

      1.switchyard.xml

      ep10.PNG

      <?xml version="1.0" encoding="UTF-8"?>

      <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:jpa="urn:switchyard-component-camel-jpa:config:1.0" xmlns:quartz="urn:switchyard-component-camel-quartz:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="episode10" targetNamespace="urn:com.example.switchyard:episode10:1.0">

        <sca:composite name="episode10" targetNamespace="urn:com.example.switchyard:episode10:1.0">

          <sca:component name="PeriodicServiceBean">

            <bean:implementation.bean class="com.example.switchyard.episode10.PeriodicServiceBean"/>

            <sca:service name="PeriodicService">

              <sca:interface.java interface="com.example.switchyard.episode10.PeriodicService"/>

            </sca:service>

            <sca:reference name="StoreService">

              <sca:interface.java interface="com.example.switchyard.episode10.StoreService"/>

            </sca:reference>

          </sca:component>

          <sca:service name="PeriodicService" promote="PeriodicServiceBean/PeriodicService">

            <sca:interface.java interface="com.example.switchyard.episode10.StoreService"/>

            <quartz:binding.quartz>

              <quartz:contextMapper/>

              <quartz:name>episode10</quartz:name>

              <quartz:cron>*/5 * * * * ?</quartz:cron>

            </quartz:binding.quartz>

          </sca:service>

          <sca:reference name="StoreReference" multiplicity="0..1" promote="PeriodicServiceBean/StoreService">

            <sca:interface.java interface="com.example.switchyard.episode10.StoreService"/>

            <jpa:binding.jpa>

              <jpa:contextMapper/>

              <jpa:entityClassName>com.example.switchyard.episode10.Greet</jpa:entityClassName>

              <jpa:persistenceUnit>JpaEvents</jpa:persistenceUnit>

              <jpa:transactionManager>#jtaTransactionManager</jpa:transactionManager>

              <jpa:produce/>

            </jpa:binding.jpa>

          </sca:reference>

        </sca:composite>

      </switchyard>

       

      2.the others

      ep11.PNG

      Thanks in advance who can help me.