geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John <li...@johndubchak.com>
Subject MalformedURLException loading config.xml in ear app
Date Mon, 06 Oct 2008 21:48:42 GMT
Hi,

I've deployed an ear that contains a war that initializes an application 
configuration using a servlet that loads on startup.  Here is the code I 
am using to read the xml configuration file, which is bundled inside a 
config.jar (along with several other properties and xml files) and added 
to the application class-path in the META-INF/MANIFEST.MF file using the 
Class-path attribute at build time:

InputStream is = 
getClass().getClassLoader().getResourceAsStream("config.xml");
SAXReader reader = new SAXReader();
Document doc = reader.read(is); // this throws the DocumentException

However, when the servlet loads, jdom is throwing a DocumentException 
because it appears that it cannot find the config.xml file:

Nested exception: java.net.MalformedURLException
    at java.net.URL.<init>(URL.java:601)
    at java.net.URL.<init>(URL.java:464)
    at java.net.URL.<init>(URL.java:413)
    at 
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at 
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown 
Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    at org.dom4j.io.SAXReader.read(SAXReader.java:343)
    at 
com.example.app.broker.util.ConfigAdapter.createConfiguration(ConfigAdapter.java:63)
    at com.example.app.ui.app.server.BootstrapServlet.create(Unknown Source)
    at 
com.example.app.ui.app.server.BootstrapServlet.initializeApp(Unknown Source)
    at com.example.app.ui.app.server.BootstrapServlet.init(Unknown Source)
    at javax.servlet.GenericServlet.init(GenericServlet.java:215)

I've worked through this classpath issue on JBoss last week and am 
wondering if I need to configure it differently in Geronimo for the same 
code to work portably in Geronimo.

Any feedback/help is greatly appreciated.

Thanks,
John

Mime
View raw message