cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving .EAR deployed - PI 7.02 SP14

RafaelVieira
Active Participant
0 Kudos

Hi all,

In the project I'm currently involved, there was a sender mail adapter module development a long ago, which was done by another consulting guys. They have developed the custom adapter module and now the mail sender adapter is able to work with multiple attachments, identifying and forwarding only the relevant (.XML) files to a BPM and, also, inside the module code, it identifies the type of XML as per the business requirements by checking a particular tag and forwards the process ID to the BPM.

I have to modify this adapter module, increasing the XML type range, however I don't have its source code (.java).

I was wondering how hard would it be to achieve this task.

Is it a valid option, retrieving the .EAR file deployed and then be able to get the .class file(s) and try to take its source code through any specialist tool for this purpose (i.g. JD GUI or Java Decompiler)?

Some additional questions:

- Is it the only option I have, giving that there's no documentation or backup of the source code?

- If yes, how can I retrieve the deployed .EAR file from PI server? Where is it stored?

- If no, what other options do I have (appart from crying)?

Tks a lot!

Rafael.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

Hi Rafael - Below thread will help you in finding the deployed ear file.

http://scn.sap.com/thread/1971161

RafaelVieira
Active Participant
0 Kudos

Hi Hareesh, thanks for your suggestion !!!

I was able to get the EAR file within /usr/sap/<SID>/DVEBMGS02/j2ee/cluster/server0/apps/sap.com.

I found the main .JAR file inside and most part of its source code was shown in that tool I mentioned before, but some errors appeared and some pieces of source code had disappeared (see below, from function convertStreamToString on, everything was replaced by the error message and byte code).

  /* Error */

  public String convertStreamToString(java.io.InputStream is)

   throws java.io.IOException

  {

   // Byte code:
  // 0: aload_1
  // 1: ifnull +91 -> 92
  // 4: new 406 java/io/StringWriter
  // 7: dup
  // 8: invokespecial 407 java/io/StringWriter: ()V
  // 11: astore_2
  // 12: sipush 1024
  // 15: newarray char
  // 17: astore_3
  // 18: new 409 java/io/BufferedReader
  // 21: dup
  // 22: new 411 java/io/InputStreamReader
  // 25: dup
  // 26: aload_1
  // 27: ldc_w 308
  // 30: invokespecial 414 java/io/InputStreamReader: (Ljava/io/InputStream;Ljava/lang/String;)V
  // 33: invokespecial 417 java/io/BufferedReader: (Ljava/io/Reader;)V
  // 36: astore 4
  // 38: goto +11 -> 49
  // 41: aload_2
  // 42: aload_3
  // 43: iconst_0
  // 44: iload 5
  // 46: invokevirtual 423 java/io/Writer:write ([CII)V
  // 49: aload 4
  // 51: aload_3
  // 52: invokevirtual 429 java/io/Reader:read ([C)I
  // 55: dup
  // 56: istore 5
  // 58: iconst_m1
  // 59: if_icmpne -18 -> 41
  // 62: goto +11 -> 73
  // 65: astore 7
  // 67: jsr +12 -> 79
  // 70: aload 7
  // 72: athrow
  // 73: jsr +6 -> 79
  // 76: goto +11 -> 87
  // 79: astore 6
  // 81: aload_1
  // 82: invokevirtual 434 java/io/InputStream:close ()V
  // 85: ret 6
  // 87: aload_2
  // 88: invokevirtual 435 java/lang/Object:toString ()Ljava/lang/String;
  // 91: areturn
  // 92: ldc -98
  // 94: areturn
  // Line number table:
  // Java source line #287 -> byte code offset #0
  // Java source line #288 -> byte code offset #4
  // Java source line #290 -> byte code offset #12
  // Java source line #292 -> byte code offset #18
  // Java source line #293 -> byte code offset #22
  // Java source line #292 -> byte code offset #33
  // Java source line #295 -> byte code offset #38
  // Java source line #296 -> byte code offset #41
  // Java source line #295 -> byte code offset #49
  // Java source line #298 -> byte code offset #65
  // Java source line #299 -> byte code offset #81
  // Java source line #291 -> byte code offset #85
  // Java source line #301 -> byte code offset #87
  // Java source line #303 -> byte code offset #92
  // Local variable table:
  // start length slot name signature
  // 0 95 0 this MultipleXML
  // 0 95 1 is java.io.InputStream
  // 11 77 2 writer java.io.Writer
  // 17 35 3 buffer char[]
  // 36 14 4 reader java.io.Reader
  // 41 4 5 n int
  // 56 3 5 n int
  // 79 1 6 localObject1 Object
  // 65 6 7 localObject2 Object
  // Exception table:
  // from to target type
  // 18 65 65 finally

  }



Is there any other way to obtain the Custom Adapter Module source code with no errors?


Tks a lot!

former_member184720
Active Contributor
0 Kudos

Hi Rafael - Sorry but i dont think there is another alternative. However it'll be same ear you'll be able to download.

Try to understand the functionality with the existing code and modify it to add new functionality..

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Rafael

If you know the requirement, I will suggest you to write a new module from scratch instead of wasting time to get the .class file back and de-compile it.

RafaelVieira
Active Participant
0 Kudos

I really appreciate all the suggestions.

I see there's no further actions to be taken but starting from scratch.

Thanks a lot!

Rafael.