-
1. Re: WebApp WAR to define/deploy MBean through jboss-service.xml
pmm Oct 14, 2013 11:58 AM (in response to kaja.mohideen)Are you using EAR packaging? If you have you considered replacing the service mbeans with EJBs and making a "skinny" WARs (moving the inferface JAR to the lib/ folder in the EAR)?
-
2. Re: WebApp WAR to define/deploy MBean through jboss-service.xml
kaja.mohideen Oct 14, 2013 12:56 PM (in response to pmm)No. Im not packing my war inside ear. What is the best way to do what im trying to do? I know sar can easily achieve this mbean stuff, but im bit skeptical about selecting jboss specific thing. Please suggest best practice.
-
3. Re: Re: WebApp WAR to define/deploy MBean through jboss-service.xml
pmm Oct 15, 2013 6:04 AM (in response to kaja.mohideen)1 of 1 people found this helpfulThere used to be mainly two reasons for having JBoss service MBeans: Having only a single instance and eager stat up. Both can now be solved with an EJB and
@Singleton
and@Startup
. However in order to only get one instance across multiple WARs all the WARs need to be in a single EAR file. In addition the EJB needs to be in an EJB JAR in the EAR (in theory it could also be in a WAR). The service interfaces for the EJB need to be in a JAR in the lib folder of the EAR — it must not be in the WEB-INF/lib folder of any WAR. In addition you can move common JARs between WARs to the lib/ folder in the EAR as well. So an EAR would look like this:application.ear +- service-ejb.jar // the service EJB is here +- webapp1.war +- webapp2.war \- lib/ \- service-interface.jar // the service interfaces are here
The easiest way to implement this is using a build system like maven and the maven-ear-plugin.
-
4. Re: WebApp WAR to define/deploy MBean through jboss-service.xml
rhanus Oct 15, 2013 6:52 AM (in response to pmm)right and dependency between ejb singletons can be defined by annotation @DependsOn
-
5. Re: WebApp WAR to define/deploy MBean through jboss-service.xml
kaja.mohideen Oct 15, 2013 11:14 AM (in response to pmm)I have created an ear project and my war is placed inside it as skinny war. But, I don't want to use EJB, due to the fact that I don't really have multiple Interfaces to expose the state of services provided by my webapps. I just have one interface & an implementation; which i'm planning to instantiate with different properties using jboss-service.xml inside my wars.
I have included the jboss-service.xml inside WEB-INF/ of my war. But, that mbean is not registered. Do I have to define a jboss-app.xml or anything extra for using my jboss-service.xml & register my mbeans?
Thanks & regards,
Kaja
-
6. Re: WebApp WAR to define/deploy MBean through jboss-service.xml
rhanus Oct 16, 2013 4:42 AM (in response to kaja.mohideen)I just have one interface & an implementation; which i'm planning to instantiate with different properties using jboss-service.xml inside my wars.
I would code a CDI bean per war archive implementing your interface along with a qualifier annotation. If you turn off ear subdeployments isolation the container injects any kind of qualified bean from whatever war. Injecting beans resolves your dependencies but you may suffer from circular dependency problem....