java.lang.NoSuchMethodError

梦想的初衷 提交于 2021-02-20 02:18:24

问题


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/)

  1. gmbal-api-only.jar
  2. ha-api.jar
  3. jaxb-core.jar
  4. jaxb-impl.jar
  5. jaxws-api.jar
  6. jaxws-rt.jar
  7. management-api.jar
  8. policy.jar
  9. stax-ex.jar
  10. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!