Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring module in JBoss 7

I'm trying to set up Spring 3.0.6 libraries as a module in JBoss 7.

I have all of the jars in modules/org/springframework/main along with the following module.xml

<module xmlns:"urn:jboss:module:1.0" name="org.springframework">
    <resources>
          <resource-root path="org.springframework.beans-3.0.6.RELEASE.jar"/>
          ...
    </resources>

    <dependencies>
       <module name="javax.api"/>
       <module name="javax.servlet.api"/>
       <module name="org.apache.commons.logging"/>
    </dependencies>
</module>

I added org.springframework to the Dependencies line in my MANIFEST.MF

When I deploy the app the following exception is thrown while parsing my spring-servlet.xml file (sorry, this is from a system that is not networked)

SAXParseException: ... Cannot find the declaration of element 'beans'

My first thought was that the module is not being used but if I remove org.springframework from my Dependencies line it fails to find org.springframework.web.context.ContextLoaderListener

Everything works fine if I put the jars in WEB-INF/lib instead of using the module.

spring-servlet.xml contains the following schema reference

http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

so I put spring-beans-3.0.xsd in the same directory as spring-servlet.xml and modified the xml to

http://www.springframework.org/schema/beans spring-beans-3.0.xsd

but still no luck.

Anybody have an idea of why the class files are found but the xsd files are not?

like image 201
Mark Sholund Avatar asked Nov 11 '11 19:11

Mark Sholund


People also ask

Does spring use JBoss?

The Spring module can depend on javax. api / javaee. api provided by JBoss EAP and any public JBoss EAP module , but for other dependencies Spring has such as aopalliance , they would need to be included as resources in the module or in another custom module.

What are modules in JBoss?

JBoss Modules is designed to work with any existing library or application without changes, and its simple naming and resolution strategy is what makes that possible. Unlike OSGi, JBoss Modules does not implement a container; rather, it is a thin bootstrap wrapper for executing an application in a modular environment.

Where is module XML in JBoss?

Installing a module on WildFly / JBoss EAP requires creating a path under the JBOSS_HOME/modules folder. Under this path, you will install the JAR libraries which are part of the module and a module. xml file which describes the module itself and dependencies with other module. Within the module.

Can we use JBoss with spring boot?

With this configuration, the application is ready to deploy to any external application server. Once this is done, you can package your Spring Boot application as a war and deploy it to the JBoss server. To do that, you need to run mvn clean package , which will generate the war file.


1 Answers

Just in case the link that was given in the comments goes away, the problem is that

Problem:

The namespace configuration files are in META-INF, but that directory is not visible (nor is it configurable via jboss-deployment-structure.xml)

Solution:

   <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
        <deployment>
            <dependencies>
                <module name="org.apache.commons.logging"/>
                <module name="org.springframework" >
                    <imports>
                        <include path="META-INF**"/>
                        <include path="org**"/>
                    </imports>
                </module>
            </dependencies>
    </jboss-deployment-structure>
like image 153
Mark Sholund Avatar answered Oct 09 '22 11:10

Mark Sholund