Read XML Config File From Within EJB JAR
Hello,
I have an EJB JAR, erptsecejb.jar. Within that jar is a class, MyClass which needs to read an XML file also contained within that same JAR. Here is what the paths within the EJB JAR may look like:
com/foo/bar/config/ConfigFile.xml
com/foo/bar/other/MyClass.class
I've tried doing the following:
URL mUrl = MyClass.class.getClassLoader().getResource("com/foo/bar/config/ConfigFile.xml");
URL mUrl = MyClass.class.getClassLoader().getResource("com.fo o.bar.config.ConfigFile.xml");
URL mUrl = MyClass.class.getClassLoader().getResource("Config File.xml");
I also tried added the following to the Manifest file:
Class-Path: com/foo/bar/config
No matter what I do, the class can't find this file. When I perform a mUrl.getPath(), I get a null-pointer exception.
Any suggestions?
Thanks,
Leo Hart
|