-
1. Re: Errai + CDI in an EAR bundled application, anybody done it?
heiko.braun Nov 30, 2010 3:53 AM (in response to tnfink)Your assumption is correct. The servlet entry point fails to locate the errai service (CDI bean in this case). It's most probably a classloading problem. Let me try to reproduce it.
-
2. Re: Errai + CDI in an EAR bundled application, anybody done it?
heiko.braun Nov 30, 2010 4:30 AM (in response to heiko.braun)It's a problem with the extension discovery: https://jira.jboss.org/browse/JBAS-8683
It seems that the CDI Extension is not being discovered when shipped as a web application inside an EAR.
I's similar to the problem Errai used to have in previous versions, but now resides with the CDI-AS integration.
For the time being, I cannot think of a workaround, except not using ear deployments.
-
3. Re: Errai + CDI in an EAR bundled application, anybody done it?
heiko.braun Nov 30, 2010 4:32 AM (in response to heiko.braun)1 of 1 people found this helpfulRegarding the stack trace: The CDI extension is not being discovered and executed, hence the Errai Servlet entry point fails to locate the Service, which is created when the CDI extension (as of portable extension, see spec) is being executed.
-
4. Re: Errai + CDI in an EAR bundled application, anybody done it?
tnfink Nov 30, 2010 3:53 PM (in response to tnfink)Thanks for the quick replies.
I
- moved the CDI extension and the errai-bus library from the war to the lib directory of the ear
- created a new configuration jar containing the ErrayService.properties and also put it into the EAR lib directory (BTW I had to move the properties file to a org/jboss/errai/bus subdirectory. Otherwise Errai did not find it.)
The CDI extension is now starting up. But it crashes when it tries to register a MessageCallback for a service of mine:
21:36:09,693 INFO [org.jboss.errai.bus.server.service.bootstrap.BootstrapContext] Running deferred bootstrap tasks ...
21:36:09,702 INFO [org.jboss.errai.bus.server.service.bootstrap.OrderedBootstrap] Bootstrap complete. Ready to rumble!
21:36:09,726 INFO [org.jboss.errai.cdi.server.CDIExtensionPoints] Register MessageCallback: public@Service @ApplicationScoped class de.evento.server.UserServiceImpl
21:36:09,726 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=vfs:///Applications/Entwicklung/JBoss/jboss/jboss-6.0.0.20101110-CR1/server/default/deploy/evento-ear-0.1-SNAPSHOT.ear_WeldBootstrapBean state=Create: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:
Exception 0 :
org.jboss.weld.exceptions.IllegalArgumentException: WELD-001324 Argument bean must not be null
at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:693)
at org.jboss.errai.cdi.server.Util.lookupCallbackBean(Util.java:45)
at org.jboss.errai.cdi.server.CDIExtensionPoints.subscribeServices(CDIExtensionPoints.java:198)
at org.jboss.errai.cdi.server.CDIExtensionPoints.afterBeanDiscovery(CDIExtensionPoints.java:172)
at org.jboss.errai.cdi.server.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Applications$Entwicklung$JBoss$jboss$jboss-6$0$0$20101110-CR1$server$default$deploy$eventkoordination-ear-0$1-SNAPSHOT$ear"-Built-in-Extension-org$jboss$errai$cdi$server$CDIExtensionPoints_$$_WeldClientProxy.afterBeanDiscovery(org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Applications$Entwicklung$JBoss$jboss$jboss-6$0$0$20101110-CR1$server$default$deploy$eventkoordination-ear-0$1-SNAPSHOT$ear"-Built-in-Extension-org$jboss$errai$cdi$server$CDIExtensionPoints_$$_WeldClientProxy.java)
Thus, it seems that Weld forwards my CDI-Bean (UserServiceImpl) to the Errai-CDI-extension. But, when the Erray-CDI-extension tries to access/create my bean, Weld has problems.
I will look at it again, when I find some more spare time :-)
21:36:09,693 INFO [org.jboss.errai.bus.server.service.bootstrap.BootstrapContext] Running deferred bootstrap tasks ...21:36:09,702 INFO [org.jboss.errai.bus.server.service.bootstrap.OrderedBootstrap] Bootstrap complete. Ready to rumble!21:36:09,726 INFO [org.jboss.errai.cdi.server.CDIExtensionPoints] Register MessageCallback: public@Service @ApplicationScoped class de.everythingmobile.eventkoordination.server.UserServiceImpl21:36:09,726 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=vfs:///Applications/Entwicklung/JBoss/jboss/jboss-6.0.0.20101110-CR1/server/default/deploy/eventkoordination-ear-0.1-SNAPSHOT.ear_WeldBootstrapBean state=Create: org.jboss.weld.exceptions.DefinitionException: Exception List with 1 exceptions:Exception 0 :org.jboss.weld.exceptions.IllegalArgumentException: WELD-001324 Argument bean must not be nullat org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:693)at org.jboss.errai.cdi.server.Util.lookupCallbackBean(Util.java:45)at org.jboss.errai.cdi.server.CDIExtensionPoints.subscribeServices(CDIExtensionPoints.java:198)at org.jboss.errai.cdi.server.CDIExtensionPoints.afterBeanDiscovery(CDIExtensionPoints.java:172)at org.jboss.errai.cdi.server.org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Applications$Entwicklung$JBoss$jboss$jboss-6$0$0$20101110-CR1$server$default$deploy$eventkoordination-ear-0$1-SNAPSHOT$ear"-Built-in-Extension-org$jboss$errai$cdi$server$CDIExtensionPoints_$$_WeldClientProxy.afterBeanDiscovery(org$jboss$weld$bean-jboss$classloader:id="vfs:$$$Applications$Entwicklung$JBoss$jboss$jboss-6$0$0$20101110-CR1$server$default$deploy$eventkoordination-ear-0$1-SNAPSHOT$ear"-Built-in-Extension-org$jboss$errai$cdi$server$CDIExtensionPoints_$$_WeldClientProxy.java)
-
5. Re: Errai + CDI in an EAR bundled application, anybody done it?
heiko.braun Dec 6, 2010 7:43 AM (in response to tnfink)1 of 1 people found this helpful -
6. Re: Errai + CDI in an EAR bundled application, anybody done it?
tnfink Dec 6, 2010 8:39 AM (in response to heiko.braun)Thanks for the link.
For me it seems that there are still some tasks open to use CDI inside an EAR.
I looked at my problem a little bit more closely. The Erray-extension is detected and it detects the @Service tagged CDI components inside the WAR. But, then it can not access them.
I stopped now my EAR-test and try to use a WAR with separated EJB and JPA modules. This would still give me modularity on the build level.
-
7. Re: Errai + CDI in an EAR bundled application, anybody done it?
heiko.braun Dec 6, 2010 8:45 AM (in response to tnfink)I looked at my problem a little bit more closely. The Erray-extension is detected and it detects the @Service tagged CDI components inside the WAR. But, then it can not access them.
you mean, when you move around the libraries, right? but not with the default setup (WEB-INF/lib inside EAR). Or am I wrong?
-
8. Re: Errai + CDI in an EAR bundled application, anybody done it?
heiko.braun Dec 6, 2010 8:47 AM (in response to heiko.braun)As you can see from the discussions, this has been a dark spot in the CDI spec, which should have been clarified in more recent versions of the specifications. The Weld team is currently looking into this. Until then I suggest you stick to the war deployment, as you already said.
-
9. Re: Errai + CDI in an EAR bundled application, anybody done it?
tnfink Dec 6, 2010 9:39 AM (in response to heiko.braun)yes, I had to move all the libraries quite a lot, to get it to work, or at least to nearly work.
-
10. Re: Errai + CDI in an EAR bundled application, anybody done it?
kaefert Feb 8, 2013 8:42 AM (in response to tnfink)Hi there!
I am looking for the same thing as what you posted in your original question (an errai project packaged with other things like an ejb project into an ear package)
My original problem is that I wanted to separate my entities from my gwt project, without having to list them in the persistence.xml file.
But I found that this doesn't seem to work (see the answer to http://stackoverflow.com/questions/4433341/what-is-the-right-path-to-refer-a-jar-file-in-jpa-persistence-xml-in-a-web-app)
Now I wanted to dive into the whole jboss application server universe to solve this problem for myself. I found that there is a beautiful java ee + ear sample that has a multi project setup with seperated ear, ejb and web projects, and I found that there are really nice errai samples, but which are all single-project setups. I've not managed to mix those together to a working multi project setup with a gwt app that uses the beans of the ejb project yet, although I'm already trying for a few weeks..
I've found these quite old blog posts that describe the process, but I didn't mange to get those run with current versions of the involved projects either.
http://www.javacodegeeks.com/2010/09/gwt-ejb3-maven-jboss-51-integration.html
http://jamies-gwt.blogspot.co.at/2010/03/walkthrough-integrating-gwt-with-jboss.html
http://code.google.com/p/gwt-ejb-sample/
It would be great if anyone else who has tried this or thought about it could tell me about it.