ok got it first before going through your sample your deployment id broken (deployment the same class in lib + apps hoping it will be the same localbean is assured with no guarantee (it works by side effect). That's said i don't get why an ear is a pain since you have to restart the container whatever the part of the app your update, no?
then i don't understand why it doesn't work for you? it works for me :p ok ok, joking (https://issues.apache.org/jira/browse/TOMEE-658) then the issue was pretty easy: EJB have their own jndi context while all other beans uses the webapp one and in the webapp one global is merged Honestly i'm not sure it is a bug regarding JavaEE 6 or not (IIRC global names can be local to an app :s) but in all cases it should work now (since i find it more or less logical as usage) hope it doesn't break any TCK otherwise i'll need to revert it 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]>: > 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* > -------------------------------------------------------------------
