Reputation: 414
I was going through JBoss.org how to put external file in the classpath, but it doesn't work.
I have 1 file with name "config.properties". It is placed in jboss/modules/com/xsiraul/test/main/ folder. In the same folder there is module.xml which looks like -
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.xsiraul.test">
<resources>
<resource-root path="."/>
</resources>
</module>
I have load config.properties
file from Java using -
InputStream settingsStream = getClass().getClassLoader().getResourceAsStream("config.properties");
Java class is in package named com.xsiraul.test
The problem is that method getResourceAsStream
returns NULL and I don't understand why. Maybe somebody has any ideas?
I use JBoss
EAP
6.1.0.GA version.
Upvotes: 2
Views: 6366
Reputation: 3500
Did you declare the dependency to your module? maybe you missed that..
Add Dependencies: com.fico.test
to your manifest.mf file
Upvotes: 2
Reputation: 1969
Copy your 'config.properties' and 'module.xml' in the following directory:
<JBOSS-6.1-ROOT>/modules/system/layers/base/com/fico/test/main
Extend '/standalone/configuration/standalone.xml' by the following sub-system:
<subsystem xmlns="urn:jboss:domain:ee:1.1">
<global-modules>
<module name="com.fico.test" slot="main"/>
</global-modules>
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
</subsystem>
Restart JBoss
Upvotes: 2