IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Java Compilation : java.lang.reflect.InvocationTargetException: Link Error **

    Posted Wed October 26, 2016 01:11 PM

    Hi,

    I have a java program to do encryption and the same will be decrypted using a voltage API.

    Here the issue is the java program is working fine

    • Load the java bindings. This requires the simplejava.dll library to be
      * in java.library.path. On Windows, put simplejava.dll in C:\WINDOWS.

    System.loadLibrary(“simplejava”);

    and the API Jar file for this is imported on my Windows 64 bit . Havind JDK version 1.8

    JAVA_HOME=C:\Program Files\Java\jdk1.8.0_92

    The prgram works in JAVA application on Eclipse


    ISSUE

    The same program is giving an error in webMethods when run from the same as java service.

    Error : -

    Could not run ‘Sample’
    java.lang.reflect.InvocationTargetException: Could not initialize class com.encrypt.toolkit.LibraryContext

    I have placed the .dll file in

    C:\SoftwareAG\IntegrationServer\instances\SAG99default\support\win32

    and the jar are under C:\SoftwareAG\IntegrationServer\instances\SAG99default\packages\Samples\code\jars

    As well as tried by placing the .dll under C:\SoftwareAG\lib

    Nothing works and it keeps giving the same error.

    This is a working JAVA program but when run from SAG java it is throwing an error.

    Can you please help. This is urgent


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 2.  RE: Java Compilation : java.lang.reflect.InvocationTargetException: Link Error **

    Posted Wed October 26, 2016 02:37 PM

    Hi,

    can you try to place the dll in IntegrationServer\lib or IntegrationServer<instance>/\ib?

    Remember to shutdown and start the IS otherwise the dll will not be loaded.

    Regards,
    Holger


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: Java Compilation : java.lang.reflect.InvocationTargetException: Link Error **

    Posted Wed October 26, 2016 02:56 PM

    Hello Holfer

    Yes I have done the same restarted IS but still stuck on the same issue

    Gives the same error

    1. Placed it on IntegrationServer\lib restarted IS later

    2. C:\SoftwareAG\IntegrationServer\instances\SAG99default\support\win32

    Regards
    Mick


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 4.  RE: Java Compilation : java.lang.reflect.InvocationTargetException: Link Error **

    Posted Mon October 31, 2016 12:22 PM


  • 5.  RE: Java Compilation : java.lang.reflect.InvocationTargetException: Link Error **

    Posted Mon October 31, 2016 01:52 PM

    Hi Mickey,

    please name the native library and where exactly you have placed it.

    I am using SAP JCo API for connecting to SAP R/3 Systems.
    This API contains a native dll and a wrapper jar which encapsulates the native methods via JNI into java methods.

    The lib I have placed under IntegrationServer/lib, the jars is placed under IntegrationServer/packages/WmSAP/code/jars/static (as per Adapters documentation).
    Please note the static portion in the path as this is required to load the jar statically during startup.

    OK, I am not doing Java development on this directly, but it might help to understand the different layer.

    In your case the jar should be placed under IntegrationServer/lib/jars/custom.

    Shutdown and start the IntegrationServer otherwise the dll and the jar will not be picked up correctly during startup.

    Not sure if this is working in Local Service Development Scenario.

    Regards,
    Holger


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 6.  RE: Java Compilation : java.lang.reflect.InvocationTargetException: Link Error **

    Posted Mon October 31, 2016 03:50 PM

    Great thanks Holget let me try that option out.

    Here it the sample java that works well with the dll and jar on java program but when we code it in SAG it throws the below error

    Could not run ‘Sample’
    java.lang.reflect.InvocationTargetException: Link Error: Native Library C:\SoftwareAgl\IntegrationServer\instances\default\lib\java.dll already loaded in another classloader

    DLL file is there only in SAG location I tried by placing on win32 earlier and changed the wrapper config too. It gives this error whenevr we make any changes on the code

    Placed the DLL using System.Load.

    Code :-

    System.loadLibrary(“Files”);
    try {
    String URL = “testpolicy.xml”;
    String emailAddress = “TESTMAX@SHA.com”;
    pipelineCursor.destroy();

    	Encrypt en= null;
    
    String text;
    byte[] textBytes, EncrypVal, resultVals;
    
    plaintext = "Apply policy";
    textBytes = plaintext.getBytes();
    
    EncrypVal = en.Encrypt(newVal, Info, null, textBytes);
    
    String newIdentity =en.EncrptionEncrypVal);
    
    resultVals =en.EncryptVal(new Val, Info, SHA, EncrypVal);
    

    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: Java Compilation : java.lang.reflect.InvocationTargetException: Link Error **

    Posted Mon October 31, 2016 04:04 PM

    Nope :frowning: still same issue

    Now it is giving error stating

    Could not run ‘Sample’
    java.lang.reflect.InvocationTargetException: Could not initialize class com.val.EncryptContext


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB