简体   繁体   中英

Spring web service throw exception

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)

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM