Spring Boot and Axis2 client runtime issue with Rampart

2.4k Views Asked by At

I am trying to use Axis 2 client to work with a soap based web service. I use Rampart 1.7.1 for WSO Authentication. After I created the stub code using axis2tools I installed the jar files into maven repository and use them as dependency in my pom.xml file. Also I use spring boot for the rest of application which I use the generated libraries as soap client api.

Everything is good in dev environment I can work with web service. And also when I use

mvn spring-boot:run

it works fine and webservice communication is good from UI to Webservice and back(end to end).

when I use

java -jar target/fatjar.jar

When I send request to web service I receive the following error at console:

2017-11-17 16:00:35.140  WARN 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.AxisConfigBuilder   : Unable to instantiate deployer org.apache.axis2.deployment.ServiceDeployer; see debug logs for more details
2017-11-17 16:00:35.161  INFO 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.DeploymentEngine    : No services directory was found under /home/mehdi/Workspace/EclipseWS/src/main/resources/axis.
2017-11-17 16:00:35.179  INFO 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.ModuleDeployer      : Deploying module: rampart-1.7.1 - file:/home/mehdi/Workspace/EclipseWS/src/main/resources/axis/modules/rampart-1.7.1.mar
2017-11-17 16:00:35.185 ERROR 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.ModuleDeployer      : The rampart-1.7.1.jar module, which is not valid, caused The /home/mehdi/Workspace/EclipseWS/target/cybersourceClient-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/rampart-1.7.1.jar file cannot be found.

org.apache.axis2.AxisFault: The /home/mehdi/Workspace/EclipseWS/target/cybersourceClient-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/rampart-1.7.1.jar file cannot be found.
    at org.apache.axis2.deployment.repository.util.DeploymentFileData.setClassLoader(DeploymentFileData.java:118) [axis2-kernel-1.7.1.jar!/:1.7.1]
    at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:133) ~[axis2-kernel-1.7.1.jar!/:1.7.1]
    at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:144) [axis2-kernel-1.7.1.jar!/:1.7.1]
    at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) [axis2-kernel-1.7.1.jar!/:1.7.1]
    at org.apache.axis2.deployment.RepositoryListener.loadClassPathModules(RepositoryListener.java:222) [axis2-kernel-1.7.1.jar!/:1.7.1]

same line when I use "mvn spring-boot:run" is

2017-11-17 16:13:14.270  WARN 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.AxisConfigBuilder   : Unable to instantiate deployer org.apache.axis2.deployment.ServiceDeployer; see debug logs for more details
2017-11-17 16:13:14.286  INFO 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.DeploymentEngine    : No services directory was found under /home/mehdi/Workspace/EclipseWS/src/main/resources/axis.
2017-11-17 16:13:14.301  INFO 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.ModuleDeployer      : Deploying module: rampart-1.7.1 - file:/home/mehdi/Workspace/EclipseWS/src/main/resources/axis/modules/rampart-1.7.1.mar
2017-11-17 16:13:14.304  INFO 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.ModuleDeployer      : Deploying module: rampart-1.7.1 - file:/home/mehdi/.m2/repository/org/apache/rampart/rampart/1.7.1/rampart-1.7.1.jar

Please notice that it fails for:

...The rampart-1.7.1.jar module, which is not valid,...

I don't know why with maven launch it works but with java -jar throws exception.

1

There are 1 best solutions below

0
Mehdi On

According to Spring Boot documentation (Further Config section) in here I needed to add the rampart library to unpacked list in spring-boot-maven-plugin as follows:

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <requiresUnpack>
                        <requiresUnpack>
                            <groupId>org.apache.rampart</groupId>
                            <artifactId>rampart</artifactId>
                        </requiresUnpack>
                    </requiresUnpack>
                </configuration>
</plugin>