-
1. Re: class java.lang.ClassCastException in EJB3.0 lookup
jaikiran Dec 19, 2008 1:31 AM (in response to harish.vamsh)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.
-
2. Re: class java.lang.ClassCastException in EJB3.0 lookup
harish.vamsh Dec 19, 2008 2:02 AM (in response to harish.vamsh)Hi Jaikiran,
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.
Thanks
Harish -
3. Re: class java.lang.ClassCastException in EJB3.0 lookup
peterj Dec 19, 2008 11:14 AM (in response to harish.vamsh)You need to include the EJB JAR file in the classpath when you compile your servlet.
-
4. Re: class java.lang.ClassCastException in EJB3.0 lookup
harish.vamsh Dec 20, 2008 12:29 AM (in response to harish.vamsh)Hi Peter,
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?
Thanks again
Harish -
5. Re: class java.lang.ClassCastException in EJB3.0 lookup
peterj Dec 20, 2008 4:18 PM (in response to harish.vamsh)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). -
6. Re: class java.lang.ClassCastException in EJB3.0 lookup
alrubinger Dec 20, 2008 5:17 PM (in response to harish.vamsh)I think you want 5th Edition. ;)
http://oreilly.com/catalog/9780596009786/?CMP=AFC-ak_book&ATT=Enterprise+JavaBeans+3.0
...which covers EJB 3.0.
S,
ALR -
7. Re: class java.lang.ClassCastException in EJB3.0 lookup
peterj Dec 21, 2008 6:23 PM (in response to harish.vamsh)Thanks for catching that, Andrew! I saw Bill's name on the list of authors and thought it was the EJB 3.0 version!
-
8. Re: class java.lang.ClassCastException in EJB3.0 lookup
sarpesh Sep 3, 2009 5:12 AM (in response to harish.vamsh)Hi friend's
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();
properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.provider.url", "jnp://localhost:1099");
properties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
properties.put("jnp.socket.Factory", "org.jnp.interfaces.TimedSocketFactory");
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
at org.jboss.tutorial.stateless.client.Client.main(Client.java:26)
i am using jboss-5.1.0.GA and jdk1.6
please help me -
9. Re: class java.lang.ClassCastException in EJB3.0 lookup
jaikiran Sep 3, 2009 8:55 AM (in response to harish.vamsh)sarpesh,
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.