0

我有一个 Thorntail v2.3.0 微服务,它包含一个从 WSDL 生成的 CXF 客户端。我有两种使用 Maven 3.5.3 从命令行启动服务的方法:

mvn clean install thorntail:run

或者直接使用 JVM 1.8.0:

mvn clean install
java -jar target/myservice-thorntail.jar

我希望该过程使用这两种方法以相同的方式执行。但是,使用第一种方法,调用我的 CXF 客户端时出现以下错误。通过Java命令执行时不会发生错误。

WARN  [org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader] (Thread-79) Could not load 
    or register WS-SecurityPolicy related classes. Please check that (the correct version of) 
    Apache WSS4J is on the classpath: null
WARN  [org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader] (Thread-79) Could not load 
    or register WS-SecurityPolicy related classes. Please check that (the correct version of) 
    Apache WSS4J is on the classpath: Could not initialize class org.apache.wss4j.stax.setup.WSSec
WARN  [org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl] (Thread-79) No assertion builder for type 
    {http://schemas.xmlsoap.org/ws/2005/07/securitypolicy}HttpToken registered.
ERROR [stderr] (Thread-79) Exception in thread "Thread-79" javax.xml.ws.soap.SOAPFaultException: 
    None of the policy alternatives can be satisfied.

我已尝试按照警告中的建议将依赖项添加到 WSS4J,但没有效果。我的 POM 包含这些依赖项:

<dependency>
    <groupId>apache-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.0</version>
    <type>jar</type>
</dependency>

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>javax.annotation</groupId>
    <artifactId>javax.annotation-api</artifactId>
    <version>1.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.datatype</groupId>
    <artifactId>jackson-datatype-joda</artifactId>
    <version>2.4.1</version>
</dependency>

<dependency>
    <groupId>io.thorntail</groupId>
    <artifactId>jpa</artifactId>
</dependency>

<dependency>
    <groupId>io.thorntail</groupId>
    <artifactId>ejb</artifactId>
</dependency>

<dependency>
    <groupId>io.thorntail</groupId>
    <artifactId>datasources</artifactId>
</dependency>

<dependency>
    <groupId>io.thorntail</groupId>
    <artifactId>webservices</artifactId>
</dependency>

<dependency>
    <groupId>io.thorntail</groupId>
    <artifactId>jaxrs-jaxb</artifactId>
</dependency>

<dependency>
    <groupId>io.thorntail</groupId>
    <artifactId>cdi</artifactId>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.3.1.Final</version>
    <exclusions>
        <exclusion>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>5.2.12.Final</version>
</dependency>

我的假设是它与依赖相关,但我不确定从哪里开始寻找解决方案。我更喜欢使用第一个命令执行,因为我可以在需要时覆盖配置值。

如何跟踪和诊断此问题的原因?

4

0 回答 0