Embedded JBoss and MBeans
silenius Nov 5, 2008 1:49 PMI've managed to get the Embedded JBoss deploy my EJBs successfully.
Here are my configurations:
Maven Surefire plugin:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.3</version> <configuration> <excludes> <exclude>**/BaseTest.java</exclude> </excludes> <!-- for JDK6 Support --> <argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true</argLine> <additionalClasspathElements> <additionalClasspathElement>${project.build.testOutputDirectory}/bootstrap</additionalClasspathElement> </additionalClasspathElements> </configuration> </plugin>
Maven Embedded JBoss dependencies:
<dependency> <groupId>org.jboss.embedded</groupId> <artifactId>jboss-embedded-all</artifactId> <version>beta3.SP2</version> <exclusions> <exclusion> <groupId>org.jboss.embedded</groupId> <artifactId>jboss-embedded</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.jboss.embedded</groupId> <artifactId>hibernate-all</artifactId> <version>beta3.SP2</version> </dependency> <dependency> <groupId>org.jboss.embedded</groupId> <artifactId>thirdparty-all</artifactId> <version>beta3.SP2</version> </dependency> <dependency> <groupId>org.jboss.embedded</groupId> <artifactId>jboss-embedded</artifactId> <version>beta3.SP2</version> <!--exclusions> <exclusion> <groupId>org.jboss.microcontainer</groupId> <artifactId>jboss-deployers-client-spi</artifactId> </exclusion> </exclusions--> </dependency> <dependency> <groupId>jboss</groupId> <artifactId>jboss-annotations-ejb3</artifactId> <version>4.2.3.GA</version> </dependency>
I need the jboss-annotations-ejb3 dependency so I can use the @LocalBinding(jndiBinding = "MyService") annotation.
But even with this dependency I have to lookup my Bean like this:
InitialContext ctx = new InitialContext(); service = (MyService) ctx.lookup("MyServiceBean/local");
Like the JBoss AS, it should work like this instead:
InitialContext ctx = new InitialContext(); service = (MyService) ctx.lookup("MyService");
OK, I can live with this.
But one thing I can't get to work is to deploy my MBeans with the Embedded JBoss.
I'm using the following annotations:
@Service(objectName = "com.foo.bar:service=MyOtherService") @Management(MyOtherService.class)
In my EJBs I locate the MBeans like this:
MBeanServer server = MBeanServerLocator.locate(); myOtherService= (MyOtherService) MBeanProxyExt.create(MyOtherService.class, "com.foo.bar:service=MyOtherService", server);
This works fine with JBoss AS and Embeddable EJB 3.0.
I'm getting it wrong?
Does Embedded JBoss support MBeans?
Thanks for your help.
--
Samuel Santos