• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing bean from another ejb.jar

Bernardo Hermont
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

I'm currently using JBoss and EJB 3.0, trying to access an EJB that is placed inside another jar:

public class StatelessSessionBean1 implements StatelessSessionBean1Local,StatelessSessionBean1Remote {

private StatelessSessionBean2 statelessSessionBean2;

public void accessedByBean2()
System.out.println("This bean was accessed by other ejb.jar");

public void accessBean2()

I'm using only annotations, since no ejb-jar setups is required right?
So, my servlet does the following:
StatelessSessionBean1Remote ssb1r = (StatelessSessionBean1Remote) initialContext.lookup(projectName+"/"+StatelessSessionBean1.class.getSimpleName()+ "/remote");

System.out.println("Accessing bean 2...:");

And I got the following runtime error:

java.lang.RuntimeException: could not resolve global JNDI name for @EJB for container StatelessSessionBean1: reference class: com.certification.session.stateless.beanref2.ejb.StatelessSessionBean2 ejbLink: not used by any EJBs
at org.jboss.injection.EjbEncInjector.inject(EjbEncInjector.java:88)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:566)
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 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

Any clues?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic