This is a bit insane I must say. I have the following setup: Eclipse Helios, 64-bit JDK (1.6.0_21), Tomcat 6 (6.0.29), and a pretty straightforward JSP that does nothing other than evaluate the date.
I get this crap all the time:
javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/el/ELResolver
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:268)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
test.test01.MainServlet.goToPage(MainServlet.java:50)
test.test01.MainServlet.doGet(MainServlet.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NoClassDefFoundError: javax/el/ELResolver
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
java.lang.ClassLoader.defineClass(ClassLoader.java:616)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
java.net.URLClassLoader.access$000(URLClassLoader.java:58)
java.net.URLClassLoader$1.run(URLClassLoader.java:197)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:190)
sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
java.lang.ClassLoader.loadClass(ClassLoader.java:307)
java.lang.ClassLoader.loadClass(ClassLoader.java:296)
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
java.lang.ClassLoader.loadClass(ClassLoader.java:296)
java.lang.ClassLoader.loadClass(ClassLoader.java:248)
org.apache.jasper.runtime.JspFactoryImpl.getJspApplicationContext(JspFactoryImpl.java:209)
org.apache.jsp.WEB_002dINF.jsp.search_jsp._jspInit(search_jsp.java:22)
org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
test.test01.MainServlet.goToPage(MainServlet.java:50)
test.test01.MainServlet.doGet(MainServlet.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
I have checked everything I can think of (JAVA_HOME, CATALINA_HOME variables) and all check out okay. The project in eclipse is a dynamic web project and has all the $CATALINA_HOME/lib jar files in it including the el-api.jar file.
So what gives? The real annoying thing about this whole process is that I can export the war file, pop it onto my windows machine and it works just fine! I tried doing the same with Tomcat on Ubuntu and running it from there directly but am no better off. So, anyone know what the heck I am doing wrong?
1 comment:
Well, this is annoying certainly. I had copied the $CATALINA_HOME/lib/servlet-api.jar, $CATALINA_HOME/lib/jsp-api.jar to the $JAVA_HOME/jre/lib/ext folder but not the el-api.jar file. Once I copied that, it worked.
So, to fix it for good, I upgrade the JDK to 1.6.0_22 and without any of those 3, it still works. I guess adding 2 out of the 3 required jar files in that ext folder did me in. Lesson learned.
Post a Comment