[jboss-user] [JNDI/Naming/Network] - NamingContext cannot be cast to AnswerBean

efmcuiti do-not-reply at jboss.com
Fri Apr 6 03:02:58 EDT 2007


Hello everyone,
I have an EJB3 (.par) persistence project deployed in a Jboss 4.0.5 GA.

I needs to instantiate the AnswerBean (a remote interface) from a stand alone java application.

My code looks like:

  | props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
  | props.put(Context.PROVIDER_URL,"jnp://localhost:1099");
  | props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  | 
  | Context ctx = new InitialContext(props);
  | AnswerBean factory = (AnswerBean) ctx.lookup("AnswerBeanRemote");
  | 

But when i run it... the following exception is printed:


  | java.lang.ClassCastException: org.jnp.interfaces.NamingContext cannot be cast to Persistencia.dao.interfaces.AnswerDAO
  | 

Please... help me with this

Thanks

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

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



More information about the jboss-user mailing list