PDA

View Full Version : The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved...



yuanji
Aug 10th, 2009, 08:11 PM
I came to another issue when migrating web module project to dm Server 2.0.0.M4. And I think it is better ask here for help.

The dm server log shows

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:116)
org.apache.jasper.compiler.TagLibraryInfoImpl.gene rateTLDLocation(TagLibraryInfoImpl.java:315)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirec tive(Parser.java:431)
org.apache.jasper.compiler.Parser.parseDirective(P arser.java:494)
org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1444)
org.apache.jasper.compiler.Parser.parse(Parser.jav a:138)
org.apache.jasper.compiler.ParserController.doPars e(ParserController.java:216)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:154)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:315)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:295)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:282)
org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi ew.java:239)
org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1062)
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:790)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:709)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:614)
org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:526)
javax.servlet.http.HttpServlet.service(HttpServlet .java:690)
javax.servlet.http.HttpServlet.service(HttpServlet .java:803)

Usually it is caused by missing jstl or standard jar. But dm server already has them in repository\bundles\ext folder:

com.springsource.javax.servlet.jsp.jstl-1.1.2.jar
com.springsource.javax.servlet.jsp-2.1.0.jar
com.springsource.javax.servlet-2.5.0.jar
com.springsource.org.apache.taglibs.standard-1.1.2.jar

My web.xml version is 2.5:


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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"
version="2.5">
...

And my template.mf does import jstl and standard:

Import-Package: javax.servlet.jsp.jstl.core;version="[1.1.2,1.2.0)"
,com.springsource.server.web.dm;version="[2.0.0, 3.0.0)"
,org.springframework.web.context;version="[3.0, 3.1)"
Import-Template: org.apache.commons.logging;version="[1.1.1, 2.0.0)"
,javax.servlet.http;version="[2.5.0,2.5.0]"
,org.springframework.*;version="[3.0,3.1)"
Import-Bundle: com.springsource.org.apache.taglibs.standard;versi on="[1.1.2,1.1.2]"

In Jstl Tag Lib Definitions (http://faq.javaranch.com/view?JstlTagLibDefinitions), it says "JSTL 1.2 should be used for JSP 2.1 containers such Tomcat 6." I'm not sure if that's the problem.

Thanks for any help.

Andy Wilkinson
Aug 11th, 2009, 08:43 AM
This is due to a limitation in the OSGi Web Container that prevents it from finding TLDs across bundles. Thankfully, you can work around this limitation by including all the TLDs that you wish to use in your own bundle. We release this isn't a perfect solution, and intend to have support in place for loading TLDs from any bundle to which you are wired before 2.0 is released.

yuanji
Aug 11th, 2009, 11:48 AM
Thank you Andy. Glad to know it will be fixed in 2.0 Release.

yuanji
Aug 11th, 2009, 10:55 PM
I solved this last issue by copying c.tld to src/main/webapp/META-INF folder and adding tld mapping in web.xml:


<taglib>
<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
<taglib-location>/META-INF/c.tld</taglib-location>
</taglib>


Finally finished migrating my project to dm server 2. Thanks for all the help!

Andy Wilkinson
Aug 12th, 2009, 03:09 AM
Finally finished migrating my project to dm server 2. Thanks for all the help!

Excellent!

If you're interested in when the workaround is no longer necessary, keep an eye on these two JIRAs: DMS-800 (https://issuetracker.springsource.com/browse/DMS-800) and DMS-801 (https://issuetracker.springsource.com/browse/DMS-801).

neontetra
Oct 12th, 2009, 12:11 AM
Hi I believed your problem has already been resolved. I found another solution and will like to share it with anyone who has encountered this same error message while having all the necessary jars in place.

With reference to the documentations:
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html

the problem can also be resolved by including the following in your web.xml
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"

(your web.xml can be found under the WEB-INF folder of your workspace)