camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hamlet84 <donatello.sant...@gmail.com>
Subject Re: Using JPA in ServiceMix + Camel
Date Mon, 19 Nov 2007 12:51:27 GMT

i've resolve using this configuration in camel-context.xml

[...]
   <bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <property name="jpaVendorAdapter">
         <bean
class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
            <property name="showSql" value="true"/>
            <property name="generateDdl" value="true"/>
            <property name="databasePlatform"
value="oracle.toplink.essentials.platform.database.HSQLPlatform"/>
         </bean>
      </property>
      <property name="loadTimeWeaver">
         <bean
class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
      </property>
   </bean>

   <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
      <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
      <property name="url" value="jdbc:hsqldb:mem:freesbee_etl"/>
      <property name="username" value="sa"/>
      <property name="password" value=""/>
   </bean>

   <bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
      <property name="entityManagerFactory" ref="entityManagerFactory"/>
      <property name="dataSource" ref="dataSource"/>
   </bean>
[...]
 and adding the right jar into servicemix\lib

Now the application start correctly. But...
in the camel-su i have a test component as follow

public class Prova extends RouteBuilder {    
    public void configure() throws Exception {
        this.from("jbi:service:http://icar.unibas.it/FreESBee/CamelProva")   
            .convertBodyTo(PersonDocument.class)
            .to("jpa:it.unibas.icar.freesbee.dao.CustomerEntity"); 
    }
}

The PersonDocument and CustomerEntity class are the same of the
camel-example-etl.
Now, when i deploy this component, ServiceMix doesn't works.. I have the
follow error

org.apache.camel.RuntimeCamelException:
org.apache.camel.NoSuchEndpointException: No endpoint could be found for:
jpa:it.unibas.icar.freesbee.dao.CustomerEntity</loc-message>
<stack-trace><![CDATA[org.apache.xbean.kernel.ServiceRegistrationException:
org.apache.camel.RuntimeCamelException:
org.apache.camel.NoSuchEndpointException: No endpoint could be found for:
jpa:it.unibas.icar.freesbee.dao.CustomerEntity


there are some problem with jpa component of camel and servicemix??



Chris Custine-2 wrote:
> 
> The LocalEntityManagerFactoryBean should look in META-INF/persistence.xml
> but I think what is happening is that it can't find a JPA provider  for
> that
> persistence unit.  Any chance that you don't have a JPA provider in the
> classpath or properly configured?  Even though there are other ways of
> doing
> it, I don't see a <*provider*>...</*provider*> section in your
> persistence-unit
> section above so that might be something to check.
> 
> Chris
> 
> On Nov 15, 2007 4:50 PM, Guillaume Nodet <gnodet@gmail.com> wrote:
> 
>> There is no automatic discovery of persistent units so you'd have to
>> create
>> it yourself using spring jpa support afaik.
>>
>> On Nov 15, 2007 8:21 PM, Hamlet84 < donatello.santoro@gmail.com> wrote:
>>
>> >
>> > i've just try it, but i have got the same problem :-((
>> >
>> > Chris Custine-2 wrote:
>> > >
>> > > Try moving your persistence.xml to META-INF.
>> > >
>> > > Chris
>> > >
>> > > On Nov 15, 2007 3:25 AM, Hamlet84 <donatello.santoro@gmail.com>
>> wrote:
>> > >
>> > >>
>> > >> Hi..
>> > >> I have an application with ServiceMix 3.2 and Camel component.
>> > >> Well, I want to use the JPA Component in camel to store Exchange in
>> a
>> > >> persistent database. But i have a problem when I install the
>> > application
>> > >> in
>> > >> ServiceMix.
>> > >>
>> > >> in Camel-context.xml
>> > >> [..]
>> > >>  <bean id="transactionTemplate"
>> > >> class="
>> org.springframework.transaction.support.TransactionTemplate">
>> > >>    <property name="transactionManager">
>> > >>      <bean
>> class="org.springframework.orm.jpa.JpaTransactionManager">
>> > >>        <property name="entityManagerFactory"
>> > ref="entityManagerFactory"/>
>> > >>      </bean>
>> > >>    </property>
>> > >>  </bean>
>> > >>
>> > >>  <bean id="jpaTemplate" class="
>> org.springframework.orm.jpa.JpaTemplate
>> > ">
>> > >>    <property name="entityManagerFactory"
>> ref="entityManagerFactory"/>
>>
>> > >>  </bean>
>> > >>
>> > >>  <bean id="entityManagerFactory"
>> > >> class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
>> > >>    <property name="persistenceUnitName" value="camel"/>
>> > >>  </bean>
>> > >>
>> > >> my Persistence.xml
>> > >>
>> > >> <persistence xmlns=".." xmlns:xsi=".." version="1.0">
>> > >>
>> > >>  <persistence-unit name="camel" transaction-type="RESOURCE_LOCAL">
>> > >>
>> > >>    <properties>
>> > >>      <property name="hibernate.dialect "
>> > >> value="org.hibernate.dialect.HSQLDialect"/>
>> > >>      <property name="hibernate.connection.driver_class"
>> > >> value="org.hsqldb.jdbcDriver"/>
>> > >>      <property name="hibernate.connection.username" value="sa"/>
>> > >>      <property name="hibernate.connection.password" value=""/>
>> > >>      <property name=" hibernate.connection.url"
>> > >> value="jdbc:hsqldb:mem:camel_etl"/>
>> > >>      <property name="hibernate.hbm2ddl.auto" value="create"/>
>> > >>    </properties>
>> > >>
>> > >>  </persistence-unit>
>> > >> </persistence>
>> > >>
>> > >> the error is "Invocation of init method failed; nested exception is
>> > >> javax.persistence.PersistenceException: No Persistence provider for
>> > >> EntityManager named camel"
>> > >>
>> > >> I think that it is a problem of the position of file
>> persistence.xml.
>> > My
>> > >> service activator has the follow structure
>> > >>
>> > >> test-su.zip
>> > >> |--test-camel-su.zip
>> > >>   |---camel-context.xml
>> > >>   |---persistence.xml
>> > >>   |---META-INF
>> > >>       |--jbi.xml
>> > >> |--META-INF
>> > >>   |--- jbi.xml
>> > >> --
>> > >> View this message in context:
>> > >>
>> >
>> http://www.nabble.com/Using-JPA-in-ServiceMix-%2B-Camel-tf4811001s22882.html#a13765083
>> > >> Sent from the Camel - Users mailing list archive at Nabble.com.
>> > >>
>> > >>
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/Using-JPA-in-ServiceMix-%2B-Camel-tf4811001s22882.html#a13779788
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>> >
>> >
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-JPA-in-ServiceMix-%2B-Camel-tf4811001s22882.html#a13835420
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message