正式项目中,web项目中的slf4j* jar包 删除 -- 项目错误记录

否则会与tomcat的lib包里面的slf4j相冲突

参考 http://stackoverflow.com/questions/29504180/slf4j-error-class-loader-have-different-class-objects-for-the-type


PS:linux系统中,实时查看tomcat启动日志

1、先切换到:cd tomcat/logs

2、tail -f catalina.out

3、这样运行时就可以实时查看运行日志了

Ctrl+c 是退出tail命令。


——————————————————————————————————————————————————

The Tomcat log shows you have another slf4j-1.7.7.jar on the classpath:

Using CLASSPATH: /usr/local/Cellar/tomcat/8.0.18/libexec/bin/jul-to-slf4j-1.7.7.jar:/usr/local/Cellar/tomcat/8.0.18/libexec/bin/slf4j-api-1.7.7.jar:/usr/local/Cellar/tomcat/8.0.18/libexec/bin/logback-classic-1.1.2.jar:/usr/local/Cellar/tomcat/8.0.18/libexec/bin/logback-core-1.1.2.jar:/usr/local/Cellar/tomcat/8.0.18/libexec/bin/logback-config/:/usr/local/Cellar/tomcat/8.0.18/libexec/bin/bootstrap.jar:/usr/local/Cellar/tomcat/8.0.18/libexec/bin/tomcat-juli.jar

When Tomcat is been initialized, it initialize jul-to-slf4j and slf4j-api. These jars are been loading by the Classloader which loaded the Tomcat jars (sun/misc/Launcher$AppClassLoader).

When your application tries to access the slf4j-api classes, it uses the WebApplication Classloader (org/apache/catalina/loader/WebappClassLoader), which by default search for classes definition on the app classpath before the system classpath. Note this can be changed: https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html

In Java, the class signature is composed of the class full qualified name and the classloader that loaded the class. If a class is loaded two times from two different classloaders (same hierarchy), there will be two different classes for the JVM. Trying to point a object reference of one class to a variable of the other will trhow a ClassCastException. Check this blog post (item 5) for more info on this:https://techblug.wordpress.com/2012/03/17/classloader-tips/

So, as far as I know, you can fix this by removing the slf4j-*.jar from the Tomcat classpath,or if you have more then one webapp using the same version of slf4j, you can remove the jars from the webapp, so it will use those loaded by Tomcat classloader.



------------------------------------

angularjs中,添加的片段必须完整的包含在一个封闭的元素内,例如 <div></div>  或 <span></span>之内。开放式的多个元素是无法动态添加的。

tomcat超级大坑

将ROOT内文件都删除,将项目部署进ROOT之后,examples  docs manager  host-manager 这几个二级目录均不能用,否则会和tomcat固有的二级目录冲突!!! 即不能有 http://www.xxx.com/examples/..........等等形式









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值