Friday, February 24, 2012

Oracle B2B 11g java.lang.UnsatisfiedLinkError

I hit this error recently while trying to send an EDI data through my B2B gateway and lost my way as couple of re-installs from scratch didn't really helped either. All the help from different forums and blogs pointed basically to 4 causes for this error as cited below; Note that my environment is Windows 7 64-bit with SOA 11.1.1.5 (latest as on the date of writing).

1. Installing 32-bit installables of SOA suite/WebLogic on a 64-bit environment
2. Installed 64-bit installables of SOA/WebLogic on a 32-bit JDK
3. Corrupt Edifecs or XEngine files
4. Permissions issue on the XEngine folder/libraries

If your case falls in one of the aforesaid cases, then don't read further as you will have to rectify them which could well solve the issue in first place.

In my case, neither of the above were the actual causes as I got my environments and installs perfectly having done several middleware product installs on various environments myself !!! However, this error simply defied all logic and intuition. Detailed error message below;

<Error> <oracle.soa.b2b.engine> <BEA-000000> <java.lang.UnsatisfiedLinkError: com.edifecs.xengine.xeobjects.XEHelper.createSourceFromStreamNative(Ljava/lang/String;Ljava/io/InputStream;)Lcom/edifecs/xengine/xeobjects/XESource;       
        at com.edifecs.xengine.xeobjects.XEHelper.createSourceFromStreamNative(Native Method)
        at com.edifecs.xengine.xeobjects.XEHelper.createSourceFromStream(Unknown Source)
........................................
........................................
at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:234)
        at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
        at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:183)
        at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
>

Then I started my traditional Google search in a slightly different fashion trying to identify the generic root cause of this exception. After all this is a JAVA error which is reported during the EDI processing by the B2B gateway.

At this juncture it would be good to understand the cause for "java.lang.UnsatisfiedLinkError"; As per Java Docs this error is "Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native". Now, this much of help is great to identify and resolve the issue (at least in this particular case ;)

As a matter of fact, XEngine library files are located in <MiddlewareHome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\bin. I also noticed the following message in the WebLogic console during my server startup which explained the rest.

XEngine may not be installed properly. If you plan to use EDI/HL7 that requires XEngine, please unzip the XEngine bundle to install XEngine manually in $ORACLE_HOME/soa/thirdparty/edifecs directory

Yes, the library files are intact and are present in the specified location (uncorrupted !). It is just that WebLogic could not load the XEngine libraries. Now, there is one way to explicitly make WebLogic load these libraries;

If you are on Windows, set -Djava.library.path=<MiddlewareHome>\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\bin
On Linux, set LD_LIBRARY_PATH=<MiddlewareHome>/Oracle_SOA1/soa/thirdparty/edifecs/XEngine/bin

Doing this explicitly in setSOADomainEnv.cmd or setSOADomainEnv.sh will ensure that WebLogic loads these libraries during server startup and voila we got rid of the spunky error.

Ah.. Finally do let me know if this helped you :)

6 comments:

  1. Thanks Sathya... This helped me a lot!.. Added the missing LD_LIBRARY_PATH entry in my installation and error diappeared.. ;-)

    Thanks again. .Sam

    ReplyDelete
  2. I could not find any help documents of how to use Edifecs XEngine with Oracle SOA Suite. I am new to Edifecs XEngine. Can you please point me to any documentation which can help me understand how to configure/run/test XEngine with Oracle SOA Suite. You can also email me (paulavijit@yahoo.com).

    Thanks in advance.

    Regards
    Paul

    ReplyDelete
    Replies
    1. Paul,

      As you may be already aware, B2B is an edge component of Oracle SOA Suite and is bundled along. You can refer to the Oracle B2B documentation for more information;
      http://www.oracle.com/technetwork/middleware/soasuite/documentation/index.html

      Delete
  3. Hi,

    I change the environment variable but it still doesn't work! Any suggestions?

    thanks!

    ReplyDelete
    Replies
    1. Generally, I have seen this fix work in multiple environments. Can you please check whether the path that you have set has the xengine libraries? Thanks!

      Delete