问题
I am trying to run Tomcat 7 and getting following error:
java.lang.NoSuchMethodError: com.sun.xml.ws.assembler.TubelineAssemblyController: method <init>()V not found
According to this post (http://www.mkyong.com/webservices/jax-ws/deploy-jax-ws-web-services-on-tomcat/)
- gmbal-api-only.jar
- ha-api.jar
- jaxb-core.jar
- jaxb-impl.jar
- jaxws-api.jar
- jaxws-rt.jar
- management-api.jar
- policy.jar
- stax-ex.jar
- streambuffer.jar
I added these jars to Tomcat's libs (C:\Program Files\Apache Software Foundation\apache-tomcat-7.0.37\lib), to my project's libs and even under JDK: C:\Program Files\Java\jdk1.7.0_15\lib, still no good.
The funny thing is there is nothing in my project that uses com.sun.xml.ws.assembler.TubelineAssemblyController class. Does anyone have any idea? Thanks in advance.
回答1:
java.lang.NoSuchMethodError
Generally happens when you have wrong version of jar in classpath.
For example, while development you have used stax-ex1.2.jar
but runtime you have stax-ex.jar
. Make sure you have same version of jar available in classpath for both compile time and run time.
回答2:
"The funny thing is there is nothing in my project that uses com.sun.xml.ws.assembler.TubelineAssemblyController class."
But one of your jars' source is looking for it. You might have wrong version of jar file(s). Try redownloading the latest version.
回答3:
I'm with the same problem with Apache Commons and Tomcat 7. I have a new version in my lib folder, and tomcat has another version int the commmons lib folder.
Tomcat loads first the libs of its folder and after this the WEB/lib of my webapp. I got the same exception as you, once the method I'm using has only on the new version.
Try to localize different versions of the lib in your classpath.
来源:https://stackoverflow.com/questions/19591811/java-lang-nosuchmethoderror