Hi dinotoa,

ejb jars don't have separate moduleIds separate from the ear containing them. Your dependency needs to be on

                        <sys:groupId>Duel</sys:groupId>
                        <sys:artifactId>A</sys:artifactId>
                        <sys:version>2.0</sys:version>
                        <sys:type>car</sys:type>

at the ear level.

I think you may need some geronimo xml to indicate that the ejb-ref is to another ear -- just having the dependency worked for geronimo 1.x but I think the mechanism has changed a lot in openejb 3. I haven't set one of these up recently.

AFAIK you pretty much always need some vendor specific configuration for ejb refs outside an ear, whether done using annotations or xml. For intra-ear references all the annotations work fine without any extra configuration. If you disagree please provide more details.

thanks
david jencks

On Dec 1, 2008, at 11:13 AM, dinotoa wrote:


I have two different ears, ear A contains an ejb module and the following
geronimo-application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0 "
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2";
application-name="A">
        <sys:environment>
                <sys:moduleId>
                        <sys:groupId>Duel</sys:groupId>
                        <sys:artifactId>A</sys:artifactId>
                        <sys:version>2.0</sys:version>
                        <sys:type>car</sys:type>
                </sys:moduleId>
        </sys:environment>
        <module>
                <ejb>A.jar</ejb>
<openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb- jar-2.2"
                        
xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2";>
                        <sys:environment>
                                <sys:moduleId>
                                        <sys:groupId>Duel</sys:groupId>
                                        <sys:artifactId>A-Core</sys:artifactId>
                                        <sys:version>2.0</sys:version>
                                        <sys:type>jar</sys:type>
                                </sys:moduleId>
                        </sys:environment>
                </openejb-jar>
        </module>
</application>
according to the documentation found in
http://cwiki.apache.org/GMOxDOC21/referring-to-an-ejb-from-outside-its-ear.html
if I need to connect to an ejb using injection in the form:
@EJB(mappenName=...)
from a servlet contained in the ear B, I need to insert an explicit
dependency in the geronimo-application.xml of the ear B, in the form:

<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0 "
        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2";
        application-name="B">
        <sys:environment>
                <sys:moduleId>
                        <sys:groupId>Duel</sys:groupId>
                        <sys:artifactId>B</sys:artifactId>
                        <sys:version>2.0</sys:version>
                        <sys:type>car</sys:type>
                </sys:moduleId>
        </sys:environment>
        <module>
                <web>B-Web_2.0.war</web>
                <web-app 
xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1";>
                        <sys:environment>
                                <sys:moduleId>
                                        <sys:groupId>Duel</sys:groupId>
                                        <sys:artifactId>B-Web</sys:artifactId>
                                        <sys:version>1.0</sys:version>
                                        <sys:type>war</sys:type>
                                </sys:moduleId>
                                <sys:dependencies>
                                        <sys:dependency>
                                                <sys:groupId>Duel</sys:groupId>
                                                
<sys:artifactId>A-Core</sys:artifactId>
                                                <sys:version>2.0</sys:version>
                                                <sys:type>jar</sys:type>
                                        </sys:dependency>
                                </sys:dependencies>
                        </sys:environment>
                        <context-root>/duel/ima/gui</context-root>
                </web-app>
        </module>
</application>

when I deploy the second ear, the server complains that the dependent module A-Core.jar is not found, and indeed I cannot find it among the EJB- JARs in
the console.
What's wrong? Is there any example where this situation is described,
connecting using injections is really difficult in geronimo, you have to mess with the xml files, which is exactly what the EJB 3 specs were trying
to eliminate...
Any help is appreciated, thanks in advance
Antonio
--
View this message in context: 
http://www.nabble.com/Cannot-use-%40Ejb-inside-a-war-in-a-different-ear-tp20775244s134p20775244.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Reply via email to