Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

read xml from JAR file

 
Ralf Heinecke
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I want to build a webproject that includes a "core"-application. This core is in a JAR file. It uses it's own struts configuration.

I tried to reference from the web.xml in the main-project to the struts-config.xml located inside the core-jar file
like this:



As this idea did not work I've put the core config file under web-inf in the main project.
Now the config file is found by the application and properties-files defined inside it (like ApplicationResources.properties [messages]) are also found, but the xml files referenced in the struts-config (like validator-config.xml or tiles-config.xml) cannot be found.

Example:

This works:


This didn't work:



Why can properties be found inside a jar file but no xml files ? Is there a way to do this ?

DO1EH
 
Jesus Mireles
Ranch Hand
Posts: 122
IntelliJ IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually have no issues when I use XXXX.class.getClassLoader().getResourceAsStream(filename) ... I usually read some XML for configuration that may not be in a properties file.
 
Ralf Heinecke
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[quote=Lucas Mireles]I usually have no issues when I use XXXX.class.getClassLoader().getResourceAsStream(filename) ... I usually read some XML for configuration that may not be in a properties file.[/quote]

Yes it's no problem to read other xml files (like the hbm.xmls from hibernate) only the struts-config has a problem and i ask myself why.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic