-
1. Re: How reference to jar-file that exists in ear-file from external module
jaysensharma Oct 6, 2015 12:17 PM (in response to vkorppi)Hello,
It is not a good practice to try referencing the Jar file (library) of an EAR from an outside JBoss module. As applications (like EAR/WAR...) are "Dynamic Modules" and the JBoss Modules which we create inside the "$JBOSS_HOME/modules" directory are considered as "Static Modules"
We should try to avoid all the scenarios where the Static modules will try to attempt to access the resources/jars present inside the Dynamic Modules (deployed applications).
But using TCCL it should be possible to do so,
Example:
If you have following kind of code present inside your "Static Module"
public class MyModuleClass { public static void someMethod(String dynamicModuleResource) { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(dynamicModuleResource); // Suppose dynamicModuleResource="/META-INF/something.properties" // try reading the above stream. } }
And if you application which is deployed to the JBoss EAP6 has the following kind of code:
public MyEJB { public void test{} { MyModuleClass.someMethod("/META-INF/something.properties"); // this file is present inside the EJB JAR } }
But that is not always possible in case of third party APIs where you do not have much options to use the TCCL.