骚年,你是不是和我一样,早年学习Java时候遇到以下 Tomcat 问题,原本正常的程序换台机器就是运行异常,骚年不怕,X-rapido带你来飞!
错误如下:
java.lang.UnsatisfiedLinkError: E:\Program Files\MyEclipse 10\apache-tomcat-7.0.23\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) 2013-3-29 13:18:09 org.apache.catalina.core.AprLifecycleListener init
问题所在:
主要是在64位的系统下安装的虚拟机是64位的,而WTK的sublime.dll不能在64位的平台下加载64位的虚拟机,只能加载32位的。由于WTK在安装的时候加载的64虚拟机的地址,它找到的是64位的虚拟机,所以它提示不能加载32位的虚拟机(在目录下没有32的虚拟机)
下载 the 32bit from http://www.apache.org/dist/tomcat/tomcat-connectors/native/1.1.20/binaries/ to 替换
下载时有更新变动,下载最近的即可http://www.apache.org/dist/tomcat/tomcat-connectors/native/
如下图
OK 问题解决
2013-3-29 13:22:45 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.27. 2013-3-29 13:22:45 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 2013-3-29 13:22:47 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-apr-8080"] 2013-3-29 13:22:47 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-apr-8009"] 2013-3-29 13:22:47 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 2088 ms 2013-3-29 13:22:47 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 2013-3-29 13:22:47 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.23 2013-3-29 13:22:47 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory E:\Program Files\MyEclipse 10\apache-tomcat-7.0.23\webapps\docs 2013-3-29 13:22:47 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory E:\Program Files\MyEclipse 10\apache-tomcat-7.0.23\webapps\examples 2013-3-29 13:22:48 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 2013-3-29 13:22:48 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 2013-3-29 13:22:48 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@4402a6ff') 2013-3-29 13:22:48 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory E:\Program Files\MyEclipse 10\apache-tomcat-7.0.23\webapps\host-manager 2013-3-29 13:22:48 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory E:\Program Files\MyEclipse 10\apache-tomcat-7.0.23\webapps\manager 2013-3-29 13:22:48 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory E:\Program Files\MyEclipse 10\apache-tomcat-7.0.23\webapps\ROOT 2013-3-29 13:22:48 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-apr-8080"] 2013-3-29 13:22:48 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-apr-8009"] 2013-3-29 13:22:48 org.apache.catalina.startup.Catalina start 信息: Server startup in 1261 ms