[jboss-user] [JNDI and Naming] - Class cast exception in Ejb Look up

JinoAugustine do-not-reply at jboss.com
Mon Nov 2 05:23:22 EST 2009


Hi friends,

Deploying one ejb with JBoss_4_2_2_GA and deploying well.
But while trying to look up it getting some exception like

java.lang.ClassCastException: $Proxy78 cannot be cast to stateless.CalculatorRemote

please help to identify the problem
is it ejb3 problem or JBoss version problem?

here is code

Remote

  | package stateless;
  | import java.math.*;
  | import javax.ejb.Remote;
  | import java.lang.annotation.*;
  | @Remote
  | public interface CalculatorRemote {
  |  public float add(float x, float y);
  |  public float subtract(float x, float y);
  |  public float multiply(float x, float y);
  |  public float division(float x, float y);
  | }
  | 

and stateless bean 

and lookup code



  | 
  | public void jspInit() {
  |         try {
  | 			
  |             InitialContext ic = new InitialContext();
  | 			calculator = (CalculatorRemote) ic.lookup("example/CalculatorBean/remote");
  | 			System.out.println("Loaded Calculator Bean");
  |  
  |         } catch (Exception ex) {
  |            e.printStackTrace ();
  |         }
  |     }
  | 

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

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



More information about the jboss-user mailing list