Im using: apache-tomee-1.5.2-20121219.041507-6-webprofile.zip
2012/12/19 José Luis Cetina <[email protected]> > Hi Romain the lookup now is working from webapp to ejbmodule. > > As you told me i have to use 1.5.2-SNAPSHOT for this. > > When i deploy my ebjmodule in apps folder i always see this: > > INFO: OpenWebBeans Container is starting... > Dec 19, 2012 11:06:26 AM org.apache.openejb.assembler.classic.Assembler > destroyApplication > INFO: Undeploying app: > /home/maxtorzito/tomee/apache-tomee-webprofile-1.5.2-SNAPSHOT_19-12-2012/apps/myejbmodule-1.0-SNAPSHOT.jar > Dec 19, 2012 11:06:26 AM org.apache.openejb.assembler.classic.Assembler > buildContainerSystem > SEVERE: Application could not be deployed: > > /home/maxtorzito/tomee/apache-tomee-webprofile-1.5.2-SNAPSHOT_19-12-2012/apps/myejbmodule-1.0-SNAPSHOT.jar > org.apache.openejb.OpenEJBException: Creating application failed: > /home/maxtorzito/tomee/apache-tomee-webprofile-1.5.2-SNAPSHOT_19-12-2012/apps/myejbmodule-1.0-SNAPSHOT.jar: > loader (instance of org/apache/catalina/loader/StandardClassLoader): > attempted duplicate class definition for name: > "org/apache/openejb/cdi/CdiPlugin" > at > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:823) > at > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:534) > at > org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:433) > at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:341) > at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144) > at org.apache.openejb.OpenEJB.init(OpenEJB.java:290) > at > org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:233) > at org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:130) > at > org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:121) > at > org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) > at > org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) > at > org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402) > at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110) > at org.apache.catalina.startup.Catalina.load(Catalina.java:633) > at org.apache.catalina.startup.Catalina.load(Catalina.java:658) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:601) > at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281) > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450) > Caused by: java.lang.LinkageError: loader (instance of > org/apache/catalina/loader/StandardClassLoader): attempted duplicate > class definition for name: "org/apache/openejb/cdi/CdiPlugin" > at java.lang.ClassLoader.defineClass1(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:791) > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) > at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) > at java.net.URLClassLoader.access$100(URLClassLoader.java:71) > at java.net.URLClassLoader$1.run(URLClassLoader.java:361) > at java.net.URLClassLoader$1.run(URLClassLoader.java:355) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:354) > at java.lang.ClassLoader.loadClass(ClassLoader.java:423) > at java.lang.ClassLoader.loadClass(ClassLoader.java:410) > at java.lang.ClassLoader.loadClass(ClassLoader.java:356) > at > org.apache.openejb.cdi.OptimizedLoaderService.loadWebBeansPlugins(OptimizedLoaderService.java:87) > at > org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:57) > at > org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:51) > at org.apache.webbeans.plugins.PluginLoader.startUp(PluginLoader.java:75) > at > org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:159) > at > org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:150) > at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:44) > at > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:711) > ... 20 more > > Dec 19, 2012 11:06:26 AM org.apache.openejb.assembler.classic.Assembler > createApplication > INFO: Assembling app: openejb > Dec 19, 2012 11:06:26 AM org.apache.openejb.util.OptionsLog info > INFO: Using > 'openejb.jndiname.format={deploymentId}{interfaceType.openejbLegacyName}' > Dec 19, 2012 11:06:26 AM org.apache.openejb.assembler.classic.JndiBuilder > bind > > > 2012/12/18 José Luis Cetina <[email protected]> > >> Ok, i could access setting in context-root tag the context that i want. >> >> >> 2012/12/17 Romain Manni-Bucau <[email protected]> >> >>> right but you can specify the url in the application.xml >>> >>> then it should be in the logs under the lines >>> ---------------------------- >>> >>> Romain Manni-Bucau >>> Twitter: @rmannibucau >>> Blog: http://rmannibucau.wordpress.com/ >>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>> Github: https://github.com/rmannibucau >>> >>> >>> >>> 2012/12/17 José Luis Cetina <[email protected]>: >>> > Ok, thanks. >>> > >>> > I deploy my ear manually but how can i acces to my webapp? i mean what >>> url >>> > i have to use? in tomee (tomcat) manager my ear/war inst in the list i >>> > guess because is an ear file. >>> > >>> > >>> > 2012/12/17 Romain Manni-Bucau <[email protected]> >>> > >>> >> they said yes (jar, war, ear) but personally i never deploy through an >>> >> IDE so not sure sorry :s >>> >> >>> >> Romain Manni-Bucau >>> >> Twitter: @rmannibucau >>> >> Blog: http://rmannibucau.wordpress.com/ >>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>> >> Github: https://github.com/rmannibucau >>> >> >>> >> >>> >> >>> >> 2012/12/17 José Luis Cetina <[email protected]>: >>> >> > Romain is IntellijIDEA fun integration with TomEE? I mean can >>> >> IntellijIDEA >>> >> > can run ear "apps" in TomEE. >>> >> > >>> >> > I cant do that with netbeans, because netbeans dont recognize TomEE >>> as a >>> >> > JEE6 App Server, and this is a problem to me, because i need to use >>> an >>> >> ear >>> >> > but i have to deploy the file manually and in production environment >>> >> thats >>> >> > a problem because when we do some changes in xhtml files we have to >>> >> > "redeploy" the ear file. >>> >> > >>> >> > >>> >> > 2012/12/15 José Luis Cetina <[email protected]> >>> >> > >>> >> >> I will consider seriously to use an ear. I think will be more easy. >>> >> >> >>> >> >> The only inconvenient is that netbeans dont recognize tomee as a >>> full >>> >> jee >>> >> >> 6 app server and dont permit to deploy ear files with tomee. >>> >> >> >>> >> >> I will have run a little plugin that i did for copy the ear file >>> to apps >>> >> >> folder. >>> >> >> >>> >> >> I hope some day netbeans can have full tomee support. >>> >> >> El dic 15, 2012 2:49 PM, "Romain Manni-Bucau" < >>> [email protected]> >>> >> >> escribió: >>> >> >> >>> >> >> well it works because the classloader of apps/yourjar will >>> delegate to >>> >> >>> lib but that's just a side effect IMO (would be wrong for a >>> webapp). >>> >> >>> >>> >> >>> the fix will be tomorrow in tomee 1.5.2-SNAPSHOT >>> >> >>> >>> >> >>> about the ear...after the first start it will be unpacked then >>> webapp >>> >> >>> will be unpacked too so finally what do you have? all is exploded >>> and >>> >> >>> match your need ;). You can even create this fake hierarchy >>> yourself, >>> >> >>> just ensure you have an application.xml >>> >> >>> >>> >> >>> does it match better your need this way? >>> >> >>> >>> >> >>> 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]>: >>> >> >>> > As a note you recommend to me to drop my jar file to apps and >>> to lib. >>> >> >>> > >>> >> >>> > Do you have any other advice? >>> >> >>> > >>> >> >>> > >>> >> >>> > 2012/12/15 José Luis Cetina <[email protected]> >>> >> >>> > >>> >> >>> >> I have 3 different's webapps and each of them need the same >>> EJB's, i >>> >> >>> dont >>> >> >>> >> want to deploy as ear because when i have to some change in one >>> >> webapp >>> >> >>> i >>> >> >>> >> will have to deploy the ear entirely, am i okay? >>> >> >>> >> >>> >> >>> >> When the fix will be in repo?? >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> 2012/12/15 Romain Manni-Bucau <[email protected]> >>> >> >>> >> >>> >> >>> >>> 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* >>> >> >>> >>> > >>> >> ------------------------------------------------------------------- >>> >> >>> >>> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> >>> >> -- >>> >> >>> >> >>> ------------------------------------------------------------------- >>> >> >>> >> *SCJA. José Luis Cetina* >>> >> >>> >> >>> ------------------------------------------------------------------- >>> >> >>> >> >>> >> >>> >> >>> >> >>> > >>> >> >>> > >>> >> >>> > -- >>> >> >>> > >>> ------------------------------------------------------------------- >>> >> >>> > *SCJA. José Luis Cetina* >>> >> >>> > >>> ------------------------------------------------------------------- >>> >> >>> >>> >> >> >>> >> > >>> >> > >>> >> > -- >>> >> > ------------------------------------------------------------------- >>> >> > *SCJA. José Luis Cetina* >>> >> > ------------------------------------------------------------------- >>> >> >>> > >>> > >>> > >>> > -- >>> > ------------------------------------------------------------------- >>> > *SCJA. José Luis Cetina* >>> > ------------------------------------------------------------------- >>> >> >> >> >> -- >> ------------------------------------------------------------------- >> *SCJA. José Luis Cetina* >> ------------------------------------------------------------------- >> >> > > > -- > ------------------------------------------------------------------- > *SCJA. José Luis Cetina* > ------------------------------------------------------------------- > > -- ------------------------------------------------------------------- *SCJA. José Luis Cetina* -------------------------------------------------------------------
