CXF—六天系列—第六天—找不到MessageFactoryImpl和BouncyCastleProvider类报错

学习CXF+Spring认证时出现几个错误,缺少MessageFactoryImpl和BouncyCastleProvider类

一、Caused by: java.lang.ClassNotFoundException:org.bouncycastle.jce.provider.BouncyCastleProvider

这个是缺少认证包bcprov-jdk15-143.jar,下载即可

二、错误信息如下:

Caused by: java.lang.ClassNotFoundException: org.apache.axis.soap.MessageFactoryImpl

<wbr><wbr><wbr> at java.net.URLClassLoader$1.run(</wbr></wbr></wbr>URLClassLoader.java:200)

<wbr><wbr><wbr> at java.security.AccessController.doPrivileged(</wbr></wbr></wbr>Native Method)

<wbr><wbr><wbr> at java.net.URLClassLoader.findClass(</wbr></wbr></wbr>URLClassLoader.java:188)

<wbr><wbr><wbr> at java.lang.ClassLoader.loadClass(</wbr></wbr></wbr>ClassLoader.java:306)

<wbr><wbr><wbr> at sun.misc.Launcher$AppClassLoader.loadClass(</wbr></wbr></wbr>Launcher.java:268)

<wbr><wbr><wbr> at java.lang.ClassLoader.loadClass(</wbr></wbr></wbr>ClassLoader.java:251)

<wbr><wbr><wbr> at javax.xml.soap.MessageFactory.newInstance(</wbr></wbr></wbr>MessageFactory.java:50)

<wbr><wbr><wbr> ... 10 more</wbr></wbr></wbr>

处理:

原因是调用了axissoap.MessageFactoryImpl,cxf应该用的是sun
<wbr><wbr><wbr><wbr> 在注册安全拦截器之前执行下面代码就可以了</wbr></wbr></wbr></wbr>

System.setProperty("javax.xml.soap.MessageFactory",<wbr>"com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");</wbr>

你可能感兴趣的:(Provider)