问题
I am doing spring web services example of this link (http://justcompiled.blogspot.in/2010/09/building-web-service-with-spring-ws.html) , I got exception.
Any kind of advice for successful run this project.
My Project Configuration:
Tool : Eclilpse Indigo,
Server : Tomcat 7.
Java : JDK, JRE 1.6
Deploy: Weapps (Inside my project )
My Exception:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet spring-ws threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
root cause
java.lang.NoSuchFieldError: APPLICATION_CONTEXT_ID_PREFIX
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:431)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
回答1:
I had same issue in my project. The root cause of this issue is you have to two version of spring. You can check the same thing inside your repository folder (org\springframework\spring-web) or (org\springframework\spring-webmvc). You can delete the one version from there. I have other project opened in same workspace which was referring to other version of spring. When I closed that other project and cleaned and built, that has resolved my issue.
Thanks Kapil
回答2:
Mixing spring jars of different versions?
http://forum.springsource.org/showthread.php?79929-java-lang-NoSuchFieldError-APPLICATION_CONTEXT_ID_PREFIX
回答3:
i think, you have older versions of spring jars (2.5) in your classpath. It can be either explicitly defined in your pom (if your project is a maven project) or some other frameworks can be dependent on these and added them automatically within. Using maven you can see more with:
$ mvn dependency:tree
which shows you all dependencies in your project. Just remove these jars from your classpath (using exclusions http://maven.apache.org/pom.html#Exclusions) and try again.
来源:https://stackoverflow.com/questions/9289473/spring-web-service-throw-exception