tomcat下程序出现org.apache.commons.httpclient.HttpMethodDirector的错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat下程序出现org.apache.commons.httpclient.HttpMethodDirector的错误相关的知识,希望对你有一定的参考价值。

具体错误代码如下:
条2015-08-03 15:36:49,890 [Thread-2] INFO [com.epri.listener.OfficialRunable] - RTM_TOWER_EAXM_M数据0条
INFO [org.apache.commons.httpclient.HttpMethodDirector] - I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect2015-08-03 15:36:50,031 [Thread-4] INFO [org.apache.commons.httpclient.HttpMethodDirector] - Retrying request2015-08-03 15:36:51,234 [Thread-4] ERROR [org.codehaus.xfire.transport.http.HttpChannel] - java.net.ConnectException: Connection refused: connect2015-08-03 15:36:51,234 [Thread-4] ERROR [com.epri.utils.Sender] - org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Couldn't send message.

参考技术A caught when processing request: Connection refused:

连接被拒绝,没开服务本回答被提问者和网友采纳

Eclipse在Tomcat环境下运行项目出现NoClassDefFoundError/ClassNotFoundException解决办法

For this error, there can be different solutions. I have noted down the ones that had worked for me.

Solution 1. This is always happened in deployment and debugging environment. In deployment environment, just make sure your server classpath has included the Spring jar library (e.g spring-4.0.4.jar).

In debugging environment, the steps may vary from different IDE, but the solution is same. In Eclipse, developers usually will create a tomcat, jboss…whatever application server for debugging, just make sure the correct Spring jars are included.

  1. Double click on your debugging server
  2. Click on the “Open launch configuration” to access the server environment
  3. Click on the classpath tab
  4. Include the Spring jar file here , it may also required common log jar due to Spring dependency.
  5. Done, run your application again.

.

Solution 2. If you are using Maven as a build tool and downloading dependencies using it, there can be some jar conflict. Because Tomcat servers normally provide some jars such as servlet-api and jpa-api. So if you again included them using maven; there will be problems in identifying them.

Solution 3. If you are using Eclipse as your IDE and using Maven as your build tool and tomcat as your server; remember Tomcat server will not look on the jars which are just inside the folders. For that there‘s a small trick,

  1. Right click on your project and select properties
  2. From the displayed window, select Deployment Assembly
  3. Select Add
  4. Add Maven dependencies
  5. Click Apply and Click OK

Hope one of these solutions would help you to solve your problem. Happy Coding and make sure that is using Java.

 

原文地址:https://stackoverflow.com/questions/15989325/java-lang-noclassdeffounderror-org-springframework-context-applicationcontext/22746332#22746332

以上是关于tomcat下程序出现org.apache.commons.httpclient.HttpMethodDirector的错误的主要内容,如果未能解决你的问题,请参考以下文章

IDEA中Tomcat启动时控制台出现乱码问题

linux下部署程序,tomcat启动正常,但网页无法访问

ubuntu麒麟系统tomcat中文乱码怎么办?

myEclipse怎样将程序部署到tomcat(附录MyEclipse调试快捷键)

如何配置tomcat环境变量?

tomcat的下配置Java环境