1 of 1 people found this helpful
I managed to resolve this by using @EJB(lookup = "<jndi name>") instead of mapped name.
But can someone please let me know if an ear say a.ear has a module called a-module.jar, which is exposed in the jboss-deploymnet-strucure.xml and is referenced by another ear b.ear in its jboss-deploymnet-structure.xml will there be two different instances in the JVM of the classes present in a-module.jar.
|------b-module.jar(This references a-module.ear)
I finally managed to solve the class loading problem.
I have incorrectly declared the dependency of b-module.jar on a-module.jar. Then I realised thanks to manual, that each sub deployment in EAR deployment is loaded as a module, I just added that sub deployments dependency (deployment.a.ear.a-module.jar:main )into the b.ear which solved the problem. Now it loads a single class of a-module.jar.