views:

289

answers:

3

Hi everyone... there's this issue with JSTL I'm stuck with for the past couple of days. Any help is appreciated.

Tomcat:

6.0.28

Eclipse:

Helios

pom.xml :

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

JSP:

<%@ page session="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="utilfn" uri="/utility-functions" %>

web.xml:

<web-app id="WebApp_ID" version="2.4" 
 xmlns="http://java.sun.com/xml/ns/j2ee" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt;

When I deploy the Maven-built war on tomcat 6 using the manager it works fine. When I run it as "Run As > Run On Server" inside eclipse, I get this:

Unable to read TLD "META-INF/c.tld" from JAR file "file:/<- location ->/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Myproject/WEB-INF/lib/standard-1.1.2.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV

Wherever I look, it says the same thing:

1) Make sure servlet-api and jsp-api are not in lib
2) Make sure to use the right JSTL version and URI that goes with JSP 2.0.

And they seem to be fine as I can deploy the war independently. So what's wrong here!?

+1  A: 

Check that .metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Myproject/WEB-INF/lib/standard-1.1.2.jar is not corrupted (and do some cleanup if required).

Pascal Thivent
Even though standard-1.1.2.jar was not the issue, I'm still accepting your answer, because I failed to check that location. It just didn't occur to me. The issue was that servlet-api.jar was copied over to that location somehow when I deleted and reconfigured my server inside Eclipse. Deleting that file solved the issue. Every time I choose "Clean" and "Clean Tomcat Work Directory" from the server context menu, the jar appears back there though. I'm not sure why/how. But as of now, deleting that file manually is making it work.Thank you for the response!
DS
A: 

It looks like there is an issue with maven/m2eclipse plugin. Even I am seeing the same issue. By default it is pushing all the jar files to server lib directory. Which includes the scope "provided" jar files. This issue was fixed in old versions of m2eclipse. But it got introduced again it seems.

Jay
A: 

remove :
javax.servlet.jsp jsp-api 2.0 provided

from you pom.xml and that should do.. it worked in my case :-)

Alok Avjeet