在使用Eclipse+Tomcat5.5+jdk1.5,做项目时
出现这个错误:
exception
org.apache.jasper.JasperException: org.apache.jasper.tagplugins.jstl.If
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
org.apache.jasper.JasperException: org.apache.jasper.tagplugins.jstl.If
org.apache.jasper.compiler.TagPluginManager.init(TagPluginManager.java:109)
org.apache.jasper.compiler.TagPluginManager.apply(TagPluginManager.java:51)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.ClassNotFoundException: org.apache.jasper.tagplugins.jstl.If
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
java.lang.ClassLoader.loadClass(ClassLoader.java:306)
java.lang.ClassLoader.loadClass(ClassLoader.java:251)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:164)
org.apache.jasper.compiler.TagPluginManager.init(TagPluginManager.java:106)
org.apache.jasper.compiler.TagPluginManager.apply(TagPluginManager.java:51)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
这么回事?
------解决方法--------------------------------------------------------
版本冲突了,你的代码是从Tomcat5.0下考到5.5里的吧?
你用winrar对比一下5.0和5.5的Tomcat\common\lib\jasper-compiler.jar 就明白了。5.0的if.class的包路径是org.apache.jasper.tagplugins.jstl.If,然而5.5的则变成了
org.apache.jasper.tagplugins.jstl.core.If,就多了一个“core”。
要不,把那个5.0的jasper-compiler.jar考到你的项目WEB-INF\lib下,要不,把你JSP里用的标签对应的TLD文件里的class路径改成org.apache.jasper.tagplugins.jstl.core.If
我估计你的TLD文件是直接从5.0以前版本的项目中直接考过来的对吧?