webMethods

 View Only
  • 1.  Please tell me how to add jar file in webMethods

    Posted Thu December 05, 2024 09:41 AM

    hello
    To use POI in a web method, I added a jar file to the directory identified in the topic.

    Currently, if i run debug using TestHarness.java, the Excel file is generated well.
    However, if i run the Java service directly, an error occurs.
    Please let me know what I'm missing.

    I am sharing the error message below and an image of the jar file I added.



    ------------------------------
    DONGWOO LEE
    ------------------------------


  • 2.  RE: Please tell me how to add jar file in webMethods

    Posted Fri December 06, 2024 04:53 PM
    Edited by engin sarlak Fri December 06, 2024 05:00 PM
      |   view attached

    Assuming you have properly imported the library to your java service and reloaded the package you added this jar file to and created a dependency properly if you put in to a different package then the package you are hosting the java service. 

    Does it compile when you make changes to the java service and save it? Or does it generate an exception? 

    Integration Server and Designer use java compiler and libraries differently. You don't need designer to run or compile java services. Integration Server uses the JDK comes with the installation as default, but it can be changed. Review the extended setting in the picture below. The default setting should work but if it is changed to something that doesn't exist or not reachable it won't compile. Check the document below for more info. 

    watt.server extended settings

    If the compiler path doesn't have the full path of the JVM and when you run javac command at the server you run the IS from anywhere in terminal doesn't find the java compiler, you need to add that java path to the environment path so that it will find it from everywhere, or add that full(or relative path, but it will be more difficult to build) to the watt.server.compile setting. Basically if it doesn't find javac, it should be able to find {full path to jdk}/javac command. 

    Importing the JAR file to the designer is the same as importing a JAR file to the eclipse. This will only make it recognize the java library functions and clear the false "not found" errors. 

    If the server compiles after making a small change (like adding a white space somewhere) try running the service using admin UI or run it from browser. 



    ------------------------------
    engin sarlak
    ------------------------------



  • 3.  RE: Please tell me how to add jar file in webMethods

    Posted Tue December 10, 2024 02:06 PM

    You have the jar file in the right location. But when you run the service, it needs to be able to find all the dependencies on the classpath. It appears that the class being reported in the error message is either not on the classpath or the wrong version of it is in the classpath. Its likely the second case as the apache commons libraries included in the Integration Server are slightly older and never the latest. The solution to this is that find all the dependencies and copy them into the same location.

    The test harness is running as a java application and doesnt have anything to do with the Integration Server. If you check the classpath of the java application you will find that it is different from the server's classpath



    ------------------------------
    Rupinder Singh
    CTO, Nibble Technologies
    https://www.nibl.tech/
    ------------------------------



  • 4.  RE: Please tell me how to add jar file in webMethods

    Posted 6 days ago

    There is a problem with the class loader in one of the involved (don't remember the details right now) jar files. In a nutshell the newer POI versions require a version of xmlbeans(?) that is newer than the one that comes with webMethods. But due to some "clever" automatic class loading, they load the old version from webMethods, even if you provide a newer one. At least that what I experienced about a year ago.



    ------------------------------
    All the best,
    Christoph
    ------------------------------



  • 5.  RE: Please tell me how to add jar file in webMethods

    Posted 6 days ago

    If none of the suggestions mentioned by other users did not work then try adding this to your package manifest.v3 file and then reload the package. This should force the class loading to use the jars at package level before picking it from somewhere else on the server.

    <value name="classloader">package</value>


    ------------------------------
    Akshith Arremreddy
    ------------------------------