For studying purposes I have put dependencies in the pom of an application called jaxb_study,
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6.1</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.3</version>
</dependency>
In the debugger I look at a few moduleclassloaders and it's classpath (I hope I determined the classpath correctly).
In my application there is a class Book in WEB-INF/classes. It's moduleclassloader is the one of the application module, jaxb_study.main. When I look at a part of it's classpath, I see,
cl = {ModuleClassLoader@22107} "ModuleClassLoader for Module "deployment.jaxb_study.war" from Service Module Loader"
paths = {AtomicReference@22126} "org.jboss.modules.Paths@1e58e53e"
value = {Paths@22148}
allPaths = {Collections$UnmodifiableMap@22150} size = 130
"org/jdom2/output" -> {Collections$UnmodifiableRandomAccessList@22292} size = 1
value = {Collections$UnmodifiableRandomAccessList@22292} size = 1
0 = {VFSResourceLoader@22394}
root = {VirtualFile@22395} ""/D:/work/bvv-22979/eap-7.4.23/content/jaxb_study.war/WEB-INF/lib/jdom2-2.0.6.1.jar""
rootName = "jdom2-2.0.6.1.jar"
"javax/transaction" -> {Collections$UnmodifiableRandomAccessList@22310} size = 1
value = {Collections$UnmodifiableRandomAccessList@22310} size = 1
0 = {VFSResourceLoader@22371}
root = {VirtualFile@22372} ""/D:/work/bvv-22979/eap-7.4.23/content/jaxb_study.war/WEB-INF/lib/javax.transaction-api-1.3.jar""
When I later look at the moduleclassloaders of org.jdom2.Document I see the moduleclassloader of the application as above,
cl = ModuleClassLoader for Module "deployment.jaxb_study.war" from Service Module Loader
and when I look at the moduleclassloader of javax.transaction.RollbackException I see
cl = {ModuleClassLoader@22702} "ModuleClassLoader for Module "javax.transaction.api" version 2.0.0.Final-redhat-00005 from local module loader @75ed9710 (finder: local module finder @4fc5e095 (roots: D:\work\bvv-22979\eap-7.4.23\modules,D:\work\bvv-22979\eap-7.4.23\modules\system\layers\base\.overlays\layer-base-jboss-eap-7.4.23.CP,D:\work\bvv-22979\eap-7.4.23\modules\system\layers\base))"
paths = {AtomicReference@22716} "org.jboss.modules.Paths@4087c386"
value = {Paths@22735}
allPaths = {Collections$UnmodifiableMap@22737} size = 7
"javax/transaction" -> {Collections$UnmodifiableRandomAccessList@22747} size = 1
value = {Collections$UnmodifiableRandomAccessList@22747} size = 1
0 = {JarFileResourceLoader@22755}
jarFile = {JarFile@22756}
rootName = "jboss-transaction-api_1.3_spec-2.0.0.Final-redhat-00005.jar"
rootUrl = {URL@22689} "jar:file:/D:/work/bvv-22979/eap-7.4.23/modules/system/layers/base/javax/transaction/api/main/jboss-transaction-api_1.3_spec-2.0.0.Final-redhat-00005.jar!/"
jdom2 and transactions are on the classpath of the application moduleclassloader with jars from WEB-INF/lib. The Document class is loaded with this moduleclassloader from the jar in WEB-INF/lib. But RollbackException is loaded with the moduleclassloader of the transactions module, from another jar then the one from WEB-INF/lib. So why is Document not loaded by the moduleclassloader of jdom2? Or does it not exist?