[jboss-user] [EJB 3.0] - Re: Stateless and JNDI once again

peper do-not-reply at jboss.com
Sun May 13 17:03:34 EDT 2007


//Once again - there were some problems with the code parts//

Hi.
I'm using JBoss 4.2.0 CR 2

I've got: 

@Stateless
@Remote(ProjectFacade.class)
public class ProjectFacadeBean implements ProjectFacade, ProjectFacadeLocal

found it in the JNDI Console as :

 ProjectFacadeBeanRemote (proxy: $Proxy108 implements interface facade.ProjectFacade,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)

so my lookup code is : 

ProjectFacade projectFacade = (ProjectFacade)context.lookup("ProjectFacadeBeanRemote");


And I get :

java.lang.ClassCastException : $Proxy108 cannot be cast to facade.ProjectFacade


As You can see JNDI Console said that : $Proxy108 implements interface facade.ProjectFacade

What am I doing wrong ??

Second try :

JNDI console : 

+- webapp1 (class: org.jnp.interfaces.NamingContext)
  |   +- ProjectFacadeBean (class: org.jnp.interfaces.NamingContext)
  |   |   +- local (proxy: $Proxy117 implements interface facade.ProjectFacadeLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)

The lookup code : 


ProjectFacadeLocal projectFacade = (ProjectFacadeLocal)context.lookup("webapp1/ProjectFacadeBean/local");


and ....

java.lang.ClassCastException : $Proxy117 cannot be cast to facade.ProjectFacadeLocal


What's the trick?!


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

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



More information about the jboss-user mailing list