geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: geronimo using JPOX JDO
Date Thu, 09 Aug 2007 07:26:56 GMT

On Aug 8, 2007, at 11:56 PM, fred.ac wrote:

>
> I'm trying to use JPOX framework (www.jpox.org) with geronimo 2-M6.
> I have a test case (all packaged in a ear) that is working with  
> JBOSS 4.2
> and I want ot make it working with geronimo.
>
> First problem: in the rar file provided in jpox distrib the ra.xml  
> doesn't
> contain available properties (config-property elements are empty).  
> With
> Jboss I defined all properties in a jpox-ds.xml file :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connection-factories>
>     <tx-connection-factory>
>         <jndi-name>eis/jdo/JpoxPersistenceManagerFactory</jndi-name>
>         <rar-name>MyApplication.ear#jpox-jca-1.2-SNAPSHOT.rar</rar- 
> name>
>
> <connection-definition>javax.resource.cci.ConnectionFactory</ 
> connection-definition>
>
>         <config-property name="ConnectionFactoryName"
>             type="java.lang.String">java:/tamsDS</config-property>
>         <config-property name="ConnectionFactory2Name"
>             type="java.lang.String">java:/tamsDS2</config-property>
> ...
>   </tx-connection-factory>
> </connection-factories>
>
> With geronimo I defined the properties in a jpox.xml file like this:
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
> connector-1.1">
>     <dep:environment
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
>         <dep:moduleId>
>             <dep:groupId>console.dbpool</dep:groupId>
>             <dep:artifactId>jpox</dep:artifactId>
>             <dep:version>1.0</dep:version>
>             <dep:type>rar</dep:type>
>         </dep:moduleId>
>         <dep:dependencies>
>             <dep:dependency>
>                 <dep:groupId>oracle</dep:groupId>
>                 <dep:artifactId>ojdbc14</dep:artifactId>
>                 <dep:version>10.2.0.1.0</dep:version>
>                 <dep:type>jar</dep:type>
>             </dep:dependency>
>         </dep:dependencies>
>     </dep:environment>
>
>     <resourceadapter>
>         <outbound-resourceadapter>
>             <connection-definition>
>
> <connectionfactory-interface>javax.resource.cci.ConnectionFactory</ 
> connectionfactory-interface>
>                 <connectiondefinition-instance>
>                     <name>jpox</name>
>                     <!--<config-property-setting
> name="ConnectionFactoryName">tamsDS</config-property-setting>
>                     <config-property-setting
> name="ConnectionFactory2Name">tamsDS2</config-property-setting>-->
>                     <config-property-setting
> name="ConnectionDriverName">oracle.jdbc.OracleDriver</config- 
> property-setting>
>                     <config-property-setting
> name="ConnectionURL">jdbc:oracle:thin:@localhost:1521/XE</config- 
> property-setting>
>                     <config-property-setting
> name="ConnectionUserName">sa</config-property-setting>
>                     <config-property-setting
> name="ConnectionPassword">hagar</config-property-setting>
>                     <config-property-setting
> name="Schema">SA</config-property-setting>
>                     <config-property-setting
> name="FixedDatastore">true</config-property-setting>
>                     <config-property-setting
> name="ValidateTables">false</config-property-setting>
>                     <config-property-setting
> name="ValidateConstraints">false</config-property-setting>
>                     <config-property-setting
> name="Optimistic">true</config-property-setting>
>                     <config-property-setting
> name="Multithreaded">true</config-property-setting>
>                     <config-property-setting
> name="IgnoreCache">true</config-property-setting>
>                     <config-property-setting
> name="RestoreValues">true</config-property-setting>
>                     <config-property-setting
> name="DetachAllOnCommit">true</config-property-setting>
>                     <config-property-setting
> name="NontransactionalRead">false</config-property-setting>
>                     <connectionmanager>
>                         <no-transaction/>
>                         <no-pool/>
>                     </connectionmanager>
>                 </connectiondefinition-instance>
>             </connection-definition>
>         </outbound-resourceadapter>
>     </resourceadapter>
> </connector>
>
> the jpox.xml file is referred in geronimo-application like this :
>  <module>
> <connector>jpox-jca-1.2-SNAPSHOT.rar</connector>
> <alt-dd>META-INF/jpox.xml</alt-dd>
> </module>
>
> Whe I deploy my ear file in geronimo I receive :
> Unable to deploy: org.apache.geronimo.common.DeploymentException:  
> The plan
> is trying to set attributes: [ConnectionDriverName, ConnectionURL,
> ConnectionUserName, ConnectionPassword, Schema, FixedDatastore,
> ValidateTables, ValidateConstraints, Optimistic, Multithreaded,  
> IgnoreCache,
> RestoreValues, DetachAllOnCommit, NontransactionalRead]
>
> I think it is because these properties are not define in the ra.xml  
> provided
> by jpox. If I manually add them it works.
>
> Is it possible to define properties somewhere else ? I don't want  
> to "patch"
> standard jpox distrib (jpox-jca-1.2-SNAPSHOT.rar) to make it  
> working with
> geronimo.

I think you will need to patch the rar or build your own with all the  
properties in the ra.xml.  My understanding of the j2ca spec is that  
this is required of the ra.xml.  If the jpox people think otherwise  
I'd like to know why.
>
> My second problem: I want that jpox use a geronimo connection pool.  
> I have
> created 2 connection pools via the geronimo console. I need a  
> transactional
> one and a non-transactional one, how can I specify this ?. Jpox  
> needs 2
> properties to use app server connection pool : ConnectionFactoryName
> (transactional) and ConnectionFactory2Name (non transactional). As  
> you see
> in the jpox-ds.xml the connections are refered with a global jndi name
> (java:/tamsDS and java:/tamsDS2). How can I refer this in geronimo ?
>
> following config doesn't work :
>
> <config-property-setting
> name="ConnectionFactoryName">java:/tamsDS</config-property-setting>
> <config-property-setting
> name="ConnectionFactory2Name">java:/tamsDS2</config-property-setting>
>
> Pools created in geronimo are defined like this :
> console.dbpool/tamsDS/1.0/rar
> console.dbpool/tamsDS2/1.0/rar
>
> How can I make the link between them ?

This is trickier.  This seems to me like one thing the jpa spec did  
better than the jdo spec.  Anyway, I would try providing resource- 
refs in each component that uses jdo (web app or ejb session bean) to  
each of the datasources and using something like

<config-property-setting
name="ConnectionFactoryName">java:comp/env/tamsDS</config-property- 
setting>
<config-property-setting
name="ConnectionFactory2Name">java:comp/env/tamsDS2</config-property- 
setting>

Another thing to be aware of is that your application needs to have  
both datasource in parent configurations.  So the geronimo plan would  
start something like

<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
     <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
         <dep:moduleId>
             <dep:groupId>console.dbpool</dep:groupId>
             <dep:artifactId>jpox</dep:artifactId>
             <dep:version>1.0</dep:version>
             <dep:type>rar</dep:type>
         </dep:moduleId>
         <dep:dependencies>
             <dep:dependency>
                 <dep:groupId>console.dbpool</dep:groupId>
                 <dep:artifactId>tamDS</dep:artifactId>
                 <dep:version>1.0</dep:version>
                 <dep:type>rar</dep:type>
             </dep:dependency>
             <dep:dependency>
                 <dep:groupId>console.dbpool</dep:groupId>
                 <dep:artifactId>tamDS2</dep:artifactId>
                 <dep:version>1.0</dep:version>
                 <dep:type>rar</dep:type>
             </dep:dependency>
         </dep:dependencies>
     </dep:environment>

I'd also advise combining the 2 datasource plans into one plan.  Be  
sure the non-transactional datasource really is configured with <no- 
transaction/>

As long as you name the datasources tamDS and tamDS2 in their plans I  
think geronimo will be able to look up the datasource correctly.

Does jpox recommend the <no-pool/> setting?

Please let us know how this works out.  If you still have problems  
and have a sample app to demonstrate the problems I can take a look  
at it.  I wonder if we should look into supporting jdo similarly to  
how jpa is supported.

thanks
david jencks


>
> Thanks
>
> Frédéric.
> -- 
> View this message in context: http://www.nabble.com/geronimo-using- 
> JPOX-JDO-tf4240920s134.html#a12067391
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Mime
View raw message