weblogic 向Tomcat迁移的问题

EJB工程是在weblogic下运行,不会有什么问题,但是转到tomcat时,我们必须引入weblogic.jar
文件到工程下,这样工程在run时有时会出现问题,一般会出现如下错误:

WebappLoader[/nbglweb]: Deploy JAR /WEB-INF/lib/weblogic.jar to E:/project/nbgl/nbglweb/WEB-INF/lib/weblogic.jar
WebappClassLoader: validateJarFile(E:/project/nbgl/nbglweb/WEB-INF/lib/weblogic.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
WebappLoader[/nbglweb]: Deploy JAR /WEB-INF/lib/xalan.jar to E:/project/nbgl/nbglweb/WEB-INF/lib/xalan.jar
WebappLoader[/nbglweb]: Deploy JAR /WEB-INF/lib/xercesImpl.jar to E:/project/nbgl/nbglweb/WEB-INF/lib/xercesImpl.jar
WebappLoader[/nbglweb]: Deploy JAR /WEB-INF/lib/xml-apis.jar to E:/project/nbgl/nbglweb/WEB-INF/lib/xml-apis.jar
WebappLoader[/nbglweb]: Reloading checks are enabled for this Context
StandardManager[/nbglweb]: Seeding random number generator class java.security.SecureRandom
StandardManager[/nbglweb]: Seeding of random number generator has been completed
StandardContext[/nbglweb]: Exception starting filter AcceptFilter: java.lang.NoClassDefFoundError: javax/jms/Session
java.lang.NoClassDefFoundError: javax/jms/Session
at cn.com.jdls.foundation.util.StringUtil.(Unknown Source:19)
at cn.com.jdlssoft.rbac.filter.AcceptFilter.getPathInfo(Unknown Source:204)
at cn.com.jdlssoft.rbac.filter.AcceptFilter.init(Unknown Source:149)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:327)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:120)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3165)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3622)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:821)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:700)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)

这个错误的原因主要是因为tomcat启动时会加载servlet-api.jar包,但是该包下的的javax/servlet目标在weblogic.jar中也存在,这样就存在了冲突,所以就出现了以上情况,解决办法是:

在工程lib包下找到webligic.jar文件,用winrar打开该文件,删除javax/servlet整个包,注意这里删除的是javax目录下servlet子目录,然后重新rebuild工程,就可以没有了冲突,程序可以顺利运行。 

你可能感兴趣的:(Web)