geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janko Heilgeist <janko.heilge...@rzg.mpg.de>
Subject Re: Use of a GBean from a Message EJB
Date Wed, 09 Jul 2008 10:34:05 GMT
Jacek Laskowski wrote:
> On Tue, Jul 1, 2008 at 1:40 PM, dsthode
> <damian.serrano@juntadeandalucia.es> wrote:
> 
>> I've followed your advice and changed the default namespace to openejb
>> version 2.2 and added a <pattern> element for the <gbean-ref> resolution,
>> but Geronimo keeps failing on deployment with the message that <ref-name> is
>> not in geronimo-namespace-1.2 schema but in
>> http://openejb.apache.org/xml/ns/openejb-jar-2.2, even though you can open
>> geronimo-naming-1.2 and find <ref-name> defined in this schema.
> 
> Did you happen to sort it out? What was the solution?
> 
> Jacek
> 

Hi,

I think I've traced the problem to a bug in OpenEJB:

OpenEJB forces the namespace of the tags <ref-name> and <ref-type> to 
"http://geronimo.apache.org/xml/ns/naming-1.2" in 
container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/NamespaceFilter.java 
regardless of the namespace specified in the openejb-jar.xml deployment 
descriptor. On the other hand the "namespace" attributes in the 
@XmlElement annotations in 
container/openejb-jee/src/main/java/org/apache/openejb/jee/oejb2/GbeanRefType.java
are missing for these variables and therefore during the parsing of the 
deployment descriptor the wrong default namespace of 
"http://openejb.apache.org/xml/ns/openejb-jar-2.2" is expected. The 
patch attached to this mail fixes this by adding the missing attributes.

I used my patched version of OpenEJB with Geronimo to access a GBean 
from a stateless EJB:

openejb-jar.xml:
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.2">
	<enterprise-beans>
		<session>
			<ejb-name>DummyEJB</ejb-name>
			<gbean-ref>
				<ref-name>LocalGBeanName</ref-name>
				<pattern>
					<name>GlobalGBeanName</name>
				</pattern>
			</gbean-ref>
		</session>
	</enterprise-beans>
</openejb-jar>

geronimo-application.xml:
[...]
<sys:gbean name="GlobalGBeanName"
class="com.heilgeist.tests.tst_geronimo_gbean.gbean.TheGBeanClass"/>
[...]

Inside a @PostConstruct of the EJB class:
[...]
InitialContext ic = new InitialContext();
this.theGBean = (TheGBeanClass)
	ic.lookup("java:comp/geronimo/env/LocalGBeanName");
[...]

Everything deploys without any errors and the EJB can correctly access 
the GBean and call methods of the GBean. There doesn't seem to be a way 
to actually inject the GBean with something like a @Resource annotation. 
Is this supposed to work or can GBeans only be injected into an EJBs 
JNDI environment and have to be looked up manually?

Anyway, this should fix most of Damians original problems.

Janko

Mime
View raw message