How to make WAR in EAR see EAR module classes?
benkirby Jan 11, 2012 1:44 PMHi, I've got an EAR archive which contains a JAR module and a WAR module.
When deployed on (a fairly old version of) jboss-as-7.1.0.Alpha1-SNAPSHOT, everything deploys fine. However, when classes from within the WAR file are running, they can't see the classes in the JAR file:
org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308 Unable to resolve any beans for Types: [class core.service.Service]; Bindings: [@javax.enterprise.inject.Any(), @core.job.JobBinding(value=SERVICE_A)]
The correctly annotated classes managed beans are definitely in the JAR module, the WAR classes just can't see them.
ear-subdeployments-isolated is left as default (false), so libs from JAR should be visible to WAR.
I'm intrigued by the note at https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7:
Using the export parameter it is possible to add a dependency to all sub deployments in an ear. If a module is exported from a Dependencies: entry in the top level of the ear (or by a jar in the ear/lib directory) it will be available to all sub deployments as well
I've tried adding
deployment.my_ear.ear.my_jar.jar export
to the manifest of either the EAR or the WAR, and get this exception:
Caused by: org.jboss.modules.ModuleLoadException: Circular export path in deployment.my_ear.ear:main at org.jboss.modules.Module.linkExports(Module.java:850) at org.jboss.modules.Module.linkExports(Module.java:844) at org.jboss.modules.Module.linkExportsIfNeeded(Module.java:1146) at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:180) at org.jboss.modules.Module.linkExports(Module.java:921) at org.jboss.modules.Module.linkExports(Module.java:844) at org.jboss.modules.Module.linkExportsIfNeeded(Module.java:1146) at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:180) at org.jboss.modules.Module.linkExports(Module.java:921) at org.jboss.modules.Module.linkExports(Module.java:844) at org.jboss.modules.Module.linkExportsIfNeeded(Module.java:1146) at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:180) at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:172) at org.jboss.as.server.moduleservice.ModuleLoadService.start(ModuleLoadService.java:63)
So I must be doing something wrong. Is this the correct way to make the WAR see the JAR module's classes, and, if so, what's the necessary syntax and placement? Archives are all built with Maven, so it'd have to go in one of the poms.
Hope you can help, thanks.