---
title: "有关tomcat5.5.28的windows下的apr配置BUG,官方没有对应的tcnative-1.dll文件"
author: "coffeesweet"
date: "2010-04-20T17:42:13Z"
tags: ["Apache", "Java", "SUN", "Tomcat", "Windows"]
categories: ["企业架构"]
slug: "tomcat5-5-28-windows-apr-bug-tcnative-1-dll"
draft: false
lastmod: "2010-04-20T17:46:18Z"
id: 648628
url: "https://coffeesweet.iteye.com/blog/648628"
---

今天启动tomcat5.5.28发现没有apr配置，报

```
[2010-04-20 17:33:19,734] [main] (AprLifecycleListener.java:99) DEBUG org.apache.catalina.core.AprLifecycleListener - The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Sun\jdk1.5.0_19\bin;D:\develop_tools\apache-tomcat-5.5.28\bin
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:83)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:757)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:504)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:267)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: java.lang.UnsatisfiedLinkError: no tcnative-1 in java.library.path, no libtcnative-1 in java.library.path(D:\Sun\jdk1.5.0_19\bin;D:\develop_tools\apache-tomcat-5.5.28\bin)
	at org.apache.tomcat.jni.Library.<init>(Library.java:67)
	at org.apache.tomcat.jni.Library.initialize(Library.java:168)
	... 15 more
```

 

错误，然后去官方下载最新的tcnative-1.dll文件1.1.14版本，(注：tomcat6.0.26自己带最新的1.1.20版本，所以启动没有问题),（官方没有介绍tomcat的版本和tcnative-1.dll版本的对应关系）

下载放入$tomcat\_home/bin后报错信息如下:

```
[2010-04-20 17:37:19,078] [main] (AprLifecycleListener.java:99) DEBUG org.apache.catalina.core.AprLifecycleListener - The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Sun\jdk1.5.0_19\bin;D:\develop_tools\apache-tomcat-5.5.28\bin
java.lang.NoSuchFieldException: TCN_MAJOR_VERSION
	at java.lang.Class.getField(Class.java:1507)
	at org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:91)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
	at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:757)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:504)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:267)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
```

 

这种情况极有可能是tomcat在升级的时候修改了AprLifecycleListener类的实现，但不敢确定，所以我挨个下了所有版本的tcnative-1.dll做实验，结果都会出现上述的两种异常；

然后我查看了tomcat5.5.28官方的的channellog,有如下收获

[http://tomcat.apache.org/tomcat-5.5-doc/changelog.html](http://tomcat.apache.org/tomcat-5.5-doc/changelog.html)这是连接地址

其中有涉及到

 

 

[39997](http://issues.apache.org/bugzilla/show_bug.cgi?id=39997): Add the SSLRandomSeed option to the AprLifecycleListener to enable faster starts on development systems. (markt)

 

点进去看发现确实针对linux修改了东西.

 

最后我下载了tomcat5.5.27版本，在$TOMCAT\_HOMT/bin里放入了tcnative-1.dll文件1.1.14版本

 

启动一切正常，问题解决!