简体   繁体   中英

Package a WAR in with a JBoss SAR

I have a JBoss SAR with which I'd like to package a WAR (A Spring MVC web app). The reason being for this web application to be available on any JBoss where this SAR is deployed. I've added a dependency on the WAR in the SAR's POM and see that they're packaged together in the SAR. However, the web app isn't found when I open its URL, whereas if I deploy the web app separately, it opens ok.

Edit I'm now trying to package the WAR and SAR into an EAR. I verified that I can deploy the SAR and WAR separately and that they each work this way. I verified that the WAR deploys correctly when packaged in the EAR with the SAR. However, the SAR is not deployed when packaged in the EAR. Here is the EAR's POM (identifiers made generic):

<groupId>com.company</groupId>
<artifactId>my-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>

<!-- name, url, properties omitted -->

<dependencies>
<!-- NOT Deploying -->
<dependency>
    <groupId>com.company</groupId>
        <artifactId>MySAR</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>sar</type>
</dependency>
<!-- Deploys OK -->
<dependency>
    <groupId>com.company</groupId>
        <artifactId>MyWAR</artifactId> 
        <version>1.0.0-BUILD-SNAPSHOT</version>
        <type>war</type>
</dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <modules>
                    <sarModule>
                        <groupId>com.company</groupId>
                        <artifactId>MySAR</artifactId>
                    </sarModule>
                    <webModule>
                        <groupId>com.company</groupId>
                        <artifactId>MyWAR</artifactId>
                    </webModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>

You can't actually do that. A service archive (SAR) is meant to define components that are loaded and function independently. The most obvious form is a service that you deploy on the JMX domain.

A sar can either be deployed independently or it can be bundled in an EAR (see support in the maven ear plugin ).

But you can't deploy a web application in a sar. You should have two different deployment units for those or package them in an EAR.

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