cancel
Showing results for 
Search instead for 
Did you mean: 

Linkage error while loading class - java.lang.NoClassDefFoundError: org/apache/commons/lang/StringEscapeUtils

Former Member
0 Kudos

Hi Exparts,

In one java mapping I have use a external jar common-lang-2.3.jar. And the corresponding method which I have used in the java map is StringEscapeUtils.escapeXml(“the string”);

It is for handling spatial characters (“,’,&,<,>) in xml data, like if  <a> you & I </a> comes it will transfer to <a> you &amp;  I </a>

After creating the imported archive when I ran it in ESR locally in test tab it is running fine but when ever I run it end to end or triggering  it from RWB it is giving error in MONI as "Linkage error while loading class - java.lang.NoClassDefFoundError: org/apache/commons/lang/StringEscapeUtils".

What can be the reason for it ?

Thanks,

Aniruddha

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi,

A few cents,

In addition to Anupam you should recompile all the classes that you have developed for the java mapping

Regards.

Former Member
0 Kudos

Hi,

Already done but no result..

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi,

Have you tried to do a dummy change (in description for example) in the Imported Archives and in the Operation  Mapping?

Regards.

Former Member
0 Kudos

yes.. Recreating the jar, Importing in imported archive, OM - read operation then Activating.. all done.. But no result.. My main question is, it is running locally in ESR test tab but when ever I run it end to end or triggering  it from RWB it is giving the error. How possible ?

Regards

anupam_ghosh2
Active Contributor
0 Kudos

Hi Aniruddha,

                      Did you import the classes inside external jar file common-lang-2.3.jar along with the main java code ?  You need to import them too in the final jar file.

Regards

Anupam

iaki_vila
Active Contributor
0 Kudos

Hi,

It's possible because when you test in ESR you are not using the runtime cache. In that cache there are any problem about the classes version. Normally with the Anupam solution the poblem should be resolved or with a dummy change that cache take the new version classes.

Regards.

Former Member
0 Kudos

Hi Anupam,

How can I import the classes inside external jar file common-lang-2.3.jar separately? The external jar I have added in Library with option add external jar. Then export the whole project in final jar with steps export->jar file->checked class and source file & resources.

In your above solution I have tried 1.5 also.. but no result.

Thanks,

Aniruddha

anupam_ghosh2
Active Contributor
0 Kudos

Hi Aniruddha,

                          try this approach to include commom-lag-2.3.jar file in PI

1. You must be adding this as external jar file.

2. Instead of step 1 try importing the jar file inside your project as archive. Right click on project name-> import ---->archive.

3. Once this is imported then recompile the  project once again. (have both versions one with java 1.5 and another with java 1.6).

4. While exporting to final jar file include all classes of your project along with source file.

5. Now import the jar file within PI.

Here you are, error must vanish.

Regards

Anupam 

Answers (2)

Answers (2)

0 Kudos

Hi Ani,

Please check the JVM Version.

i think PI installed JVM and Java Code Compiled JVM are not same.

Generally we can get this error when we imported the Lower Version JVM complied class.

Regards,

Venkat.

anupam_ghosh2
Active Contributor
0 Kudos

Hi Aniruddha,

                     what is the version of PI you are working with?

What is the version of j2sdk  in your local system?

Linkage error is there if the java version of your local system does not match the expectation of PI server. For PI 7.0 you need to compile your code in j2sdk1.4.2_15 . For PI 7.1 and above you need j2sdk 1.5.0.   Finally if you want to replace special characters without external jar files you can also do it this way

String s; //holds all special charaters in xml

s=s.replaceAll("&","&amp;");

s=s.replaceAll("<","&lt;");

s=s.replaceAll(">", "&gt;");

s=s.replaceAll("'", "&apos;");

s=s.replaceAll("\"", "&quot;");

Regards

Anupam

Former Member
0 Kudos

Hi Anupam,

PI version: 7.3 (with dual stack)

NWDS JDK version: 1.6

ESR JDK version:

              

NW730EXT_07_REL
07
jdk16

Thanks,

Aniruddha

anupam_ghosh2
Active Contributor
0 Kudos

Hi Aniruddh,

                  Did you try installing j2sdk1.5 in your local system and recompile the code?

You can have multiple installations of java/JRE in same sytem. JRE should also be of version 1.5.  

Regards

Anupam