springboot项目打包后运行出现问题解决办法
2016-12-08 15:29
976 查看
1
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError
原因:log4j-over-slf4j.jar 和 slf4j-log4j12.jar不能同时引入,造成死循环解决:删除pom里面的slf4j-log4j12依赖,仍然没有解决问题。这里主要是因为spring-boot-starter-logging里面引入了log4j-over-slf4j依赖,在webmagic里面又引入了slf4j-log4j12依赖。所以只能去除webmagic中的slf4j-log4j12依赖。
<!-- webmagic框架支持 -->
<dependency>
<groupId>us.codecraft</groupId>
<artifactId>webmagic-core</artifactId>
<version>0.5.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>us.codecraft</groupId>
<artifactId>webmagic-extension</artifactId>
<version>0.5.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
用exclusion去除依赖中的其他依赖
2 could not initialize class
原因:我在jdbcUtil.class里面有一段静态代码,类初始化的时候会加载这端代码,这段代码主要是读取resource下的properties文件。虽然开发运行的时候是可以运行的。但是打包后文件路径发生改变,导致无法读取文件,也就无法初始化这个类。解决办法:InputStream in = jdbcUtil.class.getResourceAsStream("/application.properties");
用这种方法去读取文件。
相关文章推荐
- SpringBoot项目打包发布到外部tomcat时,出现各种异常的解决fang
- SpringBoot web demo项目启动后立马自动关闭问题解决办法
- 集成jcaptcha到spring-boot+maven项目中时出现java.lang.NoSuchMethodError: com.jhlabs.image.WaterFilter的问题的解决方法
- springboot打包成jar文件无法正常运行,解决办法已经找到
- Maven使用package打包Spring Boot时出现:Unable to find a single main class from the following candidates的问题解决
- Eclipse运行Maven的SpringMVC项目Run on Server时出现错误:Error configuring application listener of class org.springframework.web.context.ContextLoaderListener的问题解决
- cxfreeze打包工程文件生成.exe,运行exe出现闪退问题,相关解决办法总结
- <整理>将项目打包成runable jar包并运行遇到的问题及解决办法记录。
- 用maven管理Spring项目出现org.hibernate.MappingException Unknown entity的问题解决办法
- Android项目运行junit测试类时出现错误Internal Error (classFileParser.cpp:3494)的解决办法
- VS2010 VC++ 项目添加引用 出现 Internal CPS Error问题原因及解决办法
- 【游戏开发备注之一】关于Cocos2dx_v1.x版本iphone与Android运行出现图片白块、添加GameCenter报错问题及编译Android闪退的解决办法&&CCLOG与CClog的区别
- Myeclipse下打包spring+jms集成的项目,解决打成的jar包报无法找到xml的context的schema的问题
- 解决C/S项目打包后,无法正常运行问题
- opencv+vs2010安装和运行时出现的几个问题与解决办法
- 在打包项目时出现java:1: illegal character: \65279问题的解决方法
- Android 升级 ADT 运行项目出现java.lang.NoClassDefFoundError 完美解决办法
- u-boot 编译出现的硬浮点和软浮点的问题的解决办法
- 关于.net web项目打包安装程序安装过程中出现安装未完成的解决办法
- 打开Office时出现“运行时错误91”问题的解决办法