On Feb 10, 2009, at 1:37 PM, ericp56 wrote:


In persistence.xml I my data sources are named IVRFramework.

I want to change my openejb-jar.xml deployment plan so I can change the data
source at will.

That won't work... here's what you should do.

First, you'll probably find it more convenient to put both the jta and non-jta datasources in one plan. Lets say the id is then com.twcable.db/oracle/1.0/car. You'll have a dependency on that in your openejb-jar.xml plan similar to the existing dependencies. This is the "primary" datasource plugin.

Now write another plan for another set of jta and nonjta datasources, say with id com.twcable.db/firebird/1.0/car. Make sure the datasource names are exactly the same as in the primary plan. All the config properties, pooling, etc, can be different but the names have to be the same.

Deploy the second plan.

To get your app to use the 2nd plugin instead of the primary plugin, you need a couple lines in the var/config/artifact-aliases.properties file.

com.twcable.db/oracle/1.0/car=com.twcable.db/firebird/1.0/car
com.twcable.db/oracle//car=com.twcable.db/firebird/1.0/car

You probably only need the second line.




In my persistence.xml, the data sources are IVRFrameworkXA and IVRFramework. The DB Pools are OracleXA and Oracle. What's wrong with the deployement
plan?

Do you get errors? Does something not work? The only bit I see that looks like it might be a problem is that the db pool dependencies need the type, hopefully also "car".

hope this helps
david jencks



Thanks for your help.


<?xml version="1.0" encoding="UTF-8"?>
<ejb:openejb-jar
        xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0";

xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0 "
        xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2";
        xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2";
xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2";
        xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2";
xmlns:pers="http://java.sun.com/xml/ns/persistence";
        xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1";
xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0";
        xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1";>
        <dep:environment>
                <dep:moduleId>
                        <dep:groupId>abc</dep:groupId>
                        <dep:artifactId>IVRFrameworkEjb</dep:artifactId>
                        <dep:version>1.0</dep:version>
                        <dep:type>car</dep:type>
                </dep:moduleId>
                <dep:dependencies>
                        <dep:dependency>
                                
<dep:groupId>org.apache.geronimo.configs</dep:groupId>
                                <dep:artifactId>sharedlib</dep:artifactId>
                                <dep:type>car</dep:type>
                        </dep:dependency>
                        <dep:dependency>
                                <dep:groupId>console.dbpool</dep:groupId>
                                <dep:artifactId>Oracle</dep:artifactId>
                        </dep:dependency>
                        <dep:dependency>
                                <dep:groupId>console.dbpool</dep:groupId>
                                <dep:artifactId>OracleXA</dep:artifactId>
                        </dep:dependency>
                </dep:dependencies>
        </dep:environment>
        <ejb:enterprise-beans>
                <ejb:entity>
                        <ejb:ejb-ref>
                                <name:ref-name>IVRFrameworkXA</name:ref-name>
                                <name:ejb-link>OracleXA</name:ejb-link>
                        </ejb:ejb-ref>
                        <ejb:ejb-ref>
                                <name:ref-name>IVRFramework</name:ref-name>
                                <name:ejb-link>Oracle</name:ejb-link>
                        </ejb:ejb-ref>
                </ejb:entity>
        </ejb:enterprise-beans>
</ejb:openejb-jar>

--
View this message in context: 
http://www.nabble.com/Changing-the-jta-data-source-in-openejb-jar.xml-tp21943167s134p21943167.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Reply via email to