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: EJB CMP + Database Pools config
Date Wed, 24 Oct 2007 16:17:01 GMT
2nd try... apparently first try was rejected as spam???
On Oct 24, 2007, at 5:27 AM, Viet Nguyen wrote:

>
>
> On 10/24/07, ivanrc <iriano@indra.es> wrote:
> Hi,
>
> I want to deploy EJB CMP. The EJB is deployed well, but I obtain by  
> logs
> this lines about dababase pool that I want to use:
>
> 10:06:58,154 WARN  [ResourceRefBuilder] Failed to build reference to
> resource reference [jdbc/gsePool] defined in plan file, reason -
> corresponding entry in deployment descriptor missing.
>
> In openejb-jar.xml,  this is the Entity tag´s resource-ref:
>
> <resource-ref>
>         <ref-name>jdbc/gsePool</ref-name>
>         <resource-link>gsePool</resource-link>
> </resource-ref>
>
> I can connect remotedly to EJB but I don´t obtain elements from DB.
>
> Could anyone help me?.Thanks
>
>
>
>
> OPENEJB-JAR.XML
>
> <?xml version="1.0" encoding="UTF-8"?>
> <openejb-jar
>                 xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1 "
>                 xmlns:nam="http://geronimo.apache.org/xml/ns/ 
> naming-1.1"
>                 xmlns:pkgen=" http://www.openejb.org/xml/ns/pkgen-2.0"
>                 xmlns:sec="http://geronimo.apache.org/xml/ns/ 
> security-1.1"
>                 xmlns:sys=" http://geronimo.apache.org/xml/ns/ 
> deployment-1.2">
>
>         <sys:environment>
>                 <sys:moduleId>
>                         <sys:groupId>default</sys:groupId>
>                         <sys:artifactId>EstadoAlarmaBean</ 
> sys:artifactId>
>                         <sys:version>1.31</sys:version>
>                         <sys:type>jar</sys:type>
>                 </sys:moduleId>
>         </sys:environment>
>    <enterprise-beans>
>         <entity>
>                 <ejb-name>EstadoAlarmaBean</ejb-name>
>                 <jndi-name>EstadoAlarma</jndi-name>
>         <table-name>CRC_GSE_ALAR_ESTADO_ALARMA</table-name>
>                 <cmp-field-mapping>
>                         <cmp-field-name>estadoAlarma</cmp-field-name>
>                         <table-column>ESTADO_ALARMA_TP</table-column>
>                 </cmp-field-mapping>
>                 <cmp-field-mapping>
>                         <cmp-field-name>estadoAlarmaGIA</cmp-field- 
> name>
>                         <table-column>ESTADO_ALARMA_GIA_NU</table- 
> column>
>                 </cmp-field-mapping>
>                 <resource-ref>
>             <ref-name>jdbc/gsePool</ref-name>
>             <resource-link>gsePool</resource-link>
>         </resource-ref>
>         </entity>
>   </enterprise-beans>
> </openejb-jar>
>
> EJB-JAR-XML
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ejb-jar xmlns=" http://java.sun.com/xml/ns/j2ee"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" version="2.1">
>
>    <enterprise-beans>
>       <entity>
>             <display-name></display-name>
>             <ejb-name>EstadoAlarmaBean</ejb-name>
>
> <home>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaHome</home>
>
> <remote>com.indra.gse.server.ejb.estadoalarma.EstadoAlarma</remote>
>
> <local- 
> home>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaLocalHome</ 
> local-home>
>
> <local>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaLocal </ 
> local>
>
> <ejb-class>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaBean</ 
> ejb-class>
>             <persistence-type>Container</persistence-type>
>             <prim-key-class> java.lang.String</prim-key-class>
>             <reentrant>False</reentrant>
>             <cmp-version>2.x</cmp-version>
>             <abstract-schema-name>EstadoAlarmaBean</abstract-schema- 
> name>
>             <cmp-field>
>                 <field-name>estadoAlarma</field-name>
>             </cmp-field>
>             <cmp-field>
>                 <field-name>estadoAlarmaGIA</field-name>
>             </cmp-field>
>             <primkey-field>estadoAlarma</primkey-field>
>             <query>
>                 <query-method>
>                     <method-name>findAll</method-name>
>                     <method-params/>
>                 </query-method>
>                 <ejb-ql>SELECT OBJECT(o) FROM EstadoAlarmaBean as o  
> ORDER BY
> o.estadoAlarma</ejb-ql>
>             </query>
>
> Try adding this to the <entity> element in your ejb-jar.xml.
> <resource-ref>
> <!-- JNDI name -->
> <res-ref-name>gsePool</res-ref-name>
> <!-- Object type expected back from JNDI lookup -->
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> I have not tested this.
>
I think this would be more appropriate if they were BMP entity  
beans.  For CMP beans which don't use a resource-ref I think you need  
to specify the datasource for the cmp engine using a cmp-connection- 
factory element following these schema bits:

     <xsd:element name="cmp-connection-factory"
         type="gernaming:resource-locatorType">
         <xsd:annotation>
             <xsd:documentation>
                 The element cmp-connection-factory defines the  
connection pool
                 which will be used by CMP entity beans to connect to  
datasource.
                 This element will be used by openejb specifications.
             </xsd:documentation>
         </xsd:annotation>
     </xsd:element>
     <xsd:complexType name="resource-locatorType">
         <xsd:sequence>
             <xsd:choice>
                 <xsd:element name="pattern"  
type="gernaming:patternType">
                     <xsd:annotation>
                         <xsd:documentation>
                             The element pattern is used to provide  
additional
                             selection criterion for resources if  
multiple
                             resources with same resource-name exists in
                             dependency modules. The pattern mapped  
should result
                             in single resource.
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:element>
                 <xsd:element name="resource-link" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
                             The element resource-link is used to  
identify the
                             JDBC, JMS, or JavaMail resource  
specified in all the
                             dependency modules. This name should  
match the
                             connectiondefination-instance/name  
defined in
                             resource adapter deployment descriptor.  
If the name
                             is not unique the pattern element will  
be used to
                             uniquely identify this resource.
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:element>
                 <xsd:element name="url" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
                             The element url is used to identify the  
resources of
                             type java.net.URL deployed in all the  
dependency
                             modules. If the url doesn't map to  
unique resource
                             the pattern element will be used to  
uniquely
                             identify this resource.
                         </xsd:documentation>
                     </xsd:annotation>
                 </xsd:element>
             </xsd:choice>
         </xsd:sequence>
     </xsd:complexType>


Something like
<cmp-connection-factory>
   <resource-link>gsePool</resource-link>
</cmp-connection-factory>

ought to work.  This would go right after the <environment> element  
in your openejb-jar.xml plan

thanks
david jencks


> HTH,
> Viet
>         </entity>
>    </enterprise-beans>
> </ejb-jar>
>
>
>
> --
> View this message in context: http://www.nabble.com/EJB-CMP-%2B- 
> Database-Pools-config-tf4682861s134.html#a13381206
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>
>


Mime
View raw message