Jaikiran, I just tried the @Service notation:
| package ae; | | import javax.annotation.Resource; | import javax.ejb.TransactionAttribute; | import javax.ejb.TransactionAttributeType; | | import org.apache.log4j.Logger; | import org.jboss.ejb3.annotation.Depends; | import org.jboss.ejb3.annotation.Management; | import org.jboss.ejb3.annotation.Service; | | @Service | @Management(MasterMBean.class) | @Depends( { "jboss.j2ee:jar=SubEJB.jar,name=CalculatorBean,service=EJB3" }) | public class Master implements MasterMBean { | | private static final Logger log = Logger.getLogger(Master.class); | | @EJB(mappedName = Calculator.JNDI_NAME) | private Calculator additionBean; | | @TransactionAttribute(TransactionAttributeType.NEVER) | public void start() throws Exception { | log.info("### starting"); | | if (additionBean == null) { | log.error("### unable to inject CalculatorBean!!!"); | return; | } | | long result = additionBean.add(new int[] { 1, 2, 3 }); | log.info(result); | | // TODO use a quartz job to run a calculation every 5 seconds! | } | | public void stop() { | log.info("### stopping"); | } | } | After removing the master-mbean-jboss.xml and deploying the SAR into server/all/deploy-hasingleton, the Injection worked pretty fine! But the old approach still does not work. Can you tell me why? Another thing: as you can see, I had to annotate the start() method, because I got an Exception: anonymous wrote : | 14:54:06,031 INFO [ConnectionFactory] org.jboss.jms.server.connectionfactory.connectionfact...@1e287e5 started | 14:54:06,031 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA' | 14:54:06,093 INFO [TomcatDeployment] deploy, ctxPath=/, vfsUrl=ROOT.war | 14:54:06,156 INFO [TomcatDeployment] deploy, ctxPath=/jmx-console, vfsUrl=jmx-console.war | 14:54:06,265 INFO [JBossASKernel] Created KernelDeployment for: SubEJB.jar | 14:54:06,265 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=SubEJB.jar,name=CalculatorBean,service=EJB3 | 14:54:06,265 INFO [JBossASKernel] with dependencies: | 14:54:06,265 INFO [JBossASKernel] and demands: | 14:54:06,265 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService | 14:54:06,265 INFO [JBossASKernel] and supplies: | 14:54:06,265 INFO [JBossASKernel] jndi:AECalculator | 14:54:06,265 INFO [JBossASKernel] jndi:CalculatorBean/remote-ae.Calculator | 14:54:06,265 INFO [JBossASKernel] Class:ae.Calculator | 14:54:06,265 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=SubEJB.jar,name=CalculatorBean,service=EJB3) to KernelDeployment of: SubEJB.jar | 14:54:06,375 INFO [SessionSpecContainer] Starting jboss.j2ee:jar=SubEJB.jar,name=CalculatorBean,service=EJB3 | 14:54:06,390 INFO [EJBContainer] STARTED EJB: ae.CalculatorBean ejbName: CalculatorBean | 14:54:06,437 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI: | | AECalculator - EJB3.x Default Remote Business Interface | CalculatorBean/remote-ae.Calculator - EJB3.x Remote Business Interface | | 14:54:06,593 INFO [EJBContainer] STARTED EJB: ae.Master ejbName: Master | 14:54:06,609 INFO [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI: | | | 14:54:06,625 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=master.sar,name=Master,service=EJB3,type=ManagementInterface | 14:54:06,625 INFO [JBossASKernel] with dependencies: | 14:54:06,625 INFO [JBossASKernel] and demands: | 14:54:06,625 INFO [JBossASKernel] jndi:AECalculator | 14:54:06,625 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService | 14:54:06,625 INFO [JBossASKernel] jboss.j2ee:jar=SubEJB.jar,name=CalculatorBean,service=EJB3 | 14:54:06,625 INFO [JBossASKernel] and supplies: | 14:54:06,625 INFO [JBossASKernel] jndi:Master/remote | 14:54:06,625 INFO [JBossASKernel] Class:ae.MasterMBean | 14:54:06,625 INFO [JBossASKernel] Installing bean(jboss.j2ee:jar=master.sar,name=Master,service=EJB3,type=ManagementInterface) into kernel | 14:54:06,640 INFO [Master] ### starting | 14:54:06,687 ERROR [ServiceContainer] Encountered an error in start of Master | java.lang.RuntimeException: Problem registering @Management interface for @Service class ae.Master | at org.jboss.ejb3.service.ServiceContainer.registerManagementInterface(ServiceContainer.java:727) | [...] | at java.lang.Thread.run(Thread.java:595) | Caused by: java.lang.RuntimeException: javax.management.MBeanException | at org.jboss.ejb3.deployers.JBossASKernel.installMBean(JBossASKernel.java:181) | at org.jboss.ejb3.service.ServiceContainer.registerManagementInterface(ServiceContainer.java:699) | ... 50 more | Caused by: javax.management.MBeanException | at org.jboss.ejb3.service.ServiceMBeanDelegate.invoke(ServiceMBeanDelegate.java:219) | at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668) | at org.jboss.ejb3.deployers.JBossASKernel.invokeOptionalMethod(JBossASKernel.java:287) | at org.jboss.ejb3.deployers.JBossASKernel.installMBean(JBossASKernel.java:177) | ... 51 more | Caused by: javax.ejb.EJBException: java.lang.RuntimeException: cannot import a transaction context when a transaction is already associated with the thread | at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77) | at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83) | at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) | at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) | at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) | Why is that, actually? I don't have any problems when looking up the bean manually Greetings, Andre View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4204993#4204993 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4204993 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user