geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Regarding Validation of plans during deployment
Date Mon, 28 Nov 2005 09:07:33 GMT

On Nov 28, 2005, at 12:14 AM, Manu George wrote:

> Hi,
>       In openejb-jar.xml file for a cmp entity bean if the 
> cmp-connection-factory element contains a name tag instead of a 
> resource-link tag the deployer deploys the ejb.
>  <cmp-connection-factory>
>        <name>DefaultDatasource</name>
>     </cmp-connection-factory>
> This is correct as per the schema but it gives a null pointer 
> exception on trying to call the EJB.The correct syntax from geronimo 
> wiki is
>  <cmp-connection-factory>
>         <application>null</application>
>         <module>org/apache/geronimo/DefaultDatabase</module>
>         <name>DefaultDatasource</name>
>     </cmp-connection-factory>
>  The schema is as follows
> <xsd:element name="cmp-connection-factory" 
> type="gernaming:resource-locatorType"/>
>    <xsd:complexType name="resource-locatorType">
>         <xsd:sequence>
>             <xsd:choice>
>                 <xsd:group ref="gernaming:objectNameGroup"/>
>                 <xsd:element name="resource-link" type="xsd:string"/>
>                 <xsd:element name="target-name" type="xsd:string"/>
>                 <xsd:element name="url" type="xsd:string"/>
>             </xsd:choice>
>         </xsd:sequence>
>     </xsd:complexType>
>         <xsd:group name="objectNameGroup">
>             <xsd:annotation>
>                 <xsd:documentation>This group contains the components

> of a jsr-77 object name</xsd:documentation>
>             </xsd:annotation>
>             <xsd:sequence>
>                 <xsd:element name="domain" type="xsd:string" 
> minOccurs="0"/>
>                 <xsd:element name="server" type="xsd:string" 
> minOccurs="0"/>
>                 <xsd:element name="application" type="xsd:string" 
> minOccurs="0"/>
>                 <xsd:element name="module" type="xsd:string" 
> minOccurs="0"/>
>                 <xsd:element name="type" type="xsd:string" 
> minOccurs="0"/>
>                 <xsd:element name="name" type="xsd:string"/>
>             </xsd:sequence>
>     </xsd:group>
>  Since application an module has minOccurs as 0 only the name 
> attribute is required.
>  My question is whether the syntax given below is valid? If so there 
> is some problem with the code .On the other hand if the syntax is 
> invalid then the schema needs to be modified.
>  <cmp-connection-factory>
>        <name>DefaultDatasource</name>
>     </cmp-connection-factory>

The format with resource-link does some gbean queries during the 
deployment process to look for a gbean matching a pattern including the 
specified name.  In order for deployment to work, the gbean has to be 
available during the deployment process.  As a result, it is difficult 
to make a scenario in which a successfully deployed resource-link won't 
work at runtime.

However, the format with the name components (name, module, 
application) assumes you know what you are doing and simply constructs 
the target gbean name according to your instructions.  Name parts you 
leave out match the current context.   There is no attempt whatsoever 
to verify that any such gbean exists at deployment time.  This is 
mostly useful if you are trying to set up circular references between 2 
modules, but might be useful at other times.

Now it is certainly possible to specify a (different) application, the 
same module name, and the name.  This would be an unusual situation but 
certainly possible.  It is also conceivable that you could deploy a 
gbean to act as the datasource in the ejb jar itself, in which case 
supplying only the name component would be correct.  However I think 
these are sufficiently unlikely so that I would not object to making 
the <module> element mandatory in this format.  Any other opinions?

david jencks

View raw message