Question

Unluckily my attempts in creating a module for JBoss7 (and WildFly8.0.0.Beta2) failed and I can't see the mistake I made, what I did was:

1.) Creating a directory at <wf-root>/modules/org/apache/shiro/main,

2.) Copying the files shiro-core-1.2.2.jar, shiro-ehcache-1.2.2.jar and shiro-web-1.2.2.jar into it

3.) Creating a file called module.xml with following contents:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.apache.shiro">  
    <resources>  
        <resource-root path="shiro-core-1.2.2.jar"/>  
        <resource-root path="shiro-ehcache-1.2.2.jar"/>  
        <resource-root path="shiro-web-1.2.2.jar"/>  
    </resources>
</module>

Next I started up my server. Unluckily deploying an EAR file, which requires shiro failed deploying with the following error (snipplet):

Caused by: java.lang.NoClassDefFoundError: org/apache/shiro/mgt/SecurityManager
    at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_25]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:792) [rt.jar:1.7.0_25]
    at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:345) [jboss-modules.jar:1.3.0.Final]
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:423) [jboss-modules.jar:1.3.0.Final]
    ... 31 more

Any ideas?

Was it helpful?

Solution

You can express a dependency on your custom module more simply and succinctly merely by adding a single line to the main section of your META-INF/MANIFEST.MF file:

Dependencies: org.apache.shiro

For more information, see: https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly

OTHER TIPS

While this has already been answered, and the answer is correct, it left out a related solution: global module.

From the same link in the previous answer, you could also configure this as a global module and then you would not have to alter your MANIFEST.MF. I use this when multiple applications in the same container share the same dependencies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top