tcnative-1.dll Can't load AMD 64-bit .dll on a IA 32-bit platform
Asked Answered
P

9

36

I'm getting this error when I try to run tomcat:

"java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\apache-tomcat-7.0.34\bin\tcnative-1.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform".

However, I have the 64 bit JRE downloaded, and double-checked my java version:

C:\Program Files (x86)\apache-tomcat-7.0.34\bin>java -version
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

I've seen this question here before, but in one there was no resolution, and in the other it was an Eclipse issue, but I'm getting this error when I access tomcat directly.

How do I find out which "IA 32 bit platform" is being detected, and how do I point Tomcat in the right direction? Also, could this be why my servlet is getting this 404 error through Eclipse?

type Status report

message /JSPandServlet/Controller

description The requested resource is not available.

Logs:

C:\Program Files (x86)\apache-tomcat-7.0.34\bin>configtest.bat
Using CATALINA_BASE:   "C:\Program Files (x86)\apache-tomcat-7.0.34"
Using CATALINA_HOME:   "C:\Program Files (x86)\apache-tomcat-7.0.34"
Using CATALINA_TMPDIR: "C:\Program Files (x86)\apache-tomcat-7.0.34\temp"
Using JRE_HOME:        "C:\Program Files (x86)\Java\jre7"
Using CLASSPATH:       "C:\Program Files (x86)\apache-tomcat- 
7.0.34\bin\bootstrap.jar;C:\Program Files (x86)\apache-tomcat- 
7.0.34\bin\tomcat-juli.jar" 
java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\apache-tomcat- 
7.0.34\bin\
tcnative-1.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:180)
    at org.apache.catalina.core.AprLifecycleListener.isAprAvailable(AprLifecycleListener.java:85)
    at org.apache.catalina.connector.Connector.setProtocol(Connector.java:595)
    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(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:610)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Dec 26, 2012 7:15:47 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\PHP\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;c:\Program Files (x86)\Microsoft SQLServer\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\10
0\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\SourceGear\Common\DiffMerge\;C:\Ruby193\bin;.
Dec 26, 2012 7:15:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 26, 2012 7:15:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 26, 2012 7:15:47 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 448 ms
Passover answered 27/12, 2012 at 2:42 Comment(2)
Your JVM probably comes with both 32-bit and 64-bit binaries, and you are evidently running the 32-bit JVM around Tomcat. How do you launch Tomcat (script or service)? Can you connect to the JVM using a profiler/jconsole/etc. and inspect the system properties? Specifically, what are the values for java.vm.name and os.arch?Finegrain
Thanks for replying! I first saw the error when launching Tomcat through Eclipse via "Run As > Run on server". I also saw it when running configtest.bat directly on Tomcat. In the Java console, I got Virtual Machine: Java HotSpot(TM) 64-Bit Server VM version 23.6-b04 and Architecture: amd64.Passover
P
28

Oh man, I found the problem. I had an old JRE in a weird place which was being accessed by JRE_HOME. I removed that dir, fixed my environment variables, and that took care of it.

Passover answered 31/12, 2012 at 4:12 Comment(0)
F
9

I just found the solution. The problem was that my JRE_HOME pointed to a 32 bit JRE where in my machine was a 64 bit machine. I installed the 64 bit JRE and replaced it in the system variable and the server started clean

Froe answered 12/7, 2013 at 13:7 Comment(2)
Changing environment variables requires logout to take effect.Ljoka
In Windows you can also close all visible windows desktop apps to effect changes without logging outJaffe
K
4

Please check your default version pointed by eclipse.Properties->Java Compiler. Switch it to your JRE version installed. This worked for me. Thanks.

Komsomol answered 10/2, 2015 at 10:32 Comment(0)
H
2

Necromancing on a windows server (March 2019). There are several answers on stack overflow, for the problem Can't load AMD 64-bit .dll on a IA 32-bit platform". All show just part of the solution. Here is everything together.

The cause: a 32 bit version of Java is used, while the library expects a 64-bit version.

(1) Make sure JAVA_HOME and CATALINA_HOME is set. Something like

set JAVA_HOME=C:\Program Files\Java\jre1.8.0_201 set CATALINA_HOME=C:\Program Files (x86)\tomcat-9.0.16

These were the default locations in March 2019. The real versions don't matter, what is important that the following commands should work:

"%java_home%\bin\java.exe" -version
"%catalina_home%\bin\configtest.bat"

The first command should give you a few lines. One of the lines should say something like

Java HotSpot(TM) 64-bit Server VM

Of course 64-bit only on a 64-bit windows machine. (how to check: windows - run - system information. It should mention in System Type whether is is a 32 or 54 based system)

The config test shows you the java and catalina home values that are used by TomCat.

If you have the incorrect Java version:

  • Uninstall old Java version: Control Panel - (main page) Programs - Uninstall a program
  • Go to download Java manual download page. (Google if the link doesn't work anymore) Don't do automatic downloads, you might get a different version than you want, depending on your browsers.
  • Download windows offline 64-bit Don't do the online, again: it looks at your browsers to decide whether you want 32 or 64-bit.
  • run the installer.
  • After installing Java, check your Path and your environment variables and adjust accordingly (In windows server 2012: Control Panel - System and Security - System - Change Settings - Advanced - Environment Variables) -re-open a command prompt. Check Path and environment variables again and run the tests above.
Halfcocked answered 18/3, 2019 at 12:46 Comment(0)
B
1

Please check your Project SDK version used by IDE.

In Intellij IDEA:  File -> Project Structure -> Project.
In Eclipse:        Properties -> Java Compiler.

Switch it to JDK x64 version installed.

Bordereau answered 19/3, 2015 at 14:53 Comment(0)
G
1

The problem I faced with some similar message is that I've created shared native library via swig on Linux machine (libmyLic.so) , copied it to Windows, and there was trying to run my java test. This test was supposed to use System.loadLibrary or System.load interface . It doesn't work, because swig created my shared native library (wrapping C++ code to java) for UNIX environment. when I copied all test to Linux it solves the problem.

Gender answered 29/11, 2018 at 10:28 Comment(0)
F
0

For the same message "Can't load IA 32-bit .dll on a AMD 64-bit platform" while trying to run a Jenkins slave on 64 bit windows machine, fixed it by removing JAVA_TOOL_OPTIONS and _JAVA_OPTIONS environment variables which were pointing to 32 bit jvmhook.

Forsterite answered 14/2, 2013 at 22:39 Comment(0)
R
0

If the above answers don't work, check whether your path variable points to the correct(64- bit or 32-bit) bin folder of Apache Tomcat installation folder. That worked for me.

Revenant answered 13/5, 2021 at 18:29 Comment(0)
E
0

This error only gets triggered because of the 32bit and 64 bit conflicts for java. Analysis: Review initial log while starting tomcat. You will understand will is the java being used for the tomcat.

Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name:   Apache Tomcat/8.5.66
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          May 8 2021 22:44:01 UTC
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 8.5.66.0
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jdk1.8.0_291\jre
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_291-b10
Jun 21, 2021 2:44:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation

If incorrect architecture is found or the incorrect java path then try to fix that. If for some reason you are getting difficulty for that. Try to rename the incorrect JDK directory. It will start giving error some where. In my case it was complaining about the java for the tomcat server I added to the eclipse. I have to remove and add the tomcat again correcting the right JDK it will be using for the tomcat. This solved by issue.

Ennui answered 21/6, 2021 at 19:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.