Hi Romain here is the example:

http://www.mediafire.com/?hz8s0b79hp4w92n

Inside of the zip you will see 2 maven projects, 1 is a ejbmodule (jar) and
the other a webapp module with servlets.

If i do a lookup from servlet to my ejb this works, but if a call an ejb
(ejb module) from another ejb in my webapp this not work, you can see the
example.

I copy my ejb module jar to apps and lib then i deploy my webapp to test.

Thanks, i dont know what is happend


2012/12/15 Romain Manni-Bucau <[email protected]>

> Hi,
>
> can you share a sample please (with a servlet to show it "doesnt work")?
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2012/12/15 José Luis Cetina <[email protected]>:
> > I have this scenario:
> >
> > 1. EJB Module deployed in apps folder ex: MyEJB.java is a stateless EJB
> > and doesn't implement any interface.
> > 2. Web app (JSF+EJB) deployed in webapps folder.
> > 3. All in the same server
> >
> > When i want to lookup an EJB from any managedbean i do this:
> >
> > String lookUp = "java:global/myEJBModuleName/MyEJB!com.test.MyEJB";
> > MyEJB myObject = (MyEJB) InitialContext.doLookup(lookUp);
> >
> > And it works.
> >
> > But when i try to do the same (lookup, same code above) inside of any EJB
> > that resides in my webapp i always get a
> > NameNotFoundException.
> >
> >
> > Debuging my project i can see the nex:
> >
> > When i iterate from any managedbean, i can see my EJB Module, but when i
> do
> > the same from an EJB (that is located in webapp) i cant.
> >
> > //This only works when i execute it from managedbean but not in an EJB
> > (from my webapp)
> >         InitialContext ctx = new InitialContext();
> >         NamingEnumeration<NameClassPair> list2 =
> > ctx.list("java:global/myEJBModuleName");
> >         while (list2.hasMore()) {
> >             NameClassPair next = list2.next();
> >             System.out.println(next.getName());
> >         }
> >
> > Why i cant find my ejbmodule from EJB that is residing in my webapp???
> Do i
> > have to do something different in EJB?
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Reply via email to