Link to home
Start Free TrialLog in
Avatar of CIPL-Senthil
CIPL-Senthil

asked on

EJB-Jboss

Hi experts,
      I am working on EJBs with JBOSS-4.0.5 as server.
I was getting Naming Exception at the following lines of code.

/*---------------*/
       InitialContext ctx = new InitialContext();
       Object objref = ctx.lookup("ejb/test/MyTestSessionBean");
       testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref,   MyTestSessionHome.class);
/*---------------*/

Later I changed the code as following, but I am getting the Classcast Exception.
/*---------------*/
       InitialContext ctx = new InitialContext();
       Object objref = ctx.lookup("java:comp/env/ejb/test/MyTestSessionBean");
       testSessionBean = (MyTestSessionHome)PortableRemoteObject.narrow(objref, MyTestSessionHome.class);
/*---------------*/

Could you please help me in this.
ASKER CERTIFIED SOLUTION
Avatar of Jaax
Jaax
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial