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.

Reply via email to