camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BAltmiks <bernd.altm...@steria-mummert.de>
Subject JPA component in a JEE5 environment: EntityManagerFactory from JNDI
Date Mon, 31 Aug 2009 08:31:19 GMT

- Camel 2.0M3
- Camel-JPA 2.0M3
- Weblogic 10
- Hibernate-Core 3.3.0.SP1 
- Hibernate-EntityManager 3.4.0.GA
- Configuration in Spring XML


Hi,

I tried to make use of the jpa component. But I have problems to get an
EntityManagerFactory from JNDI on Weblogic 10. As described in the 
http://static.springsource.org/spring/docs/2.5.x/reference/orm.html#orm-jpa
Spring JPA Documentation  I do a JNDI-Lookup. persistence-unit-ref entries
are defined in the Java EE deployment descriptor (ejb-jar.xml).

The Exception is:

javax.naming.NameNotFoundException: Unable to resolve 'TMD_PERSISTENCE'.
Resolved ''; remaining name 'TMD_PERSISTENCE'
        at
weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1138)
        at
weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:251)
        at
weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:171)
        at
weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:205)
        at
weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
        at
weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:367)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at
org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
        at
org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
        at
org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
        at
org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)

Can anybody give me a hint what i am doing wrong?

Thanks,
Bernd Altmiks

My Camel-Context:
...
<jee:jndi-lookup id="eMFactory" jndi-name="TMD_PERSISTENCE"/> 

<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
	<property name="entityManagerFactory" ref="eMFactory" />
	<property name="transactionManager" ref="txManager" />
</bean>

<bean id="txManager"
class="org.springframework.transaction.jta.WebLogicJtaTransactionManager"/>
...


My ejb-jar.xml

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

<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
	version="3.0">
	<enterprise-beans>

		<session>
			<ejb-name>ITMDClientDAO</ejb-name>
			<ejb-class>tmd.al.dao.TMDClientDAO</ejb-class>
			<session-type>Stateless</session-type>			
			<persistence-unit-ref>
				<persistence-unit-ref-name>TMD_PERSISTENCE</persistence-unit-ref-name>
				<persistence-unit-name>TMD_PERSISTENCE</persistence-unit-name>
				<mapped-name>TMD_PERSISTENCE</mapped-name>
			</persistence-unit-ref>		
		</session>
	</enterprise-beans>
</ejb-jar>


My persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="TMD_PERSISTENCE" transaction-type="JTA">    
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
   
<jta-data-source>com.mummert.tributum.tbpersistence.TributumDataSource</jta-data-source>
      
	<class>tmd.al.entity.TMDMessage</class>
    <properties>
      <property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>            
      <property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
      <property name="hibernate.show_sql" value="false" />
      <property name="hibernate.format_sql" value="false" />      
      <property name="hibernate.use_sql_comments" value="false"/>
      <property name="hibernate.generate_statistics" value="false" />	    
	   <property name="hibernate.jndi.weblogic.jndi.replicateBindings"
value="false" /> 
	    <property name="hibernate.query.factory_class"
value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory"/>
      <property name="hibernate.cache.use_second_level_cache"
value="false"/>      
    </properties>
  </persistence-unit>
</persistence>


-- 
View this message in context: http://www.nabble.com/JPA-component-in-a-JEE5-environment%3A-EntityManagerFactory-from-JNDI-tp25219979p25219979.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message