See this http://www.jboss.org/community/docs/DOC-9280 for possible reasons for the classcastexception. I guess you are packaging the EJB interfaces both in the WAR and in the EJB jar. If so, then remove those interfaces from the WAR.
Thanks for your reply.
Yes i do have remote interface in my exploded war folder. If i remove this interface, the servlet containing the lookup doesn't compile (Since Hello can't be resolved).
Please lemme know how to resolve this.
You need to include the EJB JAR file in the classpath when you compile your servlet.
Yes, it worked. Thanks a lot for your help. EJB3.0 has made it very simpler.
Can you share any resources on EJB3.0, if you have?
How about Enterprise Java Beans, 4th Edition: http://oreilly.com/catalog/9780596005306/
Be aware that the JBoss AS-specific sections in that book are a little dated (based on 4.0.4 with added EJB3 support).
Thanks for catching that, Andrew! I saw Bill's name on the list of authors and thought it was the EJB 3.0 version!
i am calling my ejb class using this code
public class Client
public static void main(String args) throws Exception
CalculatorRemote calculator =null;
Properties properties = new Properties();
Context ctx = new InitialContext(properties);
CalculatorRemote obj = (CalculatorRemote)ctx.lookup("CalculatorBean/remote");
System.out.println("1 + 1 = " + calculator.add(1, 1));
System.out.println("1 - 1 = " + calculator.subtract(1, 1));
but always get this exception
Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference cannot be cast to org.jboss.tutorial.stateless.bean.CalculatorRemote
i am using jboss-5.1.0.GA and jdk1.6
please help me
Please create a separate thread in this forum to discuss this. That way we won't end up discussing multiple unrelated issues in one thread.