Use of beans.xml for EJb archive
vicky.sharma Jun 18, 2011 11:15 PMI was testing EJB examples published in Enterprise JavaBeans 3.1 (from Oreilly) book. After lot of tweaking here and there, I got it running with JBoss AS 6.
One strange thing that I noticed is that even for EJB deployment, I had to add a beans.xml file in Ejb jar (as shown below).
@Deployment
public static JavaArchive createDeployment() throws MalformedURLException
{
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "firstejb.jar").addPackage(
CalculatorBeanBase.class.getPackage()).addAsManifestResource(EmptyAsset.INSTANCE,ArchivePaths.create("beans.xml"));
log.info(archive.toString(true));
return archive;
}
If I do not add this, then JBoss AS throws error at the time of deployment (See below..the highlighted lines):
08:26:02,093 WARN [org.jboss.ejb3.TimerServiceContainer] EJBTHREE-2193: using deprecated TimerServiceFactory for restoring timers
08:26:02,109 INFO [org.jboss.web.tomcat.service.deployers.TomcatDeployment] deploy, ctxPath=/test
08:26:02,968 INFO [org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher]
BeanManager cannot be located at java:comp/BeanManager. Either you are using an archive with no beans.xml, or the BeanManager has not been bound to that location in JNDI.
08:26:03,000 INFO [org.jboss.profileservice.management.upload.remoting.DeployHandler] invoke, payload: {DeploymentTargetID=names=[test.war], clientAddress=/127
------------- -------------------- -------------------- -------------------------- ----------------------- --------------- ------------------------ -----------------------------------------
My question is, do we need to add beans.xml for EJB deployment? I'm confused because the example published on Arquillian refernce doc doesn't add this file.
I'm attaching POM File, My EJB Bean class and IntegrationTest class for reference.
-
pom.xml 3.2 KB
-
CalculatorBeanBase.java.zip 1.3 KB