0

Hey guys,
I've very new to JSP, Java, and Netbeans and I'm having an issue... So I've got an ArrayList of User objects and I'm trying to iterate over the list in a JSP page to display the info. I've included the JSTL 1.1 jstl and standard libraries. Here is my code for the JSP:

<% include business.User %>
...html stuff...
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
                <c:forEach items ="${phonelist}" var="item">
                <tr>
                <td><font face="verdana" size="2"><% item.getFirstName; %></font></td>
                <td><font face="verdana" size="2"><% item.getLastName; %></font></td>
                <td><font face="verdana" size="2"><% item.getPhoneMobile; %></font></td>
                <td><font face="verdana" size="2"><% item.getPhoneOffice; %></font></td>
                <td><font face="verdana" size="2"><% item.getPhoneHome; %></font></td>
                <td><font face="verdana" size="2"><% item.getAddressStreet; %></font></td>
                <td><font face="verdana" size="2"><% item.getAddressCity; %></font></td>
                <td><font face="verdana" size="2"><% item.getAddressState; %></font></td>
                <td><font face="verdana" size="2"><% item.getAddressCountry; %></font></td>
                <td><font face="verdana" size="2"><% item.getAddressState; %></font></td>
                <td><font face="verdana" size="2"><% item.getAddressCountry; %></font></td>
                <td><font face="verdana" size="2"><% item.getAddressZip; %></font></td>
                <td><font face="verdana" size="2"><% item.getCompany; %></font></td>
                <td><font face="verdana" size="2"><% item.getEmail; %></font></td>
                </c:forEach>

...and here is the error I'm getting when I try to run the page:

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
controllers.display_phonebook.processRequest(display_phonebook.java:41)
controllers.display_phonebook.doGet(display_phonebook.java:56)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:621)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
java.net.URLClassLoader.access$000(URLClassLoader.java:56)
java.net.URLClassLoader$1.run(URLClassLoader.java:195)

...and it goes further with more lines of similar stuff...

Any suggestions would be very helpful!!

Thanks in advance,
- Jeff

3
Contributors
4
Replies
10
Views
7 Years
Discussion Span
Last Post by ibanez270dx
0

NoclassDefError, normally stems from not being able to find the class, in your case TagLibraryValidator

Ensure that this class is in the lib directory of your application

0

Hello and thanks for your response...

According to my JAVA and JSP book (Murach), I have everything set up properly to use JSTL. I started a little test project from my netbeans and added the JSTL 1.1 Library. On my index.jsp (the only page in the project) I have:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

but I still get the same error:
javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


kinda weird though, if I click refresh a bunch of times real quick, I get a different error:
org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:156)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


Anybody have anymore ideas? If I have to get another library, could you please direct me to where I can get it?

Thanks,
- Jeff

0

This doesn't seem to be a JSTL problem since the class missing belongs to the jsp-api.jar library which is a part of the standard distribution [i.e. part of the specification, placed in Tomcat/lib]. Have you tried making your application work outside Netbeans by copy-pasting the WAR file in the Tomcat directory?

0

I actually got this working a few days ago, but I forgot to post my solution, sorry about that. I actually had to reinstall NetBeans AND Java. Works like a charm now! Still don't know what I screwed up though.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.