Has anyone run AspectJ with JBoss AS 7.1.1 final? - jboss

I configured everything like they say here.
And it still won't run. It just gives me an LogManager exception.
Does anyone successfully run AspectJ there?

Here is a possible workaround/solution (from http://wiki.eclipse.org/LTWJboss7):
The IllegalStateException is thrown by jBoss7 because there is a bug
that limits access to java.util.logging:
https://issues.jboss.org/browse/AS7-1 - There a partial solution to
avoid this problem is suggested, regarding changing the way the
loadmanager is loaded, pushing it to the BootClasspath and adding
several configuration options. However we suggest deactivating the
AspectJ tracing facilities. You can achieve this by adding the next
options:
-Dorg.aspectj.tracing.enabled=false -Dorg.aspectj.tracing.factory=default
Due to new JBoss classloader and modularization architecture, classes
stored in your javaagent are not visible to the remaining modules, so
your aspects will not be found and you will get different types of
errors. To let your aspects been found by all your code you have to
add the aspectjweaver, and aspects.jar files to the bootclasspath and
add the next option to JBoss startup:
-Djboss.modules.system.pkgs=org.aspectj,com.yourcompany.aspects.package
that makes every class under those packages shared across all the
modules in the JBoss system.

This worked excellently for me ;).
I have configured three modules ec.com.acme, org.springframework, org.aspectj.
The key is to add the ironjacamar module as dependency of org.aspectj module and export them to be visible to all modules that depend on org.aspectj module, for example org.springframework module, as well:
org.aspectj Module Configuration:
<module xmlns="urn:jboss:module:1.1" name="org.aspectj">
<resources>
<resource-root path="aspectjweaver-1.7.2.jar"/>
</resources>
<dependencies>
<!--Add and export it to work-->
<module name="org.jboss.ironjacamar.jdbcadapters" export="true"/>
</dependencies>
</module>
Module Configuration org.springframework:
<module xmlns="urn:jboss:module:1.1" name="org.springframework">
<resources>
<resource-root path="com.springsource.org.aopalliance-1.0.0.jar"/>
<resource-root path="org.springframework.aop-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.asm-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.aspects-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.beans-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.context-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.context.support-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.core-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.expression-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.jdbc-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.orm-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.oxm-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.transaction-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.web-3.1.0.RELEASE.jar"/>
<resource-root path="org.springframework.web.servlet-3.1.0.RELEASE.jar"/>
<resource-root path="spring-batch-core-2.1.9.RELEASE.jar"/>
<resource-root path="spring-batch-infrastructure-2.1.9.RELEASE.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.logging" export="true"/>
<module name="org.hibernate" slot="3" export="true"/>
<module name="javax.api"/>
<module name="javax.annotation.api"/>
<module name="javax.el.api"/>
<module name="javax.enterprise.api"/>
<module name="javax.ejb.api"/>
<module name="javax.faces.api"/>
<module name="javax.interceptor.api"/>
<module name="javax.servlet.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.transaction.api"/>
<module name="javax.xml.bind.api"/>
<!--Add and export it to work-->
<module name="org.aspectj" export="true"/>
<module name="com.ibm.as400" slot="main" export="true"/>
</dependencies>
</module>
ec.com.acme Module Configuration:
<module xmlns="urn:jboss:module:1.1" name="ec.com.acme">
<resources>
<resource-root path="prjAcme.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.lang" slot="main" export="true"/>
<module name="org.apache.commons.beanutils" slot="main" export="true"/>
<module name="org.apache.commons.collections" slot="main" export="true"/>
<module name="org.apache.commons.io" slot="main" export="true"/>
<module name="org.apache.commons.lang3" slot="main" export="true"/>
<!--Add and export it to work-->
<module name="org.springframework" slot="main" export="true"/>
</dependencies>
</module>

Related

How to excude exports in deployment module (Wildfly)?

I have two war-files: core.war and service.war
Archive core.war includes jboss-deployment-structure.xml:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="logging"/>
<subsystem name="pojo"/>
</exclude-subsystems>
<exclusions>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.slf4j.ext"/>
<module name="org.slf4j.jcl-over-slf4j"/>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.log4j.logmanager"/>
<module name="org.jboss.as.logging"/>
<!-- exclude wildfly logging modules, use slf4j + logback -->
<module name="org.jboss.logmanager.log4j"/>
</exclusions>
<dependencies>
<module name="deployment.some-dep-1.ear" meta-inf="import"/>
<module name="deployment.some-dep-2.ear" meta-inf="import" services="import" optional="true"/>
<module name="deployment.some-dep-3.ear" meta-inf="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
service.war includes jboss-deployment-structure.xml:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="logging"/>
<subsystem name="pojo"/>
</exclude-subsystems>
<exclusions>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.slf4j.ext"/>
<module name="org.slf4j.jcl-over-slf4j"/>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.log4j.logmanager"/>
<module name="org.jboss.as.logging"/>
<!-- exclude wildfly logging modules, use slf4j + logback -->
<module name="org.jboss.logmanager.log4j"/>
</exclusions>
<dependencies>
<module name="deployment.core.war" services="import" meta-inf="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
and I have overlays:
standalone.xml:
...
<deployment-overlays>
<deployment-overlay name="dep-lib">
<!-- ... -->
<content path="/WEB-INF/lib/org-springframework-spring-aop-3.2.10.RELEASE.jar" content="77d0b86238df32cb15e469eaa2f7f32c4893dc54"/>
<content path="/WEB-INF/lib/org-springframework-spring-aspects-3.2.10.RELEASE.jar" content="d5327b3d4a74f224d32c338e83789ae877feb790"/>
<!-- ... -->
<deployment name="core.war"/>
</deployment-overlay>
</deployment-overlays>
...
In this case classLoader in service.war module could not load classes declared in some-dep-1.ear/some-dep-2.ear/some-dep-3.ear becouse
attribute export="false" by default in the tag <module/>
Now I want to exclude some overlay dependensies for service.war.
I try to use tage <export/> something like this:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="logging"/>
<subsystem name="pojo"/>
</exclude-subsystems>
<exclusions>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.slf4j.ext"/>
<module name="org.slf4j.jcl-over-slf4j"/>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.log4j.logmanager"/>
<module name="org.jboss.as.logging"/>
<!-- exclude wildfly logging modules, use slf4j + logback -->
<module name="org.jboss.logmanager.log4j"/>
</exclusions>
<exports>
<exclude-set>
<path name="**"/>
</exclude-set>
<include-set>
<path name="org/slf4j"/>
</include-set>
</exports>
<dependencies>
<module name="deployment.some-dep-1.ear" meta-inf="import"/>
<module name="deployment.some-dep-2.ear" meta-inf="import" services="import" optional="true"/>
<module name="deployment.some-dep-1.ear" meta-inf="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
but this not works.
How can I exclude overlay dependences for export?
If you are using master-slave configuration and your slave configuration is EAP 6.3. or older than it is not possible, you need to downgrade your configuration.
[https://issues.jboss.org/browse/WFCORE-2899?_sscc=t][1]

wildfly did not find jar inside war

After changing ear to war, wildfly 10 cant find the jar file from jboss-deployment-structure.xml from sub-deployment section. There is no gui.ejb.jar in war after project buildin and I copy it to war manually. I try to root folder and to WEB-INF lib. Help please how to fix it.
Caused by:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
WFLYSRV0166: Sub deployment gui.ejb.jar in
jboss-deployment-structure.xml was not found. Available sub
deployments: at
org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.subDeploymentNotFound(DeploymentStructureDescriptorParser.java:288)
at
org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:190)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="webservices"/>
<subsystem name="jaxrs"/>
</exclude-subsystems>
<exclusions>
<module name="org.apache.commons.logging"/>
<module name="org.apache.log4j"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.logmanager.log4j"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.apache.cxf.impl"/>
<module name="org.apache.cxf"/>
<module name="org.apache.cxf.services-sts"/>
<module name="org.apache.cxf.ws-security"/>
<module name="org.apache.cxf.ws-policy"/>
<module name="org.apache.xerces"/>
<module name="org.apache.xalan"/>
</exclusions>
<dependencies>
<module name="com.sun.xml.bind" export="true"services="export"/>
<module name="javax.xml.ws.api" export="true"/>
<module name="javax.jws.api" export="true"/>
<module name="org.slf4j" export="true"/>
</dependencies>
</deployment>
<sub-deployment name="gui.ejb.jar">
<exclusions>
<module name="org.apache.xerces"/>
<module name="org.apache.xalan"/>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
</exclusions>
<dependencies>
<module name="com.sun.xml.bind" export="true"services="export"/>
<module name="javax.xml.ws.api" export="true" />
<module name="javax.jws.api" export="true" />
<module name="org.slf4j" export="true"/>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
A WAR deployment does not have a sub-deployment. You can remove the <sub-deployment/> element and it will be inherited from the main deployment element.
As a side note it looks a bit weird to both include and exclude the org.slf4j module. If you're attempting to use you're own slf4j binding you'd need to keep it excluded and include an slf4j-api and binding library.

How to configure a new module in JBoss AS 7.1.3?

This question is a spinoff of this one!
I now can configure my project to use a different version of Hibernate and my JBoss installation has a second slot named "5.1.1.Final" (located at ...\jboss-as-7.1.3.Final\modules\org\hibernate\5.1.10.Final) that has the following module.xml file:
<module xmlns="urn:jboss:module:1.1" name="org.hibernate:5.1.10.Final">
<resources>
<resource-root path="hibernate-core-5.1.10.Final.jar"/>
<resource-root path="hibernate-entitymanager-5.1.10.Final.jar"/>
<resource-root path="hibernate-infinispan-5.1.10.Final.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="asm.asm"/>
<module name="javax.api"/>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="org.antlr"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.infinispan" optional="true"/>
<module name="org.javassist"/>
<module name="org.jboss.as.jpa.hibernate" slot="4" optional="true"/>
<module name="org.jboss.logging"/>
<module name="org.hibernate.envers" services="import" optional="true"/>
<module name="org.hibernate.commons-annotations"/>
</dependencies>
</module>
However, when JBoss starts I receive the following error message: ParseError at [row,col]:[26,72] Message: Invalid/mismatched module name (expected org.hibernate:5.1.10.Final).
I can't understand why this message, since the required module name (org.hibernate:5.1.10.Final) is the exact name I specified at the file (name="org.hibernate:5.1.10.Final");
What am i missing?
The slot is a separate attribute. It should look like the following.
<module xmlns="urn:jboss:module:1.1" name="org.hibernate" slot="5.1.10.Final">
On a side note you may want to consider trying to upgrade to WildFly 11, current release is WildFly 11.0.0.Beta1. I'm not sure if Hibernate 5.1.x will work with JBoss AS 7.x. WildFly 10.1.0.Final uses Hibernate 5.0.10.Final.

JBOSS EAP 7.0 - java.lang.NoClassDefFoundError:org/springframework/context/support/ClassPathXmlApplicationContext

I am currently migrating apps from JBoss 5.1 to JBoss 7.0 EAP server.
I have added a module to JBoss server named - org.springframework for spring dependency jars
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework">
<resources>
<resource-root path="spring-core-3.0.5.RELEASE.jar"/>
<resource-root path="spring-context-3.0.5.RELEASE.jar"/>
<resource-root path="spring-beans-3.0.5.RELEASE.jar"/>
<resource-root path="spring-expression-3.0.5.RELEASE.jar"/>
<resource-root path="spring-web-3.0.5.RELEASE.jar"/>
<resource-root path="spring-aop-3.0.5.RELEASE.jar"/>
<resource-root path="spring-asm-3.0.5.RELEASE.jar"/>
<resource-root path="spring-jdbc-3.0.5.RELEASE.jar"/>
<resource-root path="spring-tx-3.0.5.RELEASE.jar"/>
<resource-root path="org.springframework.web.servlet-3.0.0.M3.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.faces.api"/>
</dependencies>
</module>
I have defined the module dependency in jboss-deployment-structure.xml of the WAR
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.oracle" />
<module name="org.springframework" />
</dependencies>
</deployment>
</jboss-deployment-structure>
The war deployed to server also contains spring-context-3.0.5.RELEASE.jar in its WEB-INF/lib folder
So I think the required jar - spring-context-3.0.5.RELEASE.jar exists in class path. But still I am getting the below error :
04:33:30,496 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (default task-19) Loading XML bean definitions from class path resource [core_services.xml]
04:33:30,507 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (default task-19) Pre-instantiating singletons in org.springframework.beans.fact
ory.support.DefaultListableBeanFactory#9b765aa: defining beans [LogService,CacheService,PropertyService]; root of factory hierarchy
2017.02.09 04:33:30 ERROR CashViewsPortalServiceImpl(-2): org/springframework/context/support/ClassPathXmlApplicationContext
CallStack=java.lang.NoClassDefFoundError: org/springframework/context/support/ClassPathXmlApplicationContext
at com.karthik.common.service.Services.getService(Services.java:31)
at com.karthik.data.service.DataServices.getService(DataServices.java:18)
at com.karthik.portal.server.PortalServiceImpl.getInitializeInfo(PortalServiceImpl.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:265)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:305)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
1) Why do we need add module in Jboss 7 EAP server for class loading even though the jars are bundled in WEB-INF/lib folder of the war
deployed on server?
2) How to resolve the above error?
I think you have n't defined the spring dependencies perfectly. Below are the steps:
You can define Spring as a module
The following are steps to create a Spring module:
1.Download the desired version of Spring. For this example we are using Spring 3.1.1.
2.Create the directory: $JBOSS_HOME/modules/org/springframework/spring/main.
3.Copy the Spring libraries you downloaded to that directory.
4.Create module.xml with the following contents under that directory. Make sure these correspond to the libraries' names:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
<resources>
<resource-root path="org.springframework.aop-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.asm-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.aspects-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.beans-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.context-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.context.support-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.core-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.expression-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.instrument-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.instrument.tomcat-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.jdbc-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.jms-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.orm-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.oxm-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.test-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.transaction-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web.portlet-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web.servlet-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web.struts-3.1.1.RELEASE.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.logging"/>
<module name="javax.api" export="true"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>
Here is an absolute minimal module.xml (the different Spring version is irrelevant):
<?xml version="1.0"?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
<resources>
<resource-root path="spring-aop-3.2.3.RELEASE.jar"/>
<resource-root path="spring-beans-3.2.3.RELEASE.jar"/>
<resource-root path="spring-context-3.2.3.RELEASE.jar"/>
<resource-root path="spring-core-3.2.3.RELEASE.jar"/>
<resource-root path="spring-expression-3.2.3.RELEASE.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="org.apache.commons.logging"/>
</dependencies>
</module>
5.Put the following jboss-deployment-structure.xml in your application archive (WEB-INF/jboss-deployment-structure.xml for WAR or META-INF/jboss-deployment-structure.xml for EAR or EJB-jar) to use the above module:
If you're using JBoss EAP 6.1.x and greater or EAP 7, then use below:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.springframework.spring" export="true" meta-inf="export"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
If JBoss EAP 6.0.x, then use below
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.springframework.spring" export="true">
<imports>
<include path="META-INF**"/>
<include path="org**"/>
</imports>
<exports>
<include path="META-INF**"/>
<include path="org**"/>
</exports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
Note: The meta-inf on the module in the jboss-deployment-structure.xml was added in JBoss EAP 6.1.0, which allows the files in the META-INF of a resource to be visible. Since this was not available in JBoss EAP 6.0.x, the section allows you to get access to the META-INF directory which is not visible by default.
Note: The Spring Framework module should not include resources such as servlet-api.jar, xml-apis.jar, jta-api.jar, and other APIs. These APIs are implemented by either the JDK or JBoss and trying to use a different version of the API will lead to classloading issues and other problems.
Note: The Spring module should include all of its non Java / JavaEE dependencies. The Spring module can depend on javax.api / javaee.api provided by JBoss and any public JBoss module, but for other dependencies Spring has such as aopalliance, they would need to be included as resources in the module or in another custom module.

Cannot access Seam Components within JAR from WAR in [JBOSS 7.1.1.FINAL and SEAM 2.2.1.CR2]

Problem: I have an ejb-jar-1.jar which defines EJBs and Entities. The project structure is listed below. During deployment all EJBs are successfully bootstraped > started and their JNDI locations are printed in a log file. There's a class in my WAR file which needs to access a NAMED QUERY defined on an Entity which resides inside ejb-jar-1.jar. When this piece of code is run it throws an illegalArgumentException saying NAMED QUERY cannot be found. On a different note I also cannot get reference to SEAM components that were started when ejb-jar1.jar was deployed. I printed the JNDI tree from app-war.war file and it does not have any JNDI resources from ejb-jar-1.jar. So, I believe this is a context issue where JNDI resources available in ejb-jar-1.jar cannot be seen from app-war.war.
Any suggestions on how to access JNDI resources available in ejb-jar-1.jar from app-war.war?
Deployement Info
* JBOSS 7.1.1.FINAL
* Uses seam framework: jboss-seam-2.2.1.CR2.jar
* Uses Hibernate 3.4.0.GA
main-ear.ear
|__META-INF
| |____jboss-deployment-structure.xml
| |____application.xml
| |____jboss-app.xml
| |____MANIFEST.MF
|__lib
| |____somejar.jar
| |____somejar.jar
|__ejb-jar-1.jar
|__ejb-jar-2.jar
|__jboss-seam-2.2.1.CR2.jar
|__commons-lang-2.4.jar
|__commons-codec-1.1.jar
|__jasypt-1.6.jar
|__app-war.war
jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclusions>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="org.hibernate" slot="main"/>
<module name="org.hibernate.validator" slot="main"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.commons.collections"/>
<module name="org.apache.commons.codec"/>
<module name="org.picketlink" slot="main"/>
<module name="org.picketbox" slot="main"/>
<module name="org.javassist" slot="main"/>
<module name="org.dom4j" slot="main"/>
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="1.2" export="true"/>
<module name="com.sun.jsf-impl" slot="1.2" export="true"/>
<module name="org.javassist" slot="1" export="true"/>
<module name="org.apache.commons.logging" export="true"/>
</dependencies>
</deployment>
<sub-deployment name="app-war.war">
<exclusions>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
<module name="deployment.main-ear.ear.ejb-jar-1.jar" />
<module name="deployment.main-ear.ear.ejb-jar-2.jar" />
<module name="deployment.main-ear.ear.jboss-seam-2.2.1.CR2.jar"/>
</dependencies>
</sub-deployment>
<module name="deployment.main-ear.ear.jasypt-1.6.jar" />
<module name="deployment.main-ear.ear.commons-codec-1.1.jar" />
<module name="deployment.main-ear.ear.commons-lang-2.4.jar" />
</jboss-deployment-structure>
application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/javaee/application_6.xsd"
version="6">
<description>myapp</description>
<display-name>myapp</display-name>
<initialize-in-order>true</initialize-in-order>
<library-directory>lib</library-directory>
<module>
<ejb>ejb-jar-1.jar</ejb>
</module>
<module>
<ejb>ejb-jar-2.jar</ejb>
</module>
<module>
<ejb>jboss-seam-2.2.1.CR2.jar</ejb>
</module>
<module>
<web>
<web-uri>app-war.war</web-uri>
<context-root>/app</context-root>
</web>
</module>
</application>
Bit late but oh well...for EE6 you need to use JNDI portable syntax, eg. add following annotations to all beans in the secondary module
#JndiName("java:app/NameOfModule/NameOfBean")
Think you need seam.properties in your jar in META-INF