[ 
https://issues.apache.org/jira/browse/GERONIMO-4250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12669885#action_12669885
 ] 

Ivan commented on GERONIMO-4250:
--------------------------------

All the jars in the lib folder are visible for each modules in the ear, for 
they are loaded by ear classloader.
I list the urls for a typical ear classloader :
0 = 
[file:/D:/geronimo-all/20090121/g/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-ear-1.0-SNAPSHOT.ear/lib/my-entities1-1.0-SNAPSHOT.jar]
1 = 
[file:/D:/geronimo-all/20090121/g/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-ear-1.0-SNAPSHOT.ear/lib/my-pu-1.0-SNAPSHOT.jar]
2 = 
[file:/D:/geronimo-all/20090121/g/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-ear-1.0-SNAPSHOT.ear/mtom-ejb-2.2-SNAPSHOT.jar]
3 = 
[file:/D:/geronimo-all/20090121/g/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-ear-1.0-SNAPSHOT.ear/]
4 = 
[file:/D:/geronimo-all/20090121/g/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-ear-1.0-SNAPSHOT.ear/872056915/]
The reason that we could not load the resource with "sample.jar" is that the 
URL 
"file:/D:/geronimo-all/20090121/g/repository/com/heilgeist/testcase/geronimo/jarfile/my-ear/1.0-SNAPSHOT/my-ear-1.0-SNAPSHOT.ear/lib
 "
is not inculded in the ear.

IMO, the spec you refer "all JAR-Files in the EARs lib/ directory should be 
available in all (also WAR) Modules classloaders"  means that we could load the 
class from those jars in the lib directory, not we could access those jar files 
without lib prefix. About the access path, it seems that spec does not specify 
it explicitly.
Thanks for any comment !



> Wrong path to access JAR files in EAR from WAR modules with 
> getResourceAsStream
> -------------------------------------------------------------------------------
>
>                 Key: GERONIMO-4250
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-4250
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>    Affects Versions: 2.1.2
>         Environment: Geronimo 2.1.2 on Windows XP
>            Reporter: Frank Meilinger
>
>  Hi,
> I've tryed to build an EAR with the default lib/ bundle directory without 
> using the manifest Class-Path entry in all WAR's which references the jar 
> files in the lib/ directory. This EAR should be standard JEE5 compliant and 
> should be deployable without any change in Geronimo 2.1.2 and GlassFish 
> (latest Version).
> Now I found a difference in how to access the jar files located in the EARs 
> lib/ directory from within an WAR module.
> In Geronimo I have to use:
> getClass().getClassLoader().getResourceAsStream("lib/sample.jar")
> to get the jar file content.
> In GlassFish I have to use:
> getClass().getClassLoader().getResourceAsStream("sample.jar")
> notice - without the lib/ prefix.
> As far as I understand the JEE5 specification (section 8.2.1 Bundled 
> Libraries), all JAR-Files in the EARs lib/ directory should be available in 
> all (also WAR) Modules classloaders. So the lib/ prefix should not be 
> specified.
> See discussion:
> http://www.nabble.com/EAR-bundle-dir-classpath-issue-tt18982334s134.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to