facebook

jstl not found

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #309784 Reply

    David
    Member

    I am running:
    Ubuntu
    MyEclipse 8.5
    Tomcat 5.5.29
    Java 1.6

    I am working thru a tutorial and my jstl/standard jars appear to not being picked up. The jsp displays:

    ???heading???

    ???greeting??? ${model.now}

    if I look here:
    ~/apache-tomcat-5.5.29/webapps/myapp/WEB-INF/lib$
    standard-1.1.2.jar
    jstl-1.1.2.jar

    I have my pom.xml as:

        <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
                <version>1.1.2</version>
            </dependency>
    
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.1</version>
                <scope>provided</scope>
            </dependency>
    
            <dependency>
                <groupId>taglibs</groupId>
                <artifactId>standard</artifactId>
                <version>1.1.2</version>
            </dependency>
    

    If I look under “Maven Dependencies” in MyEclipse” I see the jars listed there as well. I reference them in my jsp as:

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

    And my web.xml is:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    #309805 Reply

    sonoerin,

    <web-app version=”2.5″

    Since your servlet specification is 2.5, you should use JSTL1.2 in your application.
    Can you download the new JSTL.jar and let me know if that works for you?

    You can refer to the following links for further reference –
    1. http://www.mularien.com/blog/2008/04/24/how-to-reference-and-use-jstl-in-your-web-application/
    2. http://faq.javaranch.com/java/SetupJstlForJsp2

    #309811 Reply

    David
    Member

    I changed my pom.xml to:

        <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
    

    I had to undeploy and redeploy but now my url returns:

    javax.servlet.ServletException: javax/el/ValueExpression
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

    I no longer have the jstl taglibs as I couldn’t find one for 1.2

    #309832 Reply

    sonoerin,
    I could not replicate this at my end. jstl 1.2 jar file was added to my maven dependencies as soon as I added the piece of code you posted.
    I have attached some screen shots for your reference.

    Can you clarify if you have removed dependency for both standard.jar and jstl 1.1.2. jar?

    Attachments:
    You must be logged in to view attached files.
    #309840 Reply

    David
    Member

    Yes, I removed the previous jstl and standard references Here is my dom.xml:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <packaging>war</packaging>
        <name />
        <description />
        <dependencies>
            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>2.1</version>
                <scope>provided</scope>
            </dependency>
    
        <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.5</version>
            </dependency>
    
    
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>3.0.3.RELEASE</version>
            </dependency>
            
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate</artifactId>
                <version>3.1.3</version>
            </dependency>
    
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-annotations</artifactId>
                <version>3.4.0.GA</version>
            </dependency>
    
    
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>ejb3-persistence</artifactId>
                <version>3.3.2.Beta1</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-hibernate3</artifactId>
                <version>2.0.8</version>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>
        </dependencies>

    I think these are all compatible with Tomcat 5.5.29. Under WEB-INF/lib/ I have
    jstl-1.2.jar

    So the jar is there, but it throws an error when trying to use:

    j

    avax.servlet.ServletException: javax/el/ValueExpression
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
        org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    
    root cause
    
    java.lang.NoClassDefFoundError: javax/el/ValueExpression
        java.lang.Class.getDeclaredMethods0(Native Method)
        java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
        java.lang.Class.getDeclaredMethods(Class.java:1791)
        java.beans.Introspector$1.run(Introspector.java:1272)
        java.security.AccessController.doPrivileged(Native Method)
        java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
        java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
        java.beans.Introspector.getBeanInfo(Introspector.java:387)
        java.beans.Introspector.getBeanInfo(Introspector.java:159)
        java.beans.Introspector.getBeanInfo(Introspector.java:220)
        java.beans.Introspector.<init>(Introspector.java:368)
    #309872 Reply

    sonoerin,
    Tomcat 5 is not a fully J2EE5 compatible server. Either you can try using Tomcat 6 or you can add “jsp-api-2.1.6.0.2.jar” to tomcat 5 lib
    Please refer to the following links for further reference –
    1. http://forum.springsource.org/showthread.php?t=63028
    2. http://stufftohelpyouout.blogspot.com/2009/01/was-getting-error-when-running-portlet.html

    #309919 Reply

    David
    Member

    OK, I moved this over to Tomcat 6, and I see that the jstl core seems to be working. I can see the variables returned from the controller. However, the fmt part is still failing:

    ???heading???

    ???greeting??? Sun Jul 18 07:45:47 MDT 2010

    I cannot find where to find the jstl standard.jar When I try to “add dependency” to Maven4MyEclipse it doesn’t give me any references. I could manually go out and find this jar, but that is defeating the Maven purpose right?

    #309938 Reply

    sonoerin,

    ???heading???

    ???greeting???

    This can be caused when the appropriate resource file is not found in the classpath for the given locale(ex ApplicationResources_en.properties).
    Can you clarify if you have .properties file, defined for the locale you are using, is added to your classpath?

    #309947 Reply

    David
    Member

    Thank you, I totally overlooked the obvious!

    #309967 Reply

    Welcome…
    Do let us know if you have any issues.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: jstl not found

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in