---
title: "解决Tomcat APR - tcnative-1.dll引起的 “Socket accept failed WSACancelBlockingCall”问题"
author: "bertLee"
date: "2011-08-02T22:07:58Z"
tags: []
categories: ["开源软件"]
slug: "tomcat-apr-tcnative-1-dll-socket-accept-failed-wsacancelblockingcall"
draft: false
lastmod: "2011-08-03T08:53:35Z"
id: 1138597
url: "https://bertlee.iteye.com/blog/1138597"
---

问题描述：

系统环境（在 Tomcat Server Status 中直接复制过来）

Tomcat Version JVM Version JVM Vendor OS Name OS Version OS Architecture Apache Tomcat/6.0.32 1.6.0\_20-b02 Sun Microsystems Inc. Windows XP 5.1 x86

在 Tomcat 的 $CATALINA\_HOME/bin 目录下加了 tcnative-1.dll ，结果关闭服务时出现如下错误。

```
2011-8-2 9:03:53 org.apache.tomcat.util.net.AprEndpoint$Acceptor run
严重: Socket accept failed
org.apache.tomcat.jni.Error: A blocking operation was interrupted by a call to WSACancelBlockingCall.
at org.apache.tomcat.jni.Socket.accept(Native Method)
at org.apache.tomcat.util.net.AprEndpoint$Acceptor.run(AprEndpoint.java:1109)
at java.lang.Thread.run(Thread.java:595)
2011-8-2 9:03:53 org.apache.coyote.ajp.AjpAprProtocol destroy
信息: Stopping Coyote AJP/1.3 on ajp-8009
```

 

解决：

**问题根源** ：你下载的 tcnative-1.dll 文件不是 Tomcat 原始使用的那个版本文件

在 $CATALINA\_HOME/webapps/docs/apr.html 打开其[官方 Apache Portable Runtime (APR) 文档](http://tomcat.apache.org/tomcat-6.0-doc/apr.html) 描述，其 APR 包的源码在 bin/tomcat-native.tar.gz 归档文件中。所以，打开该文件就可以知道该 Tomcat native 的版本是多少，然后就到 [Tomcat native 下载中心](http://archive.apache.org/dist/tomcat/tomcat-connectors/native/) 下载相同版本的 tcnative-1.dll 和 openssl.exe 即可。问题搞定了， 就 这么简单！如果版本不一样，就可能会出现上面这个问题，这就是引起该问题的根源所在。

Ok，就说这么多了！^\_^