-
1. Re: Cannot get my first EJB 3.0 to work!!!
clebert.suconic Aug 29, 2006 11:11 AM (in response to seahsherley)do like this
@Remote
public interface Count
{
public int count();
public void set(int val);
public void remove();
}
@Stateful(name = "CountingBean")
public class CountBean implements Count
{
...........
}
Then add the interceptors back.
You missed the annotation on the interface. -
2. Re: Cannot get my first EJB 3.0 to work!!!
alrubinger Aug 29, 2006 2:33 PM (in response to seahsherley)Just a quick glance, but this stands out...
Count obj = (Count)ctx.lookup("CountingBean");
...and your JNDI tree shows you:+- CountingBean (class: org.jnp.interfaces.NamingContext)
| +- remote (class: java.lang.Object)
| +- remoteStatefulProxyFactory (proxy: $Proxy72 implements interface org.jboss.ejb3.ProxyFactory)
Your proxy should be stored under "CountingBean/remote". So try:Count obj = (Count)ctx.lookup("CountingBean/remote");
Don't know if you've seen the EJB3 Trailblazer yet, but if not, it's really a great starting point with working examples for simple EJB3s:
http://trailblazer.demo.jboss.com/EJB3Trail/serviceobjects/slsb/index.html
S,
ALR -
3. Re: Cannot get my first EJB 3.0 to work!!!
seahsherley Aug 29, 2006 9:49 PM (in response to seahsherley)Thanks for your reply...
I have tried adding @Remote to the interface class, it wont work...
I tried to use ctx.lookup("CountingBean/remote") it returns a javax.naming.Reference object.... I am expecting a Count object. -
4. Re: Cannot get my first EJB 3.0 to work!!!
alrubinger Aug 30, 2006 12:40 AM (in response to seahsherley)Couple things, and again - just looking quickly:
CountBean is remote...have it implement Serializable...
But also check the JARs you're including on your client classpath - are you including jbossall-client.jar?
S,
ALR -
5. Re: Cannot get my first EJB 3.0 to work!!!
georges.goebel Sep 1, 2006 5:17 AM (in response to seahsherley)Hi,
I have exactly the same problem. I have one stateless and one statefull session bean. But in the jndi view is see (class: java.lang.Object) for the local and remote interface of the sfsb. For the slsb the proxy implements the correct interface.
I tried to add the @Local or @Remote to the interface or class, adding jndibinding and a lot of other things. But I cannot get it to work.
I cannot get a session bean from a client (fat client or servlet in the same ear). I always get a proxy classcast exception.
Is there a bug some where because I read the same problem on several places.
Thanks for any help -
6. Re: Cannot get my first EJB 3.0 to work!!!
georges.goebel Oct 16, 2006 3:00 AM (in response to seahsherley)Hi,
I solved my problem by packaging the web application without the ejb classes. The ejb3 (session beans and entity beans) classes where 2 times in the ear. In the jar and the war file. After packageing them only in the jar it workes for me -
7. Re: Cannot get my first EJB 3.0 to work!!!
georges.goebel Oct 24, 2006 10:21 AM (in response to seahsherley)"georges.goebel" wrote:
Hi,
I solved my problem by packaging the web application without the ejb classes. The ejb3 (session beans and entity beans) classes where 2 times in the ear. In the jar and the war file. After packageing them only in the jar it works for me -
8. Re: Cannot get my first EJB 3.0 to work!!!
kpiis Sep 12, 2007 8:54 AM (in response to seahsherley)Hello all,
I have the same question:
After deploying my statefull bean I get the ClassCastException
In JNDI view it's binded in such way
+- StatefullBean (class: org.jnp.interfaces.NamingContext)
| +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| +- local (class: java.lang.Object)
I am looking for the bean from servlet, StatefullBean class is not stored in servlet' WAR.
StatefullBean b = (StatefullBean)con.lookup("StatefullBean/local");
java.lang.ClassCastException: $Proxy250
With stateless beans I am working in the same way but without errors.
What I'm doing wrong? -
9. Re: Cannot get my first EJB 3.0 to work!!!
kpiis Sep 12, 2007 9:02 AM (in response to seahsherley)O, my bad -
IStatefullBean b = (IStatefullBean)con.lookup("StatefullBean/local")
it's correct.