Re: JSTL JSP compile error

"Rahul Akolkar" <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
On 3/20/06, avilay parekh <[email protected]> wrote:
> Hi,
>
> I have been trying to run JSPs with JSTL on tomcat 5.0.28 without any success.
>
> My setup:
>
> $CATALINA_ROOT/
> webapps/
>   tp/
>       login.html
>       two2.jsp
>       WEB-INF/
>           web.xml
>           lib/
>               jstl.jar
>               standard.jar
<snip/>

Are you sure these are JSTL 1.1 jars? tagPlugins.xml is not relevant.
JSP looks good.

Is it a 2.3 or 2.4 webapp? See also:
http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions

-Rahul



>
> Here is what two2.jsp looks like:
> -------------
> <%@page contentType="text/html"%>
> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
> <html>
> <head><title>Post Data Viewer</title></head>
> <body>
> <h2>Here is your posted data</h2>
>
> <c:forEach var="map_entry" items="${param}">
>   <strong><c:out value="${map_entry.key}" /></strong>:
>   <c:out value="${map_entry.value}" /><br><br>
> </c:forEach>
>
> </body>
> </html>
> ---------------------
>
> Here is the error I get when tomcat access two2.jsp:
> ---------------------------------
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> Generated servlet error:
> C:\Program Files\Java\jakarta-tomcat-5.0.28\work\Catalina\localhost\tp\org\apache\jsp\two2_jsp.java:97:
> _jspx_meth_c_out_0(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext,int[])
> in org.apache.jsp.two2_jsp cannot be applied to
> (org.apache.taglibs.standard.tag.rt.core.ForEachTag,javax.servlet.jsp.PageContext,int[])
>         if (_jspx_meth_c_out_0(_jspx_th_c_forEach_0,
> _jspx_page_context, _jspx_push_body_count_c_forEach_0))
>             ^
>
>
> Generated servlet error:
> C:\Program Files\Java\jakarta-tomcat-5.0.28\work\Catalina\localhost\tp\org\apache\jsp\two2_jsp.java:101:
> _jspx_meth_c_out_1(javax.servlet.jsp.tagext.JspTag,javax.servlet.jsp.PageContext,int[])
> in org.apache.jsp.two2_jsp cannot be applied to
> (org.apache.taglibs.standard.tag.rt.core.ForEachTag,javax.servlet.jsp.PageContext,int[])
>         if (_jspx_meth_c_out_1(_jspx_th_c_forEach_0,
> _jspx_page_context, _jspx_push_body_count_c_forEach_0))
>             ^
>
> 2 errors
> ------------------------------------
>
> I found a similar issue on this mailing list and the suggested fixes
> were to copy tagPlugins.xml to WEB-INF and to make sure that jstl.jar
> and standard.jar are not present in any other common or shared libs
> apart from my webapp lib directory.
>
> Tomcat was not loading jstl.jar and standard.jar from anywhere else,
> there are only present in my WEB-INF/lib directory. When I copy
> tagPlugins.xml to WEB-INF I get another error:
>
> -------------------------
> org.apache.jasper.JasperException
>       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
>       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> root cause
>
> java.lang.NullPointerException
>       org.apache.jsp.two2_jsp._jspService(two2_jsp.java:191)
>       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
>       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
>       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>       javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> -------------------
>
> Here is the java code where it chokes:
>
> Object _jspx_temp0=
> new String("${param}");
> Iterator _jspx_temp1 = null;
> if (_jspx_temp0 instanceof Object[])
> _jspx_temp1=toIterator((Object[])_jspx_temp0);
> else if (_jspx_temp0 instanceof boolean[])
> _jspx_temp1=toIterator((boolean[])_jspx_temp0);
> else if (_jspx_temp0 instanceof byte[])
> _jspx_temp1=toIterator((byte[])_jspx_temp0);
> else if (_jspx_temp0 instanceof char[])
> _jspx_temp1=toIterator((char[])_jspx_temp0);
> else if (_jspx_temp0 instanceof short[])
> _jspx_temp1=toIterator((short[])_jspx_temp0);
> else if (_jspx_temp0 instanceof int[])
> _jspx_temp1=toIterator((int[])_jspx_temp0);
> else if (_jspx_temp0 instanceof long[])
> _jspx_temp1=toIterator((long[])_jspx_temp0);
> else if (_jspx_temp0 instanceof float[])
> _jspx_temp1=toIterator((float[])_jspx_temp0);
> else if (_jspx_temp0 instanceof double[])
> _jspx_temp1=toIterator((double[])_jspx_temp0);
> else if (_jspx_temp0 instanceof Collection)
> _jspx_temp1=((Collection)_jspx_temp0).iterator();
> else if (_jspx_temp0 instanceof Iterator)
> _jspx_temp1=(Iterator)_jspx_temp0;
> else if (_jspx_temp0 instanceof Enumeration)
> _jspx_temp1=toIterator((Enumeration)_jspx_temp0);
> else if (_jspx_temp0 instanceof Map)
> _jspx_temp1=((Map)_jspx_temp0).entrySet().iterator();
>
> while (_jspx_temp1.hasNext()){
>   _jspx_page_context.setAttribute(
>   "map_entry", _jspx_temp1.next());
> :::::::::::
> }
>
> --------------------
> while statement gets a NullPointerException.
>
> Any help is much appreciated.
>
> Regards,
> Avilay Parekh
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.