• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to access EJB 3 stateful session bean in a servlet in jboss 4.2

Karthik Navaneethakrishnan
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to create a stateful session bean(EJB 3) in jboss server . When i tried to get a handle to the local interface using the lookup() method and cast it to the local interface type i am getting class cast exception . i followed the same approach for accessing a stateless bean but it worked in that case. I saw the JNDI info from the JMX console . It showed the following.

+- hello-world (class: org.jnp.interfaces.NamingContext)
| +- Calculator (class: org.jnp.interfaces.NamingContext)
| | +- local (proxy: $Proxy81 implements interface karthik.CalculatorLocal,interface org.jboss.ejb3.JBossProxy)
| +- CounterImpl (class: org.jnp.interfaces.NamingContext)
| +- mybean (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +-local (class: java.lang.Object)
| | +- remote (class: java.lang.Object)
| | +- remoteStatefulProxyFactory (proxy: $Proxy67 implements interface org.jboss.ejb3.ProxyFactory)
+- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
+- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)

For the stateless bean the proxy object correctly shows that it implements the local interface but for the stateful bean there is just a java.lang.Object instance mapped to the JNDI binding name.
Have i done something wrong ?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic