java.lang.NoSuchFieldError:APPLICATION_CONTEXT_ID_PREFIX

时间:2013-01-15 13:29:12

标签: java spring spring-mvc

我在运行项目时收到此错误,结果最终为404。该项目是在Spring框架上完成的。

我阅读了很多帖子,发现混合了罐子或额外的罐子。之后我尝试组织我的罐子。以下列表是我在构建路径中的内容:

antlr-2.7.6.jar  
asm.jar  
asm-attrs.jar  
cglib-2.2.jar  
commons-beanutils-1.7.0.jar  
commons-collections-3.1.jar  
commons-digester-1.8.jar  
commons-email-1.0.jar  
commons-fileupload-1.1.1.jar  
commons-io-1.2.jar  
commons-lang-2.5.jar  
commons-logging-1.1.1.jar  
displaytag-1.0-b3.jar  
dom4j-1.6.1.jar  
ehcache-1.1.jar  
hibernate3.jar  
hibernate-jpa-2.0-api-1.0.0.Final.jar  
hibernate-validator-4.0.2.GA.jar  
hsqldb.jar  
itext-2.1.3.jar  
javassist-3.12.0.GA.jar  
jdom.jar  
jstl-1.2.jar  
jta-1.1.jar  
log4j-1.2.14.jar  
msbase.jar  
mssqlserver4v65.jar  
msutil.jar  
mysql.jar  
mysql-connector-java-5.1.15-bin.jar  
ojdbc14.jar  
persistence-api-1.0.jar  
poi-3.0-alpha2.jar  
servlet-2.3.jar  
slf4j-api-1.6.6.jar  
slf4j-log4j12-1.5.6.jar  
slf4j-simple-1.6.6.jar  
spring-asm-3.0.3.RELEASE.jar  
spring-beans-3.0.3.RELEASE.jar  
spring-context-3.0.3.RELEASE.jar  
spring-core-3.0.3.RELEASE.jar  
spring-expression-3.0.3.RELEASE.jar  
spring-hibernate3-2.0.8.jar  
spring-web-3.0.3.RELEASE.jar  
spring-webmvc-3.0.3.RELEASE.jar  
sqljdbc4.jar  
standard.jar  
tree.jar  
validation-api-1.0.0.GA.jar  
wloracle.jar  
wlsqlserver.jar  

这是堆栈跟踪

SEVERE: Error loading WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@ca2dce
org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1083)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4364)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

SEVERE: Servlet.service() for servlet jsp threw exception
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:315)
    at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1433)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:133)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:153)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)

我删除了许多罐子,我认为这些罐子是重复的 我的问题是所有这些罐子是否足够或者是否有重复? 请帮忙,这404就是杀了我......

2 个答案:

答案 0 :(得分:2)

那里有很多重复的罐子:

antlr
jta
mysql-connector
javassist
mssqlserver

我会确保你在继续之前只有一个,找出你需要的版本并包含那个版本。

如果您不确定如何执行此操作,请告诉我们您是如何导入依赖项的。

查看您正在查看的堆栈跟踪以及导致错误的简化Spring上下文也会很有帮助。


如果你看这个问题:JasperException: absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved

您需要确保拥有正确版本的JSTL,可能一旦删除了重复的JSTL,就可以修复该错误。

答案 1 :(得分:1)

我的猜测是删除spring.jar和spring-1.2.6.jar;他们与spring * 3.0.3.RELEASE.jars

冲突

在使用spring框架时,我的两分钱将使用maven。