首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

j2ee5.0应用jtsl报错

2012-09-07 
j2ee5.0使用jtsl报错框架是struts2.1.8,使用嵌入式jetty6.1.5启动或者tomcat6.0.18启动都报同样的问题:(细

j2ee5.0使用jtsl报错
框架是struts2.1.8,使用嵌入式jetty6.1.5启动或者tomcat6.0.18启动都报同样的问题:(细节有区别)

jetty报错如下:

HTML code
HTTP ERROR 500Problem accessing /base/manage.action. Reason:     The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this applicationCaused by: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    at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)    at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:317)    at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:424)    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:493)    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1557)    at org.apache.jasper.compiler.Parser.parse(Parser.java:127)    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212)    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156)    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)    at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:154)    at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)    at org.mortbay.jetty.Server.handle(Server.java:326)    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)--------------------------------------------Powered by Jetty:// 



网上的办法都试过了,比如拷贝myeclipse路径下的4个jar到tomcat下等,涛声依旧,求达人帮忙看看,本人qq465089135.坐等。


[解决办法]
请使用servlet2.4格式的web.xml头:
<?xml version="1.0" encoding="UTF-8"?>
<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">

然后在web.xml中去除对taglib的声明再试试看

如果不是这个问题你还是贴一下web.xml出来给大家分析一下,至少把引用到uri的那部分贴出来看看
[解决办法]
由于JSTL1.0和JSTL1.1的声明语句不一样。

JSTL 1.0 的声明是:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core " %> 

JSTL1.1 的声明是:
<%@ taglib prefix="c" uri=http://java.sun.com/jsp/jstl/core %> 

如果你使用的JSTL库和你在JSP中的声明不一致。就会报上面提到的Exception。

另外,要注意的是:Tomcat是先引用"TOMCAT_HOME/shared/lib"下面的库,再引用web项目下面的"WEB-INF/lib'的库。

还有就是,jBuilder自带库中的JSTL有两个配置,一个是"JSTL"(1.0),一个是"JSTL1.1"(1.1),注意在做项目的时候别引用错了。

还有一个技巧是:如何判断JSTL的两个库文件(standar.jar和jstl.jar)的版本?展开jar文件在"META-INF"目录下的MANIFEST.MF文件,其中"Specification-Version"指名的就是版本号。

[解决办法]
从网上搜了一下,相同的说法是:一个就是JSTL的版本问题(1.0与1.1),是否不一致。还有就是检查虚拟目录下WEB-INF目录下的lib文件夹(如果同有lib文件夹,后动创建一个)中是否有jstl.jar和standard.jar两个jar包,如果没有则把它们复制到lib下面。

都试了,不过报错依旧……后来又找了一下加上自己的乱搞,按照上面的改过之后,大体有两种解决方法:

第一种就是在Eclipse的工程中导入JSTL1.1后,下载JSTL1.1 http://jakarta.apache.org/taglibs/index.html
然后解压,把*.jar和*.tld放到/WEB-INF/lib目录下。也就是将所有的jakarta-taglibs-standard-current.zip(JSTL的类库)中的.jar和.tlb放到WEB-INF目录下的lib文件夹中,JSP文件中导入<%@ taglib prefix="c" uri="/WEB-INF/lib/c.tld" %>,经试验是可以的。

第二种是修改web.xml,加上下面的语句:

<jsp-config>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>

<taglib-location>/WEB-INF/c.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/xml</taglib-uri>

<taglib-location>/WEB-INF/x.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>

<taglib-location>/WEB-INF/fmt.tld</taglib-location>

</taglib>

<taglib>

<taglib-uri>http://java.sun.com/jsp/jstl/sql</taglib-uri>

<taglib-location>/WEB-INF/sql.tld</taglib-location>

</taglib>

</jsp-config>

JSP中导入<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>。应该就可以了……

推荐第二种^_^!
[解决办法]

很明显jstl的uri不对,看你用的哪个版本,不同版本还不一样,上面两位说的应该很明显了
[解决办法]
web.xml头部有问题吧,
顶#1楼
[解决办法]
我不作回答了,上面的方法搞不定我也是白说.

热点排行