cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with Java mapping

ajeyagv
Participant
0 Kudos

Hello SAP PI Experts,

I'm creating a Java mapping program to convert XML file to JSON file (and also convert JSON to XML file in another java mapping program) and I believe I have written the logic well, but after I compiled and imported the classes into PI system, I ran a test payload. I got the below mentioned error. I request you to help me with this. Our requirement is to conduct REST messaging and our SAP PI version (7.1) doesn't support that. SO, my plan is to perform this data conversion and enable the communication between our SAP system and that 3rd party REST webservice system. -

Loaded class jsonConversion.XMLtoJsonConverter Call method execute of the application Java mapping jsonConversion.XMLtoJsonConverter LinkageError during appliction Java mapping jsonConversion/XMLtoJsonConverter java.lang.NoClassDefFoundError: net/sf/json/xml/XMLSerializer at jsonConversion.XMLtoJsonConverter.transform(XMLtoJsonConverter.java:26) at com.sap.aii.ib.server.mapping.execution.JavaMapping.executeStep(JavaMapping.java:112) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.SequenceMapping.executeStep(SequenceMapping.java:40) at com.sap.aii.ib.server.mapping.execution.Mapping.execute(Mapping.java:60) at com.sap.aii.ib.server.mapping.execution.MappingHandler.map(MappingHandler.java:87) at com.sap.aii.ib.server.mapping.execution.MappingHandler.map(MappingHandler.java:54) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:139) at com.sap.aii.ibrep.server.mapping.exec.ExecuteIfMapCommand.execute(ExecuteIfMapCommand.java:33) at com.sap.aii.ib.server.mapping.exec.CommandManager.execute(CommandManager.java:43) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:40) at com.sap.aii.ibrep.server.mapping.MapServiceBean.execute(MapServiceBean.java:40) at sun.reflect.GeneratedMethodAccessor1372.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:46) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:74) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:191) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:23) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179) at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133) at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164) at $Proxy2812.execute(Unknown Source) at sun.reflect.GeneratedMethodAccessor1371.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:592) at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:234) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:384) at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:81) at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:67) at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:41) at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:1044) at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:57) at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:55) at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122) at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101) at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:327) Caused by: com.sap.aii.ib.server.mapping.execution.MappingClassNotFoundException: net/sf/json/xml/XMLSerializer.class at com.sap.aii.ib.server.mapping.execution.InternalMappingFinder.getInputStream(InternalMappingFinder.java:119) at com.sap.aii.ib.server.mapping.execution.InternalMappingFinder.readClass(InternalMappingFinder.java:81) at com.sap.aii.ib.server.mapping.execution.MappingLoader.findClass(MappingLoader.java:166) at java.lang.ClassLoader.loadClass(ClassLoader.java:370) at java.lang.ClassLoader.loadClass(ClassLoader.java:315)

Thanks in advance,

Ajeya G V

+91 9920041442

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor

Hi Ajeya!

According to error message, external class used by your mapping program couldn't be found. Make sure you imported all required external libraries.

Regards, Evgeniy.

ajeyagv
Participant
0 Kudos

Thanks for the reply. I checked and no line in the code is in error due to missing definition or something like that. Doesnt that confirm that all the necessary libraries has been imported ? Please confirm this.

Thanks,

Ajeya G V

former_member190293
Active Contributor
0 Kudos

Hi Ajeya!

Where did you checked that? If you use any IDE like Eclipse or NWDS for developing java mappings, you are able to verify that all external libraries or classes are available within your IDE only and not on PI server side.

So, if you use additional libraries in your java programm, which are not the part of PI mapping runtime and are not standard java classes - generally, you should import respective jar archives the same way you use for importing your java mappings to ESR.

Regards, Evgeniy.

Answers (1)

Answers (1)

ajeyagv
Participant
0 Kudos

Hi All,

Thanks for the assistance. The issue was with the mismatch of the java versions of the libraries I had downloaded. They were of the 1.6 version and PI wasnt able to understand as it needs the Java version in 1.5.

Thanks for the help 🙂

Regards,

Ajeya G V