[jboss-user] [JNDI/Naming/Network] - ClassCastException on JNDI context.Lookup();

skandros do-not-reply at jboss.com
Fri Jun 27 08:33:00 EDT 2008


I've got this constructor that does the EJB JNDI lookup but throws a ClassCastException when it trys to cast the lookup return Object to what it's suppose to be

  | public ManageParticularAction(){
  |         super();
  |         
  |         Context context;
  |         IParticularManagerBeanLocal toto = null;
  |         try {
  |             context = new InitialContext();
  |             this.particularManagementService = (IParticularManagerBeanLocal)context.lookup("ParticularManagerBean/local");
  |         } catch (NamingException e) {
  |             // TODO Auto-generated catch block
  |             e.printStackTrace();
  |         } catch ( Throwable t ){
  |             t.printStackTrace();
  |         }
  |         
  |     }
  | 

In JBoss consol output, at startup, is shows that the ParticularManagerBean is instantiated.

  | 19:53:41,384 INFO  [EJBContainer] STARTED EJB: com.kedc.ejb.session.services.ParticularManagerBean ejbName: ParticularManagerBean
  | 19:53:41,400 INFO  [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=kedc_ejb-sessions.jar,name=PaymentScheduleManagerBean,service=EJB3 with dependencies:
  | 19:53:41,400 INFO  [JmxKernelAbstraction] 	persistence.units:unitName=kedc
  | 
  | 

thru debugging I foud that the Object that context.lookup() returns is an instance of class Proxy.

Is this normal?  If not, how do I correct the situation?  If it's normal, then how to I cast the return Object from the context.lookup call?

Thanks for the help.

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

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



More information about the jboss-user mailing list