BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
  • 1.  methods do not appear when importing jar

    Posted Tue March 05, 2024 07:52 AM

    Im having the following issue on ibm bpm 8.5.6. ive developed a jar with a class with public methods. some of these methods appear when i import the jar on ibm but some wont. the weird thing is that both methods that do appear and dont have the same signature

    heres the signature for the 3 methods:

       public static List<String> generateInsertStatementsFromFile(String filePath, String tableName, String[] selectedAttributes) throws UnknownHostException {
    	-----------------------------
       }
       public static String generateInsertStatementsFromFileString(String filePath, String tableName, String selectedAttributes) throws UnknownHostException {
    	------------------------------
       }
       public static String generateInsertStatementsFromFileObjectJSON(String filePath, String selectedAttributes) throws UnknownHostException {
    	------------------------------
       }

    method generateInsertStatementsFromFile and generateInsertStatementsFromFileString appear when importing the jar, generateInsertStatementsFromFileObjectJSON doesnt. what could be going on?



    ------------------------------
    jhon wick
    ------------------------------


  • 2.  RE: methods do not appear when importing jar

    Posted Tue March 05, 2024 08:21 AM

    Hi John,

    Can you try running the methods from the main method in the same class before exporting the JAR, sometimes I also face this issue, this works for me.

    Please let me know if this works.

    Thanks!



    ------------------------------
    Atanu Roy
    Lead Engineer
    London Stock Exchange Group
    ------------------------------



  • 3.  RE: methods do not appear when importing jar

    Posted Tue March 05, 2024 12:22 PM

    ill try and come back to you. thanks



    ------------------------------
    jhon wick
    ------------------------------



  • 4.  RE: methods do not appear when importing jar

    Posted Wed March 06, 2024 07:17 AM
    Edited by jhon wick Wed March 06, 2024 07:25 AM

    Atanu, hi. i created an interface for the method and a new class to run the method from. when running the interface and the method i get this error:

    <error type="java.lang.NoSuchMethodError" description="NoSuchMethodError">
      <cause type="java.lang.Throwable" description="cause"></cause>
      <localizedMessage type="java.lang.String" description="String">org/example/FileToSQL.&lt;init&gt;(Ljava/lang/String;)V (loaded from managedasset:61.6d8885d5-6887-41d5-96c3-125570ae46ae by com.lombardisoftware.server.core.ManagedAssetClassLoader@e011f1e2 [current classloaderMap size=129, initial classloaderMap size=1000]) called from interface org.example.InterfaceFileToSQL (loaded from managedasset:61.1f25586c-c326-45d4-8007-0f6ecf42bf05 by com.lombardisoftware.server.core.ManagedAssetClassLoader@e011f1e2 [current classloaderMap size=129, initial classloaderMap size=1000]).</localizedMessage>
      <message type="java.lang.String" description="String">org/example/FileToSQL.&lt;init&gt;(Ljava/lang/String;)V (loaded from managedasset:61.6d8885d5-6887-41d5-96c3-125570ae46ae by com.lombardisoftware.server.core.ManagedAssetClassLoader@e011f1e2 [current classloaderMap size=129, initial classloaderMap size=1000]) called from interface org.example.InterfaceFileToSQL (loaded from managedasset:61.1f25586c-c326-45d4-8007-0f6ecf42bf05 by com.lombardisoftware.server.core.ManagedAssetClassLoader@e011f1e2 [current classloaderMap size=129, initial classloaderMap size=1000]).</message>
      <stackTrace type="[Ljava.lang.StackTraceElement;" description="StackTraceElement;">

    when tested in my ide both methods work fine



    ------------------------------
    jhon wick
    ------------------------------



  • 5.  RE: methods do not appear when importing jar

    Posted Wed March 06, 2024 07:28 AM

    Hello John,

    I meant just randomly running the method from the same class before taking the JAR export. Let's say if I have to take the below code as JAR export, the steps are - 

    1. Finish the code
    2. Run as a Java program (it may throw an error, let's say you are trying to make HTTP call from the method with an incorrect URL, that is fine, we just need to run it)
    3. Remove the main method, there is no use of it
    4. Take the export

    class HelloWorld {
        public static String returnString(String str){
            return "Hello - "+str;
        }
        public static void main(String[] args) {
            returnString("John");
        }
    }


    ------------------------------
    Atanu Roy
    Lead Engineer
    London Stock Exchange Group
    ------------------------------



  • 6.  RE: methods do not appear when importing jar

    Posted Wed March 06, 2024 10:56 AM

    Jhon, 

    One of the ways this error would manifest only after you bring the .jar file into BAW, is when BAW already has loaded an older version of the classes/interfaces. It does not take much for it to happen either. Once you upload version 1 of the jar and try to execute it the classes would be loaded. Then if you upload version 2 of the jar, not everything may get reloaded. Thus, the managed asset class loader would not find the latest method it is looking for in the definition that came from version 1 of the jar. 

    I have been able to resolve it by removing the jar and letting the service fail on the next try. Then reuploading the jar, with the hope that it would force the classes to be reloaded, or by simply restarting the dev instance (much more reliable). Hope this helps!



    ------------------------------
    Ajay Katre
    Salient Process
    ------------------------------