• Post Reply Bookmark Topic Watch Topic
  • New Topic

DeploymentException: Bean X not found within this application.  RSS feed

 
Debu patra
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to call a stateless session bean from another session bean,
My Deployment descriptor for the caller is
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar>
<description>JBoss Hello World Application</description>
<display-name>Hello World EJB</display-name>
<enterprise-beans>
<session>
<ejb-name>HelloWorld</ejb-name>
<home>com.mastertech.sample.HelloWorldHome</home>
<remote>com.mastertech.sample.HelloWorld</remote>
<ejb-class>
com.mastertech.sample.HelloWorldBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/EJBRefHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>ejbref.project.EJBRefHome</home>
<remote>ejbref.project.EJBRef</remote>
<ejb-link>EJBReference</ejb-link>
</ejb-ref>
</session>
</enterprise-beans>
</ejb-jar>
and deployment descriptor for EJBReference bean is
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar>
<description>Debu EJB reference Application</description>
<display-name>EJB reference</display-name>
<enterprise-beans>
<session>
<ejb-name>EJBReference</ejb-name>
<home>ejbref.project.EJBRefHome</home>
<remote>ejbref.project.EJBRef</remote>
<ejb-class>ejbref.project.EJBRefBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>

the code snippet used to call the EJBReference bean from Helloworld bean is
try{
Context ic = new InitialContext();
Object ejbRef = ic.lookup("java:comp/env/ejb/EJBRefHome");
EJBRefHome home = (EJBRefHome)javax.rmi.PortableRemoteObject.narrow(ejbRef,EJBRefHome.class);
EJBRef ejbRefRemote = home.create();
System.out.println( ejbRefRemote.ejbReferenceTesting());
returnString += ejbRefRemote.ejbReferenceTesting();
ejbRefRemote.remove();
System.out.println( "hello()" );
}
catch(java.rmi.RemoteException re){
re.printStackTrace();
}

while trying to deployee the Helloworld.jar I am getting the following exception
17:50:26,883 WARN [ServiceController] Problem starting service jboss.j2ee:jndiName=HelloWorld,service=EJB
org.jboss.deployment.DeploymentException: Bean EJBReference not found within this application.
at org.jboss.ejb.Container.setupEnvironment(Container.java:909)
at org.jboss.ejb.Container.start(Container.java:566)
at org.jboss.ejb.StatelessSessionContainer.start(StatelessSessionContainer.java:202)
at org.jboss.ejb.Container.invoke(Container.java:756)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
If any one can guide me, It will be a great help
Thanks
Debu
 
John Chandra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can refer to an ejb only if its in same application.
Looking at the exception "Bean EJBReference not found within this application." it seems to me that they are not in same application.
Please rerfer to ***20.3 EJB references*** in ejb 2.0 spec
Cheers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!