Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How add external resource folder on JBoss7?

Following matter is JBossAS 7.1 Developer Guider:

Change ResourceBundle location In previous versions of AS, the JBOSS_HOME/server//conf/ was available in the classpath. Hence the properties files in that location were available in the classpath of the application.

In AS7, to get those properties available in the classpath, package them within your application. For example, if you are deploying a .war then package those properties in WAR WEB-INF/classes/ folder. If you want those properties accessible to all components in a .ear, then package them at the root of some .jar and place that jar in EAR lib/ folder.

But this method is not so good if there are too many resource files, we can't package all resource file to jar or ear.

For the new class loading method - module. I try following method:

create module.xml file .. you will chose module name... for instnace custom.myconfig

<resources>
    <resource-root path="."/>
    <!-- Insert resources here -->
</resources>

<dependencies>     
</dependencies> </module>   In your jboss-deployment-structure.xml include this module to your app
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
    <dependencies>
        <module name="custom.myconfig/>
    </dependencies>
    <resources>
    </resources>
</deployment>

<sub-deployment name="My_WAR.war">
    <dependencies>
        <module name="custom.myconfig" />
    </dependencies>
</sub-deployment>

https://community.jboss.org/message/723631

But I found you can't set absolute path to path, like: [resource-root path=""C:\resourcefolder"].

That's means you also need include all resource files on JBossAS 7.

It is very simple on JBossAS 5.x-6.x, only need add folder path like "C:\resourcefolder" to classpath is OK. But its like an impossible mission on JBossAS7.

like image 688
Ariel Zehao Zhang Avatar asked Nov 03 '22 22:11

Ariel Zehao Zhang


1 Answers

Finally, I soft link resource folder to JBossAS 7.....

Linux:

In -s

Windows:

MKLINK /D

or

Junction.exe
like image 188
Ariel Zehao Zhang Avatar answered Nov 12 '22 12:11

Ariel Zehao Zhang