6

My JSP program is set to run on Websphere under HP-UX.

I have some .jar files and a .so file which contains classes that my program needs to run.

By placing my .jar files into \MyProgram\WEB-INF\lib\ folder, I was able to get some to work.

However, I see an UnsatisfiedLinkError which is caused by my lib.so file not being recognised.

One of the ways I found was:

  1. In Administrative Console, go to Environment -> Shared Libraries -> New

  2. Enter the .jar file locations into Classpath, enter the .so file location into Native Library Path

  3. In Administrative Console, go to Applications -> Application Types -> Enterprise Applications

  4. Under MyProgram -> Shared library references -> Shared Library Mapping, assign the library to the program by moving it from Available to Selected.

I have two questions:

  1. Can I just get the .jar files and the .so file to work from my program's \lib\ folder instead?

  2. If I can't, is it possible to list the classpath and native library path from my application folder? Something like uploading my application.war with a websphere variable directory %MYPROGRAM%\WEB-INF\lib\lib.so rather than placing the file in the physical server with an absolute path C:\IBM\WebSphere\AppServer\bin\lib.so?

[EDIT-01] Further details below:

Error received: "Error 500: java.lang.UnsatisfiedLinkError: com.chrysalisits.crypto.LunaAPI.Initialize()V"

I am trying to get Websphere to interface with LunaSA HSM to retrieve public/private keys. They have provided me with: libLunaAPI.sl, libLunaAPI.so, LunaJCASP.jar, LunaJCESP.jar. From IBM's Websphere V8 -> References -> Class Loading Exceptions, it indicates that I need the *.so file for HP-UX so I did that accordingly. The path set are absolute paths which I have specified in the Websphere. This relates to my second question.

The first question is me actually wondering whether I can put these files into myProgram.war and run off from there instead of using WinSCP to access the server and putting files there for absolute paths references. Perhaps specify that the above mentioned files are located in my program, under \WEB-INF\lib\ instead. This is because only this program of mine will be accessing the LunaSA HSM.

** PS. I tried both methods but it still fails. sigh.

Em Cee
  • 107
  • 3
  • 11
  • From the WebSphere documentation (at least through version 7; I haven't looked beyond that), it does appear that Native Libraries can only be loaded from the system PATH or from a Shared Library. That is, not from an individual Web Application's deployed path. I don't think I understand your question 2. – dbreaux Jul 05 '12 at 17:05
  • 1
    Hi dbreaux, I am trying to get Websphere to retrieve keys from a LunaSA HSM. Unfortunately, an UnsatisfiedLinkError keeps telling me htat there's something wrong: "Caused by: java.lang.UnsatisfiedLinkError: com.chrysalisits.crypto.LunaAPI.Initialize()V at com.chrysalisits.crypto.LunaAPI.Initialize(Native Method) at com.chrysalisits.crypto.LunaTokenManager.(LunaTokenManager.java:107) at com.chrysalisits.crypto.LunaTokenManager.getInstance(LunaTokenManager.java:62) at com.chrysalisits.cryptox.LunaJCEProvider.(LunaJCEProvider.java:149) at ..." – Em Cee Jul 06 '12 at 03:24
  • I actually tried placing the .war and .so files into the Websphere directory and linking them before assigning the library to my program. The error still occurs, not too sure if it's the correct way of linking the library to the program. – Em Cee Jul 06 '12 at 03:25
  • 1
    That UnsatisfiedLinkError means that you either didn't call System.loadLibrary, the call failed, or the library doesn't contain an appropriately named native method. If the call failed, we will need to see the exception stack trace to determine why. If the call succeeded, does the native method work in a standalone JVM? – Brett Kail Jul 06 '12 at 13:51
  • Yes. After I replaced the .so files with another 64-bit version, the UnsatisfiedLinkError error is no longer there. I see a programming error of 'CrystokiConnect failed'. Guess that's another question for another time. Thanks. – Em Cee Jul 09 '12 at 01:57

1 Answers1

1

For the Shared Library implementation, I believe you specify just the directory in the Native Library Path, not the file name. That is, with your current file location, /opt/apps/WebSphere/AppServer/bin.

On the other hand, I'd expect that directory to already be in WebSphere's WAS_LIBPATH and SHLIB_PATH, so it should be unnecessary to list it at all. (Check $WAS_HOME/bin/setupCmdLine.sh.)

However, I think it would be better to create a subdirectory somewhere for your luna files, and point your Shared Library Native Library Path to that instead.

dbreaux
  • 4,982
  • 1
  • 25
  • 64