Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI and PortableRemoteObject Problems  RSS feed

Stefan Gesigora
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks!
I've got some problems with jndi and the PortableRemoteObject Class.
I have two different deployed enterprise applications on an AppServer. Application 1 is the main application, application 2 is the application that should test the business logic of application 1 with JUnitEE. For this I have built an ejb.jar of the ejb directory of app 1 and included it under WEB-INF/lib/ into the web-module of app 2. Under WEB-INF/classes/ in app 2 there are my test classes...
So, when I try to get the HomeInterface of my Class via the PortableRemoteObject Class, I always get an ClassCastException. If I do this in my app1 there is no problem to get the HomeInterface.

import App1Class1Home ;
import App1Class1;
Context context = new InitialContext();
Object ref = context.lookup("ejb/App1Class1");
App1Class1Home home = (App1Class1Home)PortableRemoteObject.narrow(ref, App1Class1Home.class);
--> ClassCastException
this.app1Class1 = home.create();
Any suggestion?
Thanks a lot
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!