Skip to Content

Addition 2 on 25/07/2017: The bean will download the (jar) files as a zipped file on the receiver channel.

Overview:

When moving across different clients, it can take some time to set up NWDS with all the jar files required for development. Otherwise, sometimes while staring a new development, it can take some time to find the jar files required. This blog describes a generic approach to find the jar files for a list of files.

 

Solution:

The approach has been already covered in previous blogs like this link.

However, the class name is hardcoded and I was thinking of creating a generic solution where I can just plug an adapter module and it will retrieve the jar files for a list of classes.

Bean Name: FindClassPathBean

It doesn’t need any parameters and tries to find the jar files for each of the lines which are expected to be class names.

 

Configuration:

Create an ICO/iFlow with a SOAP sender and ftp adapter as receiver.

 

 

For this example, below is the list of classes for which we’re getting an error in NWDS as we don’t have the jar files set up in our project.

 

Remove the import and semi-colons to just get the class names.

This list of class names can be used in the test tool.

Launch PIMON

http://server:port/pimon
Chose Testing Tab->Send Test Message

 

Here in payload the list of classes can be supplied for which we’re interested in finding the jar files.

 

Send the message and we get the logs with the jar locations  !

It’s really handy if we have a large set of files to work through.

 

 

The bean blanks out the message as we don’t want to write any file to the target FTP server. FTP adapter has been configured to ignore blank messages .

 

and from the adapter log indicates FILE_SUC_EMPTYPAYLOAD indicating empty message has been received by the FTP adapter. On a side note, I’m not sure why SAP chose this cryptic string instead of writing the text that an empty message has been received and nothing will be written to the end-point.

 

This enables us to navigate the file path as mentioned in this blog link .

 

This is the github link which has the EAR file which we can be deployed to the PI server and can be used straight away.

My test was done on a PO 7.4 system.

 

Addition 2:

An idea was put forward in one of the comments to download the files.

 

The second revision reads the files and downloads the files as a zipped file in the target directory.

Put the class names. As a test I have put the class name of the bean itself.

 

 

The logs indicate the files being read.

The log confirms the file has been written.

 

if we download and open the file, it shows the jar files which have been added.

 

So using this bean, we’re able to display the jar paths and download the jar files as a single zipped file. internally, it’s using a set to store the class name and hence a jar file will be added to the zip only once even if it corresponds to multiple classes.

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. sapbinary key

    Nice and elegant solution…

     

    can i enhance the code so that, once i test the scenario, it creates zip file which contains all jar files?

     

    (0) 
      1. sapbinary key

        🙂

        Thank you Vikas for your time to enhance this.

        This will be more helpful for PI/PO folks during java development. Not all are having access to PI server file level access. They can skip going to basis team.

        (0) 
  2. Evgeniy Kolmakov

    Hi Vikas!

    Thanks for sharing this.

    But I guess the easiest way is to put the same code into UDF, and just run the test in MM to get desired class(es) locations. 🙂

    Regards, Evgeniy.

    (1) 
      1. Evgeniy Kolmakov

        Hi Manoj!

        I haven’t read the mentioned blog before, but Praveen went the same way I did 🙂 Just copied the code into UDF. I did the same :-).

        Regards, Evgeniy.

        (1) 
        1. Vikas Singh Post author

          Hi Evgenly/ Manoj,

          yes we can definitely do the message mapping and UDF. it’s just that I moved between different clients and was looking to create a bean to do give me the file locations easily for a large group of missing classes and I’m too lazy to create a message map for it. It doesn’t help that I can’t access ESR now ( for some other reason ) and only had access to integration builder.

          I’ve given the link of other blogs as that’s where I got the idea – just decided to enhance it.

          Thanks,

          Vikas

          (3) 
  3. Apu Das

    Hi Vikas,

    Nice blog indeed.

    But, why it is even required to add separately jar files in your JAVA mapping or custom module development project when it is not external jar files but SAP internal jar files.

    We can always add XPI mapping/adapter library in our java project which will add all required jars automatically.

    Thanks,

    Apu

    (0) 
    1. Evgeniy Kolmakov

      Hi Apu!

      There are lots of classes used in Adapter framework which are not included in XPI adapter library.

      For example, you can try to use XMBMessageOperator class in your code.

      Regards, Evgeniy.

       

      (2) 
    2. Vikas Singh Post author

      I was building an adapter and not a map or custom module in this case.

      Earlier, I was building a Java proxy which reads AS Java database and there were other libraries required.

      Cheers,

      Vikas

      (2) 

Leave a Reply