tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: OpenEJB+Tomcat+Oracle+Toplink
Date Fri, 20 Feb 2009 22:39:08 GMT
The datasource names in your persistence.xml (DBFirst, DBSec) do not  
match the names of the datasources you configured in your openejb.xml  
(DBM, DBL).

I'm suspicious of this line in the persistence.xml:

<property name="Context.INITIAL_CONTEXT_FACTORY"  
value="org.apache.openejb.client.LocalInitialContextFactory" />

I don't think any good can come to that as the only thing you can  
lookup from the LocalInitialContextFactory is EJB references.  I  
suspect that might be there for the transaction manager lookup.  We do  
ship with an implementation the Toplink JTATransactionController  
interface and will set it if we see you are using Toplink as your  
persistence provider, so all should work without any OpenEJB-specific  
flags in your persistence properties.

If you still see the issue, post the openejb.log output.  That should  
help us see how everything is being built.

-David

On Feb 20, 2009, at 4:19 AM, petko wrote:

>
> Hello ,
>
> In my project i am using OpenEJB with Tomcat and  Oracle 10g with  
> Toplink as
> provider
> I have problems configuring the persistence units and/or  
> datasources. I am
> not quite sure what the problem is.
> The structure of ejb jar folder is:
> -projectjar.jar
>    --com	
>    --META-INF,
> where in META-INF folder i have only two xml files
>    -- ejb-jar.xml
>    -- persistence.xml
> Because i have two database, i have two persistence-unit with  
> different
> names PUM and PUL
> Content of persistence.xml is:
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence 
> "
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="PUM" transaction-type="JTA">
>
> < 
> provider 
> >oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</ 
> provider>
> 	<jta-data-source>DBFirst</jta-data-source>
> 	<non-jta-data-source>DBFirstUnmanaged</non-jta-data-source>
> 	<class>com.Client</class>
> 	<exclude-unlisted-classes>true</exclude-unlisted-classes>
> 	<properties>
> 		<property name="toplink.logging.level" value="WARNING" />
> 		<property name="toplink.logging.level.sql" value="FINEST" />
> 		<property name="toplink.logging.level.ejb" value="FINEST" />
> 		<property name="Context.INITIAL_CONTEXT_FACTORY"
> value="org.apache.openejb.client.LocalInitialContextFactory" />
> 	</properties>
> </persistence-unit>
> <persistence-unit name="PUL" transaction-type="JTA">
>
> < 
> provider 
> >oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</ 
> provider>
> 	<jta-data-source>DBSec</jta-data-source>
> 	<non-jta-data-source>DBSecUnmanaged</non-jta-data-source>
> 	<class>com.Tasks</class>
> 	<exclude-unlisted-classes>true</exclude-unlisted-classes>
> 	<properties>
> 		<property name="toplink.logging.level" value="WARNING" />
> 		<property name="toplink.logging.level.sql" value="FINEST" />
> 		<property name="toplink.logging.level.ejb" value="FINEST" />
> 		<property name="Context.INITIAL_CONTEXT_FACTORY"
> value="org.apache.openejb.client.LocalInitialContextFactory" />
> </properties>
> </persistence-unit>
> Content of ejb-jar is:
> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> metadata-complete="true" version="3.0"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
> <enterprise-beans>
> 	<session>
> 		<display-name>ClientFacade</display-name>
> 		<ejb-name>ClientFacade</ejb-name>
> 		<business-remote>com.ClientFacadeRemote</business-remote>
> 		<ejb-class>com.ClientFacade</ejb-class>
> 		<session-type>Stateless</session-type>
> 		<transaction-type>Container</transaction-type>
> 		<persistence-context-ref>
> 		
> <persistence-context-ref-name>com.ClientFacade/em</persistence- 
> context-ref-name>
> 			<persistence-unit-name>PUM</persistence-unit-name>
> 			<persistence-context-type>Transaction</persistence-context-type>
> 			<injection-target>
> 				<injection-target-class>com.ClientFacade</injection-target-class>
> 				<injection-target-name>em</injection-target-name>
> 			</injection-target>
> 		</persistence-context-ref>
> 		<security-identity>
> 			<use-caller-identity />
> 		</security-identity>
> 	</session>
> 	<session>
> 		<display-name>TasksFacade</display-name>
> 		<ejb-name>TasksFacade</ejb-name>
> 		<business-remote>com.tasks.TasksFacadeRemote</business-remote>
> 		<ejb-class>com.tasks.TasksFacade</ejb-class>
> 		<session-type>Stateless</session-type>
> 		<transaction-type>Container</transaction-type>
> 		<persistence-context-ref>
> 		
> <persistence-context-ref-name>com.tasks.TasksFacade/em</persistence- 
> context-ref-name>
> 			<persistence-unit-name>PUL</persistence-unit-name>
> 			<persistence-context-type>Transaction</persistence-context-type>
> 			<injection-target>
> 				<injection-target-class>com.tasks.TasksFacade</injection-target- 
> class>
> 				<injection-target-name>em</injection-target-name>
> 			</injection-target>
> 		</persistence-context-ref>
> 		<security-identity>
> 			<use-caller-identity />
> 		</security-identity>
> 	</session>
> </enterprise-beans>
> </ejb-jar>
>
> In openejb.xml i put
> <Resource id="DBM" type="DataSource">
>  JdbcDriver oracle.jdbc.OracleDriver
>  JdbcUrl jdbc:oracle:thin:@server:1521:db
>   UserName user
>   Password user
> </Resource>
> <Resource id="DBL" type="DataSource">
>   JdbcDriver oracle.jdbc.OracleDriver
>   JdbcUrl jdbc:oracle:thin:@server:1521:db
>   UserName user2
>   Password user2
> </Resource>
>
> Oracle driver i put in lib folder on tomcat.
> Аctually, we migrate from Glassfish to Tomcat. On Glassfish  
> everything works
> fine.
>
> I hope that someone can help me out with this.
> Thanks in advance.
> -- 
> View this message in context: http://www.nabble.com/OpenEJB%2BTomcat%2BOracle%2BToplink-tp22119600p22119600.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>


Mime
View raw message