• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using EJB annotation

 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use EJB annotaton, but it throws an exception.


Exception:
22:32:48,656 INFO [EJBContainer] STOPPED EJB: com.ejb3inaction.actionbazaar.buslogic.StatelessBean ejbName: StatelessBean
22:32:48,656 WARN [ServiceController] Problem starting service jboss.j2ee:ear=myEJB.ear,jar=myEJB-ejb.jar,name=StatelessBean,service=EJB3
java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container StatelessBean: reference class: com.ejb3inaction.actionbazaar.buslogic.WelcomeBean ejbLink: not used by any EJBs
at org.jboss.injection.EjbEncInjector.inject(EjbEncInjector.java:88)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:570)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:154)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at org.jboss.Main$1.run(Main.java:508)
at java.lang.Thread.run(Thread.java:595)
22:32:48,671 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
22:32:48,671 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=myEJB.ear,jar=myEJB-ejb.jar,name=WelcomeBean,service=EJB3 with dependencies:
22:32:48,687 INFO [EJBContainer] STARTED EJB: com.ejb3inaction.actionbazaar.buslogic.WelcomeBean ejbName: WelcomeBean
22:32:48,796 INFO [EJB3Deployer] Deployed: file:/E:/DJ/Java Certifications/SCBCD/eBooks/Application Servers/JBOSS/jboss-4.2.3.GA/server/default/tmp/deploy/tmp59087myEJB.ear-contents/myEJB-ejb.jar
22:32:48,796 INFO [EARDeployer] Started J2EE application: file:/E:/DJ/Java Certifications/SCBCD/eBooks/Application Servers/JBOSS/jboss-4.2.3.GA/server/default/deploy/myEJB.ear
22:32:48,812 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:ear=myEJB.ear,jar=myEJB-ejb.jar,name=StatelessBean,service=EJB3
State: FAILED
Reason: java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container StatelessBean: reference class: com.ejb3inaction.actionbazaar.buslogic.WelcomeBean ejbLink: not used by any EJBs

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:ear=myEJB.ear,jar=myEJB-ejb.jar,name=StatelessBean,service=EJB3
State: FAILED
Reason: java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container StatelessBean: reference class: com.ejb3inaction.actionbazaar.buslogic.WelcomeBean ejbLink: not used by any EJBs



I renamed WelcomeBean to AWelcomeBean still i seee the same error
22:46:18,000 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=myEJB.ear,jar=myEJB-ejb.jar,name=AWelcomeBean,service=EJB3 with dependencies:
22:46:18,062 INFO [EJBContainer] STARTED EJB: com.ejb3inaction.actionbazaar.buslogic.AWelcomeBean ejbName: AWelcomeBean
22:46:18,390 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
22:46:18,390 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=myEJB.ear,jar=myEJB-ejb.jar,name=StatelessBean,service=EJB3 with dependencies:
22:46:18,390 INFO [EJBContainer] STOPPED EJB: com.ejb3inaction.actionbazaar.buslogic.StatelessBean ejbName: StatelessBean
22:46:18,406 WARN [ServiceController] Problem starting service jboss.j2ee:ear=myEJB.ear,jar=myEJB-ejb.jar,name=StatelessBean,service=EJB3
java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container StatelessBean: reference class: com.ejb3inaction.actionbazaar.buslogic.AWelcomeBean ejbLink: not used by any EJBs
at org.jboss.injection.EjbEncInjector.inject(EjbEncInjector.java:88)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:570)

How to get this working?
 
prashant k. gupta
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Deepak Jain:
How to get this working?



I think DI should perform on bean class remote interface , instead on Bean itself since you are going to invoke call on buisness interface reference only. In your case it should be:-

@EJB (beanname="WelcomeBean")
HelloUser bean;

correct me i am wrong
 
Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solution
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic