File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JBoss/WildFly and the fly likes EJB 3 and Jboss integration with struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "EJB 3 and Jboss integration with struts 2 " Watch "EJB 3 and Jboss integration with struts 2 " New topic

EJB 3 and Jboss integration with struts 2

sarvesh tiwari

Joined: Mar 01, 2010
Posts: 5
hi I am using struts 2 plugin for EJB3 and JBoss as 5.0 with JDK 1.6 application server and trying to integrate EJB 3 application with Struts 2 web project .

I have done almost but still I am unable to get business object by annotation in my action class and given interceptors at Struts.xml file

@InjectEJB(name = "testingpro/AccountBean/remote")

when I am not putting Remote at the last of this name it is giving

AccontBean is not bound naming exception .

and if I am giving remote also it is saying

javax.naming.NotContextException: Proxy to jboss.j2ee:ear=testingpro.ear,jar=testingproEJB.jar,name=AccountBean,service=EJB3 implementing [interface org.jboss.ejb3.proxy.intf.SessionProxy, interface com.envision.account.AccountInterface, interface org.jboss.ejb3.proxy.intf.EjbProxy] is not a Context

I have object in JNDI Tree
like this
Other components with java:comp namespace

java:comp namespace of the component jboss.j2ee:ear=testingpro.ear,jar=testingproEJB.jar,name=AccountBean,service=EJB3 :

+- EJBContext (class: javax.ejb.EJBContext)
+- TransactionSynchronizationRegistry[link -> java:TransactionSynchronizationRegistry] (class: javax.naming.LinkRef)
+- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl)
+- env (class: org.jnp.interfaces.NamingContext)
| +- com.envision.account.AccountBean (class: org.jnp.interfaces.NamingContext)
| | +- em (class: org.jboss.jpa.tx.TransactionScopedEntityManager)
| +- em (class: org.jboss.jpa.tx.TransactionScopedEntityManager)

+- ORB[link -> java:/JBossCorbaORB] (class: javax.naming.LinkRef)

java: Namespace

+- iportDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- securityManagement (class:
+- comp (class: javax.namingMain.Context)
+- XAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
+- TransactionPropagationContextImporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- policyRegistration (class:
+- ClusteredConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- Mail (class: javax.mail.Session)
+- TransactionPropagationContextExporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- jaas (class: javax.naming.Context)
| +- HsqlDbRealm (class:
| +- profileservice (class:
+- ClusteredXAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
+- SecurityProxyFactory (class:
+- ConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
+- TransactionManager (class: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate)
+- timedCacheFactory (class: javax.naming.Context)
Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy cannot be cast to javax.naming.NamingEnumeration

Global JNDI Namespace

+- UserTransactionSessionFactory (proxy: $Proxy100 implements interface
+- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
+- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
+- XAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- topic (class: org.jnp.interfaces.NamingContext)
+- testingpro (class: org.jnp.interfaces.NamingContext)
| +- AccountBean (class: org.jnp.interfaces.NamingContext)
| | +- remote-com.envision.account.AccountInterface (class: Proxy for: com.envision.account.AccountInterface)
| | +- remote (class: Proxy for: com.envision.account.AccountInterface)

+- ClusteredConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- ProfileService (class: AOPProxy$0)
+- persistence.unit:unitName=testingpro.ear (class: org.jnp.interfaces.NamingContext)
| +- testingproEJB.jar#EjbtestingEJBPU (class: org.hibernate.impl.SessionFactoryImpl)
+- queue (class: org.jnp.interfaces.NamingContext)
| +- DLQ (class: org.jboss.jms.destination.JBossQueue)
| +- ExpiryQueue (class: org.jboss.jms.destination.JBossQueue)
+- ClusteredXAConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- UserTransaction (class:
+- ConnectionFactory (class: org.jboss.jms.client.JBossConnectionFactory)
+- jmx (class: org.jnp.interfaces.NamingContext)
| +- invoker (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor (proxy: $Proxy96 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
| +- rmi (class: org.jnp.interfaces.NamingContext)
| | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
+- TomcatAuthenticators (class: java.util.Properties)
+- console (class: org.jnp.interfaces.NamingContext)
| +- PluginManager (proxy: $Proxy97 implements interface org.jboss.console.manager.PluginManagerMBean)

Please tell me what is the problem and how could I solve it

Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

sarvesh tiwari wrote:
I have done almost but still I am unable to get business object by annotation in my action class and given interceptors at Struts.xml file

@InjectEJB(name = "testingpro/AccountBean/remote")

Is that the correct annotation? Haven't heard about @InjectEJB. Is that Struts specific? Also please post the entire exception stacktrace (remember to wrap it in a code block while posting)

[My Blog] [JavaRanch Journal]
cnsasi kkumar

Joined: May 07, 2010
Posts: 1
This site can help, having the information
Agrael Lee

Joined: May 21, 2010
Posts: 5
more choices :
I agree. Here's the link:
subject: EJB 3 and Jboss integration with struts 2
It's not a secret anymore!