Reputation: 7067
I am using one third party jar in my code. In the jar file , in one of the classes, when I opened the class using de-compiler, the code below is written:
java.net.URL fileURL = ClassLoader.getSystemResource("SOAPConfig.xml");
Now I am using this in my webapplication, where should I place this SOAPConfig.xml so that it will find the fileURL.
Note: I have tried putting this XML in WEB-INF/classes folder. But it is not working. Your help will be appreciated.
In Addition: In the explaination you have given, It is telling me not to use this code snippet inside the third party jar in this way...What is the exact usage of this statement
Upvotes: 0
Views: 98
Reputation: 403591
ClassLoader.getSystemResource
will load the resource from the system classloader, which uses the classpath of the application as started from the command line. Any classloaders created by the application at runtime (i.e. the one that looks in WEB-INF/classes
) are not on the system classpath.
You need to
SOAPConfig.xml
in one of those. If necessary, change the classpath in the script to look in a separate directory that's just used for your config file.ClassLoader.getSystemResource
in the library, kick them squarely in the nuts, and tell them never to do that again.Upvotes: 2