我有一个没有 maven 开发的 web 服务客户端。它使用axis2+rampart+ws-security 连接到远程Web 服务并且可以正常工作。
现在,我必须维护该项目。为了避免没有 maven 的项目的所有痛苦,我准备了一个包含所有项目依赖项的 pom.xml,并且我从原始项目中复制了源代码而没有修改。
如果我从原始项目打包一个 JAR,并将该 jar(以及库的所有依赖项 jar)放在客户端的 gui 中,它就可以工作。
如果我从 maven 项目打包一个 JAR(我用 IntelliJ Idea 工件打包,以与原始项目相同的方式)并将 jar(以及库的所有依赖项 jar)放在客户端的 gui 中,之后与 web 服务握手我得到这个异常:
[pool-1-thread-7] ERROR org.apache.axis2.engine.AxisEngine - SOAP header missing
org.apache.axis2.AxisFault: SOAP header missing
at org.apache.rampart.handler.RampartReceiver.setFaultCodeAndThrowAxisFault(RampartReceiver.java:180)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:99)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:168)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:364)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.dromedian.sst.be.blogic.ws.ConsultaDaTotemStub.consultaListaAnalisi(ConsultaDaTotemStub.java:366)
at com.dromedian.sst.be.blogic.MasterTransaction.getListaAnalisi(MasterTransaction.java:869)
at com.dromedian.sst.fe.presenter.Referti$1Local$57.invoke$(Referti.fx:197)
at com.sun.javafx.functions.Function0.invoke(Function0.java:44)
at com.sun.javafx.functions.Function0.invoke$(Function0.java:38)
at com.dromedian.sst.fe.async.AsyncTask.taskRun(AsyncTask.fx:32)
at com.dromedian.sst.fe.async.AsyncTaskHelper.run(AsyncTaskHelper.java:29)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.rampart.RampartException: SOAP header missing
at org.apache.rampart.RampartEngine.process(RampartEngine.java:96)
at org.apache.rampart.handler.RampartReceiver.invoke(RampartReceiver.java:92)
... 18 more
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SST-BE</groupId>
<artifactId>ESTAV</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<!-- <repository>
<id>central</id>
<name>Maven Central</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>-->
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<!--WEBSERVICE RAMPART+AXIS2+WS-SECURITY-->
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>${AXIOM_VERSION}</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>${AXIOM_VERSION}</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-dom</artifactId>
<version>${AXIOM_VERSION}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>${AXIS2_VERSION}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>${AXIS2_VERSION}</version>
<exclusions>
<exclusion>
<artifactId>geronimo-activation_1.1_spec</artifactId>
<groupId>org.apache.geronimo.specs</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>${AXIS2_VERSION}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>${AXIS2_VERSION}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>${AXIS2_VERSION}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
<artifactId>neethi</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart</artifactId>
<version>${AXIS2_VERSION}</version>
<exclusions>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>org.apache.xalan</groupId>
</exclusion>
<exclusion>
<artifactId>axiom-api</artifactId>
<groupId>org.apache.ws.commons.axiom</groupId>
</exclusion>
<exclusion>
<artifactId>wss4j</artifactId>
<groupId>org.apache.ws.security</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-core</artifactId>
<version>${AXIS2_VERSION}</version>
<exclusions>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>org.apache.xalan</groupId>
</exclusion>
<exclusion>
<artifactId>wss4j</artifactId>
<groupId>org.apache.ws.security</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>2.5.1-1</version>
<exclusions>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>xalan</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>commons-httpclient</artifactId>
<groupId>commons-httpclient</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<artifactId>log4j-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-policy</artifactId>
<version>${AXIS2_VERSION}</version>
<exclusions>
<exclusion>
<artifactId>opensaml</artifactId>
<groupId>org.opensaml</groupId>
</exclusion>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>org.apache.xalan</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-trust</artifactId>
<version>${AXIS2_VERSION}</version>
<exclusions>
<exclusion>
<artifactId>opensaml</artifactId>
<groupId>org.opensaml</groupId>
</exclusion>
<exclusion>
<artifactId>xalan</artifactId>
<groupId>org.apache.xalan</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.9</version>
<exclusions>
<exclusion>
<artifactId>opensaml</artifactId>
<groupId>org.opensaml</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- END WEBSERICE -->
<!-- HIBERNATE JPA-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${HIBERNATE_VERSION}</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.0.1.GA</version>
<exclusions>
<exclusion>
<artifactId>activation</artifactId>
<groupId>javax.activation</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${HIBERNATE_VERSION}</version>
</dependency>
<!--END HIBERNATE-->
<!--GOOGLE-->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>13.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>1.3.9</version>
</dependency>
<!--END GOOGLE-->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk16</artifactId>
<version>${BOUNCYCASTLE_VERSION}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>${BOUNCYCASTLE_VERSION}</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-ext</artifactId>
<version>1.7</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>eu.medsea.mimeutil</groupId>
<artifactId>mime-util</artifactId>
<version>2.1.3</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
<exclusion>
<artifactId>slf4j-log4j12</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<!-- LOCAL DEPENDENCIES -->
<dependency>
<groupId>Dromedian</groupId>
<artifactId>DromedianArduinoUNO</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/DromedianArduinoUNO.jar</systemPath>
</dependency>
<dependency>
<groupId>jxsf</groupId>
<artifactId>jxfsclient</artifactId>
<version>3.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/jxfsclient3.0.jar</systemPath>
</dependency>
<dependency>
<groupId>jxsf</groupId>
<artifactId>jxfsserver</artifactId>
<version>3.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/jxfsserver3.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.6.1</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>MolliesClient</groupId>
<artifactId>MolliesClient</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/MolliesClient.jar</systemPath>
</dependency>
<dependency>
<groupId>RXTXcomm</groupId>
<artifactId>RXTXcomm</artifactId>
<version>2.2pre1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/RXTXcomm.jar</systemPath>
</dependency>
</dependencies>
<properties>
<AXIOM_VERSION>1.2.13</AXIOM_VERSION>
<AXIS2_VERSION>1.6.2</AXIS2_VERSION>
<HIBERNATE_VERSION>4.0.1.Final</HIBERNATE_VERSION>
<BOUNCYCASTLE_VERSION>1.46</BOUNCYCASTLE_VERSION>
</properties>
</project>
感谢您的所有建议和帮助!