[jboss-user] [EJB 3.0] - Unit test EJB3 Exception

mvpc do-not-reply at jboss.com
Tue Mar 24 10:27:37 EDT 2009


Hello people! I'm having trouble on EJB3 unit test.

I'm getting a class cast exception when i try to retrieve the local bean interface for unit testing. My code is the following:

// configure the enviroment

Hashtable env = new Hashtable();           env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");           
env.put(Context.PROVIDER_URL, "localhost:1099");           env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming.org.jnp.interfaces" );           
this.ctx = new InitialContext(env);      

//get the context

MyLocal local = (MyLocal)PortableRemoteObject.narrow(ctx.lookup("MyBean/local"), MyLocal.class);//-> here i gert the exception


And the exception is that below

java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.omg.CORBA.Object

So please if you have experienced the same problem, tell me about.

Thanks!!



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4220635#4220635

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4220635



More information about the jboss-user mailing list