Menu

#279 JNI calls faill on 64bit os with 32bit jvm

v3.4.0
open
5
2010-04-28
2010-04-27
Adi Katz
No

I am trying to run tomcat 5.5 as a service on AMD 64bit OS/ 32 bit JVM. The service installs and run but when trying to call native code on 32bit dlls it fails.
It works fine from the command line ( with Tomcat.bat file created according to instructions on your web site) but not as a service.
Any advise ?
I am also not sure which version of wrapper i need to download for my setting ( I tried all of them by now )

Discussion

  • Leif Mortenson

    Leif Mortenson - 2010-04-27

    Adi,
    If you are running with a 32-bit JVM, then you must be using a 32-bit Wrapper. Please download the 32-bit x86 Windows release.

    When you say that the you are failing to load 32-bit DLLs, are you referring to the Wrapper.dll? Or other JNI DLLs. If the later, please make sure that their locations are included in your library path:
    http://wrapper.tanukisoftware.org/doc/english/prop-java-library-path-n.html

    If this doesn't solve it for you, please post the error you are getting. Attaching the wrapper.conf to this issue may also be helpful. Please let me know the Wrapper version you are using as well.

    Cheers,
    Leif

     
  • Leif Mortenson

    Leif Mortenson - 2010-04-27
    • assigned_to: nobody --> mortenson
     
  • Adi Katz

    Adi Katz - 2010-04-27

    Thanks for your reply. As you suggested, I am using wrapper-windows-x86-32-3.4.0.
    The JNI call which fails is to my application specific dll:
    ezjcom.JComException: (Microsoft Office Excel:0x800a03ec) _Open method of Workbooks class failed
    at excel.Workbooks.Open(Native Method)
    at com.easa.xls.jcom.ApplicationLink.A(ApplicationLink.java:179)

    I am calling an Excel Workbook via a java-com bridge ( EZJCom in this case )
    The relevant config iem is:

    # Java Library Path (location of Wrapper.DLL or libwrapper.so)
    wrapper.java.library.path.1=../common/lib
    wrapper.java.library.path.2=../../webapps/excel/bin

    The second line is where the relevant dll is.

    Any idea?

    Thanks
    Adi

     
  • Adi Katz

    Adi Katz - 2010-04-27

    I can email you the dll and java code to call it of you are willing to try it out.

     
  • Leif Mortenson

    Leif Mortenson - 2010-04-27

    Adi,
    From the stack trace you provided, it shows that it is in the excel.Workbooks.Open native method. This means that the JNI library is being loaded and linked without any problems.

    The error you are seeing is because the _Open method is failing to connect to Excel (?).

    Where is it trying to Connect?

    You mentioned that it works under the Wrapper from the command line, but fails when running as a service. This is possibly because the Wrapper is running as the SYSTEM user in the Service context and may not have direct access to whatever it is that you are trying to connect to. Once I know, I might have some more advice.

    Cheers,
    Leif

     
  • Adi Katz

    Adi Katz - 2010-04-28

    Diredtory structure is as follows:
    C:\Server\tomcat\ C:\Server\webapps\ The file which I am trying to connect to is: C:\Server\webapps\app1\excel\PIDSheet.xls
    This is an empty Excel 2003 workbook file.
    The excel.Workbooks.Open method fails when I wrap the thing in a service. I tried all possible accounts I have on the machine ( administrators/owners etc. ) but still this method fail. I am using win7 by the way.

    Will appreciate any ideas you might have.

    Thanks
    Adi

     
  • Leif Mortenson

    Leif Mortenson - 2010-04-28

    Adi,
    At this point, it is a little outside the scope of Wrapper support. I am happy to help get you up and running, but we don't have any experience with this library. I tried sending a note off to the makers of your library at the following URL:
    http://www.ezjcom.com/contact.html

    I will let you know if I hear back. If you have licenses their software then it might be quicker to go through your channels to see what they have to say.

    Cheers,
    Leif

     
  • Adi Katz

    Adi Katz - 2010-04-28

    Hi,
    Thanks for your comment. I got in touch with ezJCom myself but nothing relevant came back so far. I did however check few more things, if you can think about it a bit more...
    I installed a different version of Excel ( 2010 ) to see if the result is different.
    I got more informative stack trace this time:

    ezjcom.JComException: (Microsoft Excel:0x800a03ec) Microsoft Excel cannot access the file 'C:\EASA4.2.1.5\webapps\excel\excel\PIDSheet.xls'. There are several possible reasons:
    • The file name or path does not exist.
    • The file is being used by another program.
    • The workbook you are trying to save has the same name as a currently open workbook.
    at excel.Workbooks.Open(Native Method)

    Again, This happens only when My java program ( Tomcat in this case ) is running as a windows service on a win7 64bit.
    It works fine in command line or on as a service on a winXP 32bit.

    Will appreciate if you have any more ideas at this stage
    Thanks
    Adi

     
  • Leif Mortenson

    Leif Mortenson - 2010-04-28

    Adi,
    Ok, that message is more useful. My first guess is that there are some permissions set on one or more of the parent directories that are preventing the System user from accessing them. It is a local drive, so that is about the only thing that could be the cause at this point.

    The error message seems to indicate the Excel is being accessed correctly. The xls file is what is causing the problem.

    Could you go through and double check the permissions of all of the directories in that path?

    Cheers,
    Leif

     
  • Leif Mortenson

    Leif Mortenson - 2010-04-28
    • milestone: --> v3.4.0
     
  • Leif Mortenson

    Leif Mortenson - 2010-04-28

    Adi,
    We heard back from ezJCOM (Desiderata Software). They also suggested that it was a file permission problem.

    Please let me know if my suggestions worked for you.

    Cheers,
    Leif

     

Log in to post a comment.