do like this
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.
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:
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.
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?
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
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
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
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");
With stateless beans I am working in the same way but without errors.
What I'm doing wrong?
O, my bad -
IStatefullBean b = (IStatefullBean)con.lookup("StatefullBean/local")