Java Wss4jSecurityInterceptor on Spring boot
Eclipse抱怨说,当我试图在Spring引导配置中连接Wss4jSecurityInterceptor时,它找不到Wss4jSecurityInterceptor(它不可用于导入): 以下是pom.xml文件的相关摘录:Java Wss4jSecurityInterceptor on Spring boot,java,spring,maven,spring-security,Java,Spring,Maven,Spring Security,Eclipse抱怨说,当我试图在Spring引导配置中连接Wss4jSecurityInterceptor时,它找不到Wss4jSecurityInterceptor(它不可用于导入): 以下是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/XMLS
<?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>com.abc</groupId>
<artifactId>abc-connectivity-boot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>abc-connectivity-boot</name>
<description>FFM Connectivity via Digested UserNameToken</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-test</artifactId>
<version>2.2.1.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j</artifactId>
</dependency> -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
4.0.0
com.abc
abc连接启动
0.0.1-快照
罐子
abc连接启动
通过摘要UserNameToken的FFM连接
org.springframework.boot
spring启动程序父级
1.2.5.1发布
UTF-8
1.8
org.springframework.boot
弹簧靴起动器
org.springframework.boot
弹簧起动试验
测试
org.springframework.ws
SpringWS测试
2.2.1.发布
测试
org.springframework.boot
弹簧启动安全
org.apache.httpcomponents
httpclient
4.5
假如
我错过了什么
先谢谢你。
西缅
通过将spring ws-security依赖项添加到pom.xml(根据M.Deinum的建议),我现在看到以下运行时错误:
Caused by: java.lang.NoClassDefFoundError: org/apache/ws/security/WSSecurityException
at connect.ConnectivityTestingConfig.wss4jSecurityInterceptor(ConnectivityTestingConfig.java:68)
at connect.ConnectivityTestingConfig$$EnhancerBySpringCGLIB$$e29e9046.CGLIB$wss4jSecurityInterceptor$4(<generated>)
at connect.ConnectivityTestingConfig$$EnhancerBySpringCGLIB$$e29e9046$$FastClassBySpringCGLIB$$bb38be14.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at connect.ConnectivityTestingConfig$$EnhancerBySpringCGLIB$$e29e9046.wss4jSecurityInterceptor(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
原因:java.lang.NoClassDefFoundError:org/apache/ws/security/WSSecurityException
位于connect.connectivityestingconfig.wss4jSecurityInterceptor(connectivityestingconfig.java:68)
在connect.ConnectivityTestingConfig$$EnhancerBySpringCGLIB$$e29e9046.CGLIB$wss4jSecurityInterceptor$4()处
在connect.ConnectivityTestingConfig$$EnhancerBySpringCGLIB$$e29e9046$$FastClassBySpringCGLIB$$bb38be14.invoke()处
位于org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
位于org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
在connect.ConnectivityTestingConfig$$EnhancerBySpringCGLIB$$e29e9046.wss4jSecurityInterceptor()处
在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处
位于sun.reflect.NativeMethodAccessorImpl.invoke(未知源)
在sun.reflect.DelegatingMethodAccessorImpl.invoke处(未知源)
位于java.lang.reflect.Method.invoke(未知源)
位于org.springframework.beans.factory.support.SimpleInstallationStrategy.instantiate(SimpleInstallationStrategy.java:162)
添加以下依赖项:
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.8</version>
</dependency>
org.apache.ws.security
wss4j
1.5.8
似乎解决了上述错误,但这是一个正确的方向吗?关注事项:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-test</artifactId>
<version>2.2.1.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.18</version>
<!-- <type>jar</type> -->
<!-- <scope>compile</scope> -->
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
org.springframework.boot
spring启动程序父级
1.2.5.1发布
UTF-8
1.8
org.springframework.boot
弹簧靴起动器
org.springframework.boot
弹簧起动试验
测试
org.springframework.ws
SpringWS测试
2.2.1.发布
测试
org.springframework.boot
弹簧启动安全
org.springframework.ws
spring ws-security
org.apache.ws.security
wss4j
1.6.18
org.apache.httpcomponents
httpclient
4.5
假如
我最终得到了这个工作配置:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
<audit-lib.version>1.0.0</audit-lib.version>
<cxf.version>3.1.0</cxf.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-test</artifactId>
<!-- <version>2.2.1.RELEASE</version> -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.18</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.fuwt.iws</groupId>
<artifactId>audit-lib</artifactId>
<version>${audit-lib.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency> -->
</dependencies>
org.springframework.boot
spring启动程序父级
1.2.5.1发布
UTF-8
1.7
1.0.0
3.1.0
org.springframework.boot
弹簧靴起动器
org.springframework.boot
弹簧起动试验
测试
org.springframework.ws
SpringWS测试
测试
org.springframework.boot
弹簧启动安全
org.springframework.ws
spring ws-security
org.apache.ws.security
wss4j
1.6.18
org.apache.httpcomponents
httpclient
4.5
假如
org.fuwt.iws
审计库
${audit lib.version}
org.apache.commons
commons-lang3
3.4
事实上,我也有同样的问题,这个答案对我很有帮助。使用Maven将依赖项添加到wss4j时,您可以选择添加捆绑包或zip/源引用,从而产生如下依赖项:
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.19</version>
<type>zip</type>
<classifier>source-release</classifier>
</dependency>
org.apache.ws.security
wss4j
1.6.19
拉链
源释放
这导致了NoClassDefFoundError。我通过删除上面答案中提到的类型和分类器元素来实现它:
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.19</version>
</dependency>
org.apache.ws.security
wss4j
1.6.19
经过这次修改后,我的代码运行良好。顺便说一句,我没有必要在上面的答案中添加任何其他依赖项 我检查了spring-ws-core-2.2.1.RELEASE.jar,它似乎与spring Boot上的上述版本相关,并发现它不包含Wss4jSecurityInterceptor.java应该驻留的“安全”包,而
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.19</version>
</dependency>