We have two applications,say Test.ear and Test1.ear both have some resource files packaged with them in the structure of
Test.ear
-dtd/test.dtd
Test1.ear
-dtd/test1.dtd
so when i tried to access this dtd/test.dtd from a class in Test1.ear i am not able to get the dtd. I am using this.getClass().getClassLoader().getResource("dtd/test.dtd") method from a MBean Service (sar) which is present in Test1.ear. It returned null.
On further analysis, we came to know that you are searching classes and resources based on package names. This might have introduced the issue of not able to access the dtd/test.dtd.since both the ear's have dtd dirs.