Tomcat:Can't load IA 32-bit .dll on a AMD 64-bit platform问题的解决

控制台错误如下:

复制代码
java.lang.UnsatisfiedLinkError: D:\apache-tomcat-7.0.56\bin\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1778)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1030)
    at org.apache.tomcat.jni.Library.<init>(Library.java:42)
    at org.apache.tomcat.jni.Library.initialize(Library.java:174)
    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:597)
    at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:179)
    at org.apache.catalina.core.AprLifecycleListener.isAprAvailable(AprLifecycleListener.java:84)
    at org.apache.catalina.connector.Connector.setProtocol(Connector.java:567)
    at org.apache.catalina.connector.Connector.<init>(Connector.java:69)
    at org.apache.catalina.startup.ConnectorCreateRule.begin(ConnectorCreateRule.java:62)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)

    at org.apache.catalina.startup.Catalina.load(Catalina.java:555)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:598)

    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:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)
复制代码

解决这个问题有两种办法

第一种方法:

检查自己的JDK版本,打开cmd,输入java -version,查看第三行是否包含"64",如果不包含,说明你设置的环境变量JAVA_HOME的地址指向是32位的JDK,那么你只需要下载64为的JDK并安装,然后修改环境变量JAVA_HOME指向64位的地址。此方法能一绝后患。说白了就是你的项目jdk版本与Tomcat中配置的jdk版本不一致。

 

第二种方法:

1.下载一个32位的替换   http://www.apache.org/dist/tomcat/tomcat-connectors/native/1.1.31/binaries/

2.将下载下来的文件解压,找到x64文件夹下的tcnative-1.dll文件

3.替换tomcat中bin文件夹下的tcnative-1.dll文件

此时MyEclipse中的Tomcat服务器能成功启动,但是进入Tomcat的bin文件夹下,启动startup.bat文件发现报

java.lang.UnsatisfiedLinkError: D:\apache-tomcat-7.0.56\bin\tcnative-1.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform错误。说明之前换掉的tcnative-1.dll文件出问题了。
posted @ 2017-05-19 12:20  追梦boy  阅读(54182)  评论(0编辑  收藏  举报