springboot 整合 CXF 版本异常 java.lang.NoClassDefFoundError:ServletRegistrationBean

在使用SpringBoot 项目整合webservice组件 CXF的时候,在启动时,抛出异常如下,查阅资料初步判断为版本问题。升级到高版本后正常启动。

cxf 刚开始使用版本  3.1.7 后更新为 3.2.5 。

参考借鉴:

spring boot 1.4 版本对应cxf-spring-boot-starter-jaxws   3.1.X  版本

spring boot 1.5 版本对应cxf-spring-boot-starter-jaxws   3.2.X  版本

https://blog.csdn.net/hawako/article/details/80556676 (感谢)

https://stackoverflow.com/questions/44731070/upgrading-spring-boot-1-4-4-to-1-5-4-noclassdeffounderror-servletregistration (感谢)

<dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
            <!-- <version>3.1.7</version> -->      <version>3.2.5</version>

</dependency>
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ServletRegistrationBean
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:515)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:508)
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1188)
    at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:818)
    at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:804)
    at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:790)
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:744)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at com.zhaopin.CampusApp.main(CampusApp.java:11)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.ServletRegistrationBean
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 29 more

原文地址:https://www.cnblogs.com/yeyuchangfeng/p/9373636.html

时间: 2024-10-09 04:51:42

springboot 整合 CXF 版本异常 java.lang.NoClassDefFoundError:ServletRegistrationBean的相关文章

Kafka + Flink 出现异常 java.lang.NoClassDefFoundError: org/apache/flink/streaming/util/serialization/DeserializationSchema

我在 IDEA 环境中调试 Kafka+Flink 自己编写的例子时 代码编译都是通过的,但是进行Debug调试时,出现如下异常: java.lang.NoClassDefFoundError: org/apache/flink/streaming/util/serialization/DeserializationSchema at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetD

springboot 启动的时候报java.lang.NoClassDefFoundError: org/springframework/expression/ParserContext

解决方案:缺少spring-expression-4.1.4.RELEASE.jar包,丢进项目中就可以了 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>4.1.4.RELEASE</version> </dependency> 来源:https://

异常记录与处理 - java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

错误信息: 学习Spring,执行简单的单元测试程序时,产生以下异常: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:160) at org.springframework.context.su

异常:java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley

原因:http://m.blog.csdn.net/blog/Melody8869/46908891 java.lang.NoClassDefFoundError: com.android.volley.toolbox.Volley导致这种异常有以下几种原因: 1.adt版本问题,更新adt版本 2.jar包问题,其原因也是adt引起,只需删除libs下下的无用jar(我的v4包问题,delete) 或者: 没有将需要导入的包复制到项目的libs文件夹中.

使用CGlib出现java.lang.NoClassDefFoundError: org/objectweb/asm/Type异常【补充】

援引:使用CGlib出现java.lang.NoClassDefFoundError: org/objectweb/asm/Type异常 援引:class net.sf.cglib.core.DebuggingClassWriter has interface org.objectweb.asm.ClassVisitor as super class 源环境: IDE:IntelliJ IDEA 项目目的:测试动态代理 -- CGLIB 项目属性:Java Application 项目结构: 被

java.lang.NoClassDefFoundError 异常

在项目实施过程中,当访问某一个功能时,出现异常为  java.lang.NoClassDefFoundError  com/xxx/yyy/Zzzz > ,检查发现这个类实际已经存在于应用服务器的部署目录中.于是根据class调用的过程去排查这个类,发现代码有一处异常捕获,大概是如下样子. 1 public class Test{ 2 3 public void test1() { 4 System.out.println("test1"); 5 } 6 7 public voi

spring异常记录-----java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils

今天在练习怎样SSH中进行单元測试的时候出现下列异常: SEVERE: Exception starting filter Struts2 java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:211

struts2与struts1整合,java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

原因:我往项目的WEB-INF/lib中导入了struts2基本的包,还有struts1的core包,以及struts2-strut1-plugin的包,但是没有导入commons-loggin-1.3.1这个包,如下图 我打开commons-loggin-1.3.1这个包看了一下,果然找到了这个组件的class文件 看到这个错误的时候,我感觉就应该i啊是commons-logging这个包没有添加导致的,添加上就好了 struts2与struts1整合,java.lang.NoClassDef

【COCOS2D-X 备注篇】ASSETMANAGEREX使用异常解决备注-&gt;CHECK_JNI/CC‘JAVA.LANG.NOCLASSDEFFOUNDERROR’

本站文章均为李华明Himi原创,转载务必在明显处注明:(作者新浪微博:@李华明Himi) 转载自[黑米GameDev街区] 原文链接: check_jni.cc JNI DETECTED ERROR IN APPLICATION: JNI NewGlobalRef called with pending exception 'java.lang.NoClassDefFoundError' thrown in unknown throw location>http://www.himigame.c