由java.lang.NoclassDefFoundError: org/springframework/core/KotlinDetector引发的一系列问题及解决方案
事情的起因是这样的,原先项目使用的是spirngMvc项目,spring的版本是4.0.0 RELEASE,修改完代码后在本地运行一切正常,部署到线上linux服务器,抛出了如下异常
好,一百度,都是说spring版本太低,必须换成5.0.1以上的版本才行,于是把版本换成大家用的5.0.2.RELEASE,然后把mybatis,mybatis-spring的版本都相应的更新成了新的,更换后最新的问题是log4j无法与spring5.0以上兼容需要更换成log4j2,这个网上很多教程都有,就不细说,我参考的是这个https://blog.csdn.net/zhiyuzhe/article/details/78850238
然后就开始出现一系列错误,都是说jar冲突;比如这个org.springframework.beans.factory.config.ConfigurableBeanFactory.getSingleto和这个Initialization of bean failed; nested exception is java.lang.AbstractMethodError,就换了spring-data-redis的jar;然后又抛出了这个问题The alias 'TrackerGoods' is already mapped to the value 'com.coglink.platform.把这个实体类导包删除后,用maven clean了好几次,这里已经不记得换了多少次jar版本,但是前提是记得要把spring相关的所有jar都保存同一个版本;
改完后还是没有效果,还是各种错误,百度则是说jar冲突,我也知道是jar冲突啊,但是在项目中所有jar都已经保持同个版本的了,后来看到一则博客说activemq-all.jar中已经引入了spring相关的jar,会与现有的jar冲突,于是乎按照他的操作把activemq-all.jar去掉,用了下面这些jar自己导activemq相关的内容,jar如下:
<!--mq开始-->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>5.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>${spring.version}</version>
</dependency>
<!--mq结束-->
改完,之前那些奇奇怪怪的错误不报了,报了点看得懂的Failed to introspect Class [org.springframework.data.redis.connection.jedis.JedisConnectionFactory] …然后又报spring-data-redis与redis冲突,之后就把
spring-data-redis 版本改为1.7.1.RELEASE,redis改为2.9.0版本,现在maven clean项目,重启,终于不报错了,终于出现项目运行成功的界面了
以为自己已经成功了,可是发送post请求测试项目,没有异常,但是就是404,一直无法访问
很是无语,发挥坚持到底的决心接着百度,看人家说的配置我一个也没少啊,不明白为什么,在无意中看到tomcat localhost log中有个异常抛出
一查原来还有一个jar没有更新过来啊,说是这个fastxml,于是更新了jacksoncore的版本由2.4.5更新到2.9.5,重启,OK了
部署到linux服务器也可以正常运行了,下面附上我的完整pom.文件,希望可以帮到你
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- spring 版本号 -->
<spring.version>5.1.4.RELEASE</spring.version>
<!-- mybatis 版本号 -->
<mybatis.version>3.5.0</mybatis.version>
<mybatisSpring.version>2.0.0</mybatisSpring.version>
<!-- log4j 日志文件管理包版本 -->
<slf4j.version>1.7.7</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<!-- mysql 数据据链接版本 -->
<mysql.version>5.1.29</mysql.version>
<!-- jstl 版本 -->
<jstl.version>1.2</jstl.version>
<!-- standard 版本 -->
<standard.version>1.1.2</standard.version>
<!-- jackson 数据json转换版本 -->
<jackson.version>1.9.13</jackson.version>
<!-- fastjson 数据json转换版本 -->
<fastjson.version>1.1.41</fastjson.version>
<!-- pinyin4j 汉字转拼音版本 -->
<pinyin4j.version>2.5.0</pinyin4j.version>
<!-- druid 阿里巴巴数据源包 -->
<druid.version>1.0.2</druid.version>
<!-- fileupload 文件上传版本 -->
<fileupload.version>1.3.1</fileupload.version>
<!-- aspectj 版本 -->
<aspectj.version>1.8.1</aspectj.version>
<!-- logback 版本 -->
<logback.version>1.1.2</logback.version>
<!-- jsoup 版本 -->
<jsoup.version>1.7.3</jsoup.version>
<!-- rome rss 版本 -->
<rss.version>1.5.0</rss.version>
<!-- commons-codec版本 -->
<commonsCodec.version>1.9</commonsCodec.version>
<!-- joda-time -->
<jodatime.version>1.5.2</jodatime.version>
<!-- jackson core -->
<jacksoncore.version>2.9.5</jacksoncore.version>
<!-- redis 版本 -->
<redis.version>2.9.0</redis.version>
<!-- commons-lang 版本 -->
<commons-lang.version>3.3.1</commons-lang.version>
<!-- cxf 接口 -->
<cxf.version>2.5.0</cxf.version>
<project.version>0.0.1-SNAPSHOT</project.version>
<dubbo.version>2.5.3</dubbo.version>
<activemq.version>5.13.2</activemq.version>
<springRedis.version>1.7.1.RELEASE</springRedis.version>
<zookeeper.version>3.4.6</zookeeper.version>
<zkclient.version>0.10</zkclient.version>
<pool2.version>2.0</pool2.version>
<jsonLib.version>2.4</jsonLib.version>
<servletApi.version>2.5</servletApi.version>
<ojdbc6.version>11.2.0.1.0</ojdbc6.version>
<pagehelper.version>4.1.1</pagehelper.version>
<mapper.version>3.3.4</mapper.version>
<paginator.version>1.2.15</paginator.version>
<log4jdbcRemix.version>0.2.7</log4jdbcRemix.version>
<sha-exception.version>1.0.0</sha-exception.version>
<commons-httpclient.version>3.1</commons-httpclient.version>
<sms.version>0.9.2</sms.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- 平台依赖包 -->
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-biz</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-rpc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-rpcapi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-dao</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-config</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-controller</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.platformCore</groupId>
<artifactId>platformCore-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ce.sha</groupId>
<artifactId>sha-exception</artifactId>
<version>${sha-exception.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>${commons-httpclient.version}</version>
</dependency>
<!-- spring核心包 -->
<!-- springframe start -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- springframe end -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>${springRedis.version}</version>
</dependency>
<!--<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>${activemq.version}</version>
</dependency>-->
<!--mq开始-->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>5.15.0</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>${spring.version}</version>
</dependency>
<!--mq结束-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
</dependency>
<dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<version>${zkclient.version}</version>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zookeeper.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servletApi.version}</version>
</dependency>
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- redis 客户端 -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>${redis.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>${pool2.version}</version>
</dependency>
<!-- jackson core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jacksoncore.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jacksoncore.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jacksoncore.version}</version>
</dependency>
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
<!-- rss rome jar start -->
<dependency>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>${rss.version}</version>
</dependency>
<dependency>
<groupId>com.rometools</groupId>
<artifactId>rome-fetcher</artifactId>
<version>${rss.version}</version>
</dependency>
<!-- rss rome jar end -->
<!-- aspectj -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<!-- 上传文件 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${fileupload.version}</version>
</dependency>
<!-- 阿里巴巴数据源 包 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- mybatis核心包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!-- mybatis/spring包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatisSpring.version}</version>
</dependency>
<!-- jackson -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- fastjson -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<!-- 解析拼音包start -->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>${pinyin4j.version}</version>
</dependency>
<!-- mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<!--通用Mapper插件 -->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>${mapper.version}</version>
</dependency>
<dependency>
<groupId>com.github.miemiedev</groupId>
<artifactId>mybatis-paginator</artifactId>
<version>${paginator.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${ojdbc6.version}</version>
</dependency>
<dependency>
<groupId>org.lazyluke</groupId>
<artifactId>log4jdbc-remix</artifactId>
<version>${log4jdbcRemix.version}</version>
</dependency>
<!--log4j2的依赖包-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>${jsonLib.version}</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${standard.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang.version}</version>
</dependency>
<!-- cxf webservice -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- 短信功能-->
<dependency>
<groupId>com.github.qcloudsms</groupId>
<artifactId>sms</artifactId>
<version>${sms.version}</version>
</dependency>
<dependency>
<groupId>com.coglink.command</groupId>
<artifactId>command-rpcapi</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resource</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</testResource>
<testResource>
<directory>src/test/resource</directory>
</testResource>
</testResources>
</build>