user3422290
user3422290

Reputation: 283

Jboss EAP 6.4 Module resource-root path

I tried to create Jboss module that includes jks and jar files. Though I am able to make it work, but I don't understand why it works. When I define resource-root for both jar and jks files.

<module xmlns="urn:jboss:module:1.1" name="my.module"> <resources> <resource-root path="foo.jar"/> <resource-root path="mykey.jks"/> </resources> </module>

I get the following error:

org.jboss.modules.xml.XmlPullParserException: Failed to add resource root 'mykey.jks' at path 'mykey.jks' (position: END_TAG seen ..."foo.jar"/> \r\n ... @3:42) caused by: java.util.zip.ZipException: error in opening zip file

But if I define the resource-root as <resource-root path="."/> everything works fine.

Does anyone knows why it works when I use "." as resource-root path? What's the magic that Jboss did?

Thanks David

Upvotes: 2

Views: 6231

Answers (2)

Davy Jones
Davy Jones

Reputation: 111

Try to give resource root's path and name attributes. If you give path attribute only, jboss will try to open it with zip util

eg:

<module xmlns="urn:jboss:module:1.0" name="az.ac.localit">
    <resources>
        <resource-root path="." name="travel_app.properties"></resource-root>
    </resources>
</module>

Upvotes: 2

eis
eis

Reputation: 53482

Quoting this:

A resource root is a specification of a location where the class loader for a module will look for classes and resources. Each module has zero or more resource roots, though most regular modules will contain exactly one, which refers to the JAR file with the module's content.

In human terms, resource-root is meant to be used for a directory or a .zip file (which .jar, .rar etc files also are). A jks file is not a .zip file or a directory, so you get an error opening a .zip file.

Once a keystore (.jks) file is in the classpath, it can be loaded through KeyStore abstraction. A keystore file needs to be in classpath as-such, so that is why specifying the dot as resource root works. JBoss didn't actually do any magic there.

Upvotes: 5

Related Questions