users@glassfish.java.net

RE: Accessing an EJB in an ear from a war

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Thu, 27 Dec 2012 10:58:17 -0500

java:global[/application name]/module name/enterprise bean name[/interface name]
Application name and module name default to the name of the application and
module minus the file extension.
Application names are required only if the
application is packaged within an EAR. The interface name is required only if
the enterprise bean implements more than one business interface.
java:global/VirtualWeb/Ejb1

Ejb1 is not packaged within an application so application-name identifier is un-necessary
There is not more than one business interface so interface-name identifier is un-necessary
http://docs.oracle.com/javaee/6/tutorial/doc/gipjf.html Klar?
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

> To: users_at_glassfish.java.net
> Subject: Accessing an EJB in an ear from a war
> From: forums_at_java.net
> Date: Thu, 27 Dec 2012 07:51:07 -0600
>
> Hi everyone, we have the following scenario, please bear with the lengthy
> explanation! We are running Glassfish 3.1.2 and we do development in
> Netbeans. We have TestEar.ear containing TestWeb.war and TestEjb.jar which
> contains some stateless session beans. Then we have VirtualWeb.war which we
> deploy to the same Glassfish instance but a separate virtual server.
> VirtualWeb.war needs to access the EJBs in TestEjb.jar (in the ear). We add
> TestEjb.jar to the libraries of VirtualWeb.war so that it can compile. From
> within VirtualWeb.war, we try to lookup a reference to an EJB (say Ejb1)
> using the JNDI name "java:global/TestEar/TestEjb/Ejb1", however this fails.
> If we instead lookup "java:global/VirtualWeb/Ejb1", this works. This means
> that separate EJB components are created when deploying VirtualWeb.war. How
> can this be prevented? All we want to do is access the already deployed EJBs
> in TestEar.ear. Any help would be appreciated!
>
> --
>
> [Message sent by forum member 'chris1234']
>
> View Post: http://forums.java.net/node/893478
>
>