Hi. I'm looking for advice on how to use multiple EJB JAR files within a Seam
application running with JBoss Embeddable EJB 3.0. The problem relates to EJB JNDI
locations and how Seam discovers the EJB components.
I have several libraries of JavaBean and EJB3 Seam components. Each library lives in
it's own JAR file. This works fine in JBoss AS but I'm having trouble using
multiple JARs with JBoss Embeddable EJB 3.0.
I know that my application works fine if all the beans are in the same classpath / JAR
file. However when I rebuild and run the app with multiple JARs Seam does not pick up the
EJBs in the JARs that are not the main/home JAR.
I can see that the EJBs have been deployed properly by the container and that the problem
is that Seam is looking in the wrong place for the EJBs in other JARs.
What is the best way to tell Seam to look in different JNDI locations when EJBs are
deployed in multiple JARs?
Here is a snapshot of my JNDI tree when the EJBs are deployed in *separate* JARs. There
are two 'JARs', one named 'project' and the other named
'templating-ejb'.
GLOBAL JNDI
| +- UserTransaction (class: org.jboss.ejb3.embedded.UserTransactionImpl)
| +- UserServiceBean (class: org.jnp.interfaces.NamingContext)
| | +- local (proxy: $Proxy39 implements interface
org.restlet.seam.UserService,interface org.jboss.ejb3.JBossProxy,interface
javax.ejb.EJBLocalObject)
|
|
| -------------
| java:/ Namespace
| +- comp.ejb3 (class: javax.naming.Context)
| | NonContext: null
| +- TransactionPropagationContextImporter (class:
org.jboss.tm.TransactionPropagationContextImporter)
| +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
| +- TransactionPropagationContextExporter (class:
org.jboss.tm.TransactionPropagationContextFactory)
| +- TransactionManager (class: org.jboss.tm.TxManager)
|
|
| -------------
| EJB ENCs
| jboss.j2ee:jar=templating-ejb,name=SkinServiceBean,service=EJB3
| +- env (class: org.jnp.interfaces.NamingContext)
|
| jboss.j2ee:jar=project,name=UserServiceBean,service=EJB3
| +- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl)
| +- env (class: org.jnp.interfaces.NamingContext)
| | +- org.restlet.seam.UserServiceBean (class:
org.jnp.interfaces.NamingContext)
| | | +- em (class: org.jboss.ejb3.entity.TransactionScopedEntityManager)
|
Here is a snapshot of my JNDI tree when the EJBs are deployed in the *same* JAR. There is
one JAR named 'production'.
GLOBAL JNDI
| +- UserTransaction (class: org.jboss.ejb3.embedded.UserTransactionImpl)
| +- UserServiceBean (class: org.jnp.interfaces.NamingContext)
| | +- local (proxy: $Proxy41 implements interface
org.restlet.seam.UserService,interface org.jboss.ejb3.JBossProxy,interface
javax.ejb.EJBLocalObject)
| +- SkinServiceBean (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class:
org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
|
|
| -------------
| java:/ Namespace
| +- comp.ejb3 (class: javax.naming.Context)
| | NonContext: null
| +- TransactionPropagationContextImporter (class:
org.jboss.tm.TransactionPropagationContextImporter)
| +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
| +- TransactionPropagationContextExporter (class:
org.jboss.tm.TransactionPropagationContextFactory)
| +- TransactionManager (class: org.jboss.tm.TxManager)
|
|
| -------------
| EJB ENCs
| jboss.j2ee:jar=production,name=UserServiceBean,service=EJB3
| +- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl)
| +- env (class: org.jnp.interfaces.NamingContext)
| | +- org.restlet.seam.UserServiceBean (class:
org.jnp.interfaces.NamingContext)
| | | +- em (class: org.jboss.ejb3.entity.TransactionScopedEntityManager)
|
| jboss.j2ee:jar=production,name=SkinServiceBean,service=EJB3
| +- UserTransaction (class: org.jboss.ejb3.tx.UserTransactionImpl)
| +- env (class: org.jnp.interfaces.NamingContext)
| | +- com.jellymold.templating.SkinServiceBean (class:
org.jnp.interfaces.NamingContext)
| | | +- em (class: org.jboss.ejb3.entity.TransactionScopedEntityManager)
|
And here you can see the relevant section from my startup logs (separate JARS).
17:55:17,720 DEBUG [EJB3StandaloneBootstrap] !!loadMBeanServer servers 0
| 17:55:17,720 DEBUG [EJB3StandaloneBootstrap] !!loadMBeanServer creating...
| 17:55:19,691 WARN [BeanSchemaBinding] You should use the 2.0 version of the
Microcontainer xml. xmlns='urn:jboss:bean-deployer:2.0'
| 17:55:20,087 DEBUG [BeanXMLDeployer] Parsing
file:/Development/rest/classes/production/project/embedded-jboss-beans.xml took 2062
milliseconds
| 17:55:20,970 DEBUG [UserTransactionImpl] new UserTx:
org.jboss.ejb3.embedded.UserTransactionImpl@3c96a9
| 17:55:21,305 INFO [LocalTxDataSource] Bound datasource to JNDI name
'java:/DefaultDS'
| 17:55:21,308 DEBUG [BeanXMLDeployer] Deploying
file:/Development/rest/classes/production/project/embedded-jboss-beans.xml took 3284
milliseconds
| 17:55:22,707 DEBUG [BeanXMLDeployer] Parsing
file:/Development/rest/classes/production/project/META-INF/jboss-beans.xml took 32
milliseconds
| 17:55:22,708 DEBUG [BeanXMLDeployer] Deploying
file:/Development/rest/classes/production/project/META-INF/jboss-beans.xml took 33
milliseconds
| 17:55:22,709 DEBUG [EJB3StandaloneBootstrap] !!! deployment.getInstalledContexts() []
| 17:55:22,794 DEBUG [JaccHelper] Initialising JACC Context for deployment:
templating-ejb
| 17:55:23,177 DEBUG [EjbJarDDObjectFactory] found ejb-jar.xml
file:/Development/rest/classes/production/templating-ejb/META-INF/ejb-jar.xml
| 17:55:24,704 INFO [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.internal.DefaultInterceptorMarker to
com.jellymold.templating.SkinServiceBean
org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@60b68a
| 17:55:24,705 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.internal.DefaultInterceptorMarker to
com.jellymold.templating.SkinServiceBean
org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@60b68a
| 17:55:24,717 DEBUG [Ejb3AnnotationHandler] found EJB3: ejbName=SkinServiceBean,
class=com.jellymold.templating.SkinServiceBean, type=STATEFUL
| 17:55:24,740 DEBUG [ProxyDeployer] no declared remote bindings for : SkinServiceBean
| 17:55:24,815 INFO [Ejb3Deployment] EJB3 deployment time took: 2034
| 17:55:24,816 DEBUG [JaccHelper] Initialising JACC Context for deployment: project
| 17:55:24,820 DEBUG [EjbJarDDObjectFactory] found ejb-jar.xml
file:/Development/rest/classes/production/project/META-INF/ejb-jar.xml
| 17:55:25,258 INFO [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.internal.DefaultInterceptorMarker to org.restlet.seam.UserServiceBean
org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@573f80
| 17:55:25,259 DEBUG [Ejb3DescriptorHandler] adding class annotation
org.jboss.annotation.internal.DefaultInterceptorMarker to org.restlet.seam.UserServiceBean
org.jboss.annotation.internal.DefaultInterceptorMarkerImpl@573f80
| 17:55:25,260 DEBUG [Ejb3AnnotationHandler] found EJB3: ejbName=UserServiceBean,
class=org.restlet.seam.UserServiceBean, type=STATELESS
| 17:55:25,260 DEBUG [ProxyDeployer] no declared remote bindings for : UserServiceBean
| 17:55:25,404 INFO [Ejb3Deployment] EJB3 deployment time took: 588
| 17:55:25,702 DEBUG [JaccHelper] Initialising JACC Context for deployment:
templating-ejb
| 17:55:25,715 INFO [Ejb3Deployment] EJB3 deployment time took: 13
| 17:55:25,846 DEBUG [EJBContainer] Initialising interceptors for SkinServiceBean...
| 17:55:25,847 DEBUG [EJBContainer] Default interceptors: [InterceptorInfo{class=class
org.jboss.seam.ejb.SeamInterceptor}]
| 17:55:25,849 DEBUG [EJBContainer] Class interceptors: []
| 17:55:25,851 DEBUG [EJBContainer] All applicable interceptor classes:
[InterceptorInfo{class=class org.jboss.seam.ejb.SeamInterceptor}]
| 17:55:25,872 INFO [MCKernelAbstraction] installing bean:
jboss.j2ee:jar=templating-ejb,name=SkinServiceBean,service=EJB3 with dependencies:
| 17:55:25,875 INFO [MCKernelAbstraction]
AbstractDependencyMetaData@8c6ad{dependency=persistence.units:unitName=custdb}
| 17:55:26,019 DEBUG [Ejb3Deployment] Bound ejb3 container
jboss.j2ee:service=EJB3,jar=templating-ejb,name=SkinServiceBean
| 17:55:26,020 INFO [MCKernelAbstraction] installing bean:
persistence.units:jar=project.jar,unitName=custdb with dependencies:
| 17:55:26,021 INFO [MCKernelAbstraction]
AbstractDependencyMetaData@1bc475{dependency=DefaultDS}
| 17:55:26,050 DEBUG [PersistenceUnitDeployment] Found persistence.xml file in EJB3 jar
|
As a sweetener for you (yes you!) helping me I have (adapted from the original JSP)
contributed a Seam component for printing the JNDI tree in Embeddable EJB. See here:
http://wiki.jboss.org/wiki/Wiki.jsp?page=EmbeddableJNDIView
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979430#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...