This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 188328 - NetBeans editor and compiler report NoSuchMethodError using JSTL
Summary: NetBeans editor and compiler report NoSuchMethodError using JSTL
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Anton Chechel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-02 18:37 UTC by ChuckRock
Modified: 2011-01-04 16:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ChuckRock 2010-07-02 18:37:49 UTC
I am using Netbeans 6.9 and Tomcat 6.0 I created a brand new project with only one file. I have added the JSTL 1.1 library to the project added the taglib reference <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
When I begin to use the lib 
<c:if test="${sqlStatement == null}">
   <c:redirect url="SqlLodgeInfoGateway?sqlStatement=SELECT lodge_name, lodge_no, addr1, city, state, zip, communication FROM lodges WHERE 1
&fromUrl=viewLodge.jsp" />
</c:if>
I get the error in the editor (a red x at the top of the screen) and when I compile.

Here is the contents of entire file
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

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

<c:if test="${sqlStatement == null}">
   <c:redirect url="sqlLodgeInfoGateway?sqlStatement=SELECT lodge_name, lodge_no, addr1, city, state, zip, communication FROM lodges WHERE 1
&fromUrl=viewLodge.jsp" />
</c:if>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

        <h1>Hello World!</h1>
    </body>
</html>

package sql;

import java.util.*;
import java.sql.*;

public class SqlLodgeUtil
{
    public static String getHtmlTable(ResultSet results)
            throws SQLException
    {
        StringBuffer htmlRows = new StringBuffer();
        ResultSetMetaData metaData = results.getMetaData();
        int columnCount = metaData.getColumnCount();

        htmlRows.append("<table cellpadding=\"5\" border=\"1\">");
        htmlRows.append("<tr>");
        for (int i = 1; i <= columnCount; i++)
            htmlRows.append("<td><b>" + metaData.getColumnName(i) + "</td>");
        htmlRows.append("</tr>");

        while (results.next())
        {
            htmlRows.append("<tr>");
            for (int i = 1; i <= columnCount; i++)
                htmlRows.append("<td>" + results.getString(i) + "</td>");
        }
        htmlRows.append("</tr>");
        htmlRows.append("</table>");
        return htmlRows.toString();
    }
}


package sql;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import java.sql.*;

/**
 *
 * @author Chuck
 */
public class sqlLodgeInfoGateway extends HttpServlet
{
    protected void doPost(HttpServletRequest request,
                          HttpServletResponse response)
                          throws ServletException, IOException
    {
        String sqlStatement = request.getParameter("sqlStatement");
        String fromUrl = request.getParameter("fromUrl");
        String sqlResult = "";

        try
        {
            // get a connection
            String dbURL = "jdbc:mysql://localhost:3306/grandlodge";
            String username = "root";
            String password = "";
            Connection connection = DriverManager.getConnection(
                    dbURL, username, password);

            // create a statement
            Statement statement = connection.createStatement();

            //parse the SQL string
            sqlStatement = sqlStatement.trim();
            if (sqlStatement.length() >= 6)
            {
                String sqlType = sqlStatement.substring(0, 6);
                if (sqlType.equalsIgnoreCase("select"))
                {
                    // create the HTML for the result set
                    ResultSet resultSet =
                            statement.executeQuery(sqlStatement);
                  sqlResult = SqlLodgeUtil.getHtmlTable(resultSet);
                    resultSet.close();
                }
                else
                {
                    int i = statement.executeUpdate(sqlStatement);
                    if (i == 0) //a DDL statement
                        sqlResult = "The statement executed succesfully.";
                    else
                        sqlResult = "The statement executed succesfully.<br>"
                                + i + " row(s) affected.";
                }
            }
            statement.close();
            connection.close();
        }
        catch(SQLException e)
        {
            sqlResult = "Error executing the SQL statement: <br>"
                    + e.getMessage();
        }

        HttpSession session = request.getSession();
        session.setAttribute("sqlResult", sqlResult);
        session.setAttribute("sqlStatement", sqlStatement);

        String url = fromUrl;
        RequestDispatcher dispatcher =
                getServletContext().getRequestDispatcher(url);

        dispatcher.forward(request, response);
    }
    protected void doGet(HttpServletRequest request,
                          HttpServletResponse response)
                          throws ServletException, IOException
    {
        this.doPost(request, response);
    }

}

Error statement


compile-single-jsp:
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
Exception in thread "main" java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory;
        at org.apache.jasper.compiler.JspUtil.getExpressionFactory(JspUtil.java:1166)
        at org.apache.jasper.compiler.JspUtil.validateExpressions(JspUtil.java:628)
        at org.apache.jasper.compiler.Validator$ValidateVisitor.getJspAttribute(Validator.java:1341)
        at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1117)
        at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:834)
        at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1482)
        at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2257)
        at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2307)
        at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2313)
        at org.apache.jasper.compiler.Node$Root.accept(Node.java:481)
        at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2257)
        at org.apache.jasper.compiler.Validator.validate(Validator.java:1837)
        at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:195)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:409)
        at org.apache.jasper.JspC.processFile(JspC.java:1150)
        at org.apache.jasper.JspC.execute(JspC.java:1319)
        at org.netbeans.modules.web.project.ant.JspC.main(JspC.java:97)
        at org.netbeans.modules.web.project.ant.JspCSingle.main(JspCSingle.java:125)
C:\Users\Chuck\Documents\NetBeansProjects\GLTest\nbproject\build-impl.xml:597: The following error occurred while executing this line:
C:\Users\Chuck\Documents\NetBeansProjects\GLTest\nbproject\build-impl.xml:575: Java returned: 1
BUILD FAILED (total time: 1 second)
Comment 1 Tomasz Slota 2010-07-02 20:43:13 UTC
looks like a P2, further evaluation is pending
Comment 2 Anton Chechel 2011-01-04 16:30:58 UTC
Works for me either with Tomcat 6.0.29 and Glassfish 3.1-b29.
Please reopen if you are able to reproduce it.

===
Product Version: NetBeans IDE Dev (Build 101028-51e102ab1e59)
Java: 1.6.0_23; Java HotSpot(TM) 64-Bit Server VM 19.0-b09
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Userdir: C:\Projects\netbeans\web-main\nbbuild\testuserdir
===