问题
I am trying to connect Lotus Notes Domino (8.5.1) objects from a java web application which uses eclipse (indigo, jdk1.7). this is what I did: 1. add notes.jar to Librairies of Java Build Path in eclipse, 2. add path variable of "C:\Program Files (x86)\IBM\Lotus\Notes" to path of Envrionment variable of my local computer. then I created this simple java codes in eclipse as below:
import lotus.domino.*;
public class platform3
{
public static void main(String argv[])
{
try
{
NotesThread.sinitThread();
Session s = NotesFactory.createSession();
String p = s.getPlatform();
System.out.println("Platform = " + p);
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
NotesThread.stermThread();
}
}
}
The above codes are compiled without any problem, but when I run it, I got this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\IBM\Lotus\Notes\nlsxbe.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform I searched from the internet, it seems the Lotus Domino 8.5.1 is 32 bit, and my java project (jdk1.7) is 64bits, so they are not compatible. but I can not change my java (eclipse) to 32bit since I need it to develop 64 bit web projects. Does anybody know how to make it work without changing my java from 64bits to 32bits?
回答1:
As @maksimov noted in the comments, a 64 bit JVM cannot load the 32 bit Notes DLLs. There is, howver, a 64 bit version of the DLLs, but you will have to install and configure the Lotus Domino Server (64 bit Windows version) on your machine - and on any machine(s) where the web application will run. You will only have to run the Domino server once per machine in order to get it fully configured. It will not have to be running all the time in order for your code to access the DLLs, but you will have to leave it installed. You will have to, however, check with whomever manages your IBM relationship, and possibly with IBM, in order to determine whether there are any licensing and cost implications before installing the Domino server code this way. (One further note: in order to get the 64 bit Domino Server code cleanly installed on the machine and insure that that particular version of nlsxbe.dll is the one that your code loads, you will be best off if you uninstall and completely clean the existing 32 bit Notes client installation. And by cleaning, I'd get rid of the lotus.ini file, and any notes.ini files and Notes-related registry entries that might be left over after the uninstallation.)
There is also another option. Your code is using the "local" version of the Notes Java API in notes.jar. There is also a CORBA/IIOP version of the API, which does not use any Notes or Dominbo DLLs. In fact, it doesn't require any installation of any Lotus code, and it has no licensing implications either. All you need for this is a copy of the NCSO.jar added to your project. You do need to be aware that the capabilities of the NCSO.jar version of the API are slightly different from the local version, code to set up a session is slightly different, authentication does not rely on Notes ID files, and the Domino servers that you connect to must be running the IIOP task - which will not be the case by default, so you may have to negotiate that with the people who manage those servers.
Note - Removed an update that was suggesting the OpenNTF API as an alternative. That was a bit of temporary confusion. It could not have helped.
来源:https://stackoverflow.com/questions/27868284/java-lang-unsatisfiedlinkerror-c-program-files-x86-ibm-lotus-notes-nlsxbe-dl