简体   繁体   中英

Load files from WEB-INF/wsdl/Schemas/Messages/ directory to class path in jboss eap 6.4

I am migrating my application from jboss eap 5.1 to 6.4. There are some xsd files I have kept in WEB-INF/wsdl/Schemas/Messages/ folder. and in my code I am trying to retrieve the file using following logic:

this.getClass().getClassLoader().getResource("/../wsdl/Schemas/Messages/MsgSearchDetails.xsd").

In jboss eap 5.1 it works fine but in 6.4 I am not able to get the file on this path. I know that jboss eap 6.4 loads file from WEB-INF/classes and WEB_INF/lib directory in classpath.

So how can I read xsd files from WEB-INF/wsdl/Schemas/Messages/ folder in jboss eap 6.4?

You can add all xsd files in a module folder in JBOSS_HOME/modules/system/layers/base/your-module/main and define a module.xml here like this:

<?xml version="1.0" encoding="UTF-8"?>
 <module xmlns="urn:jboss:module:1.1" name="your-module">
 <resources>
<!-- Modules -->
<resource-root path="."/>
</resources>
</module>

Add this module as a dependency to your WAR in a jboss-deployment-structure.xml and get it like this then:

Thread.currentThread().getContextClassLoader().getResourceAsStream("MsgSearchDetails.xsd")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM