on 05-15-2015 7:14 AM
Hi Friends
I facing issue with java mapping while testing in Operation mapping. can any body help please I am Implementing java mapping for the first time.
I am using PI 7.1
and java version is 1.8.0_45
| LinkageError at JavaMapping.load(): Could not load class: LinkAssetsToTechnicalTypeLookup/bin/com/gesmallworld/sbi/sapmapper/linkassets/TechnicalTypeLookupResult$TechnicalTypeLookup |
java.lang.UnsupportedClassVersionError: LinkAssetsToTechnicalTypeLookup/bin/com/gesmallworld/sbi/sapmapper/linkassets/TechnicalTypeLookupResult$TechnicalTypeLookup : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:677) at java.lang.ClassLoader.defineClass(ClassLoader.java:522) at com.sap.aii.ib.server.mapping.execution.MappingLoader.findClass(MappingLoader.java:201) at java.lang.ClassLoader.loadClass(ClassLoader.java:363) at java.lang.ClassLoader.loadClass(ClassLoader.java:308) at com.sap.aii.ib.server.mapping.execution.JavaMapping.load(JavaMapping.java:143) at com.sap.aii.ib.server.mapping.execution.JavaMapping.executeStep(JavaMapping.java:67) 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.GeneratedMethodAccessor6018.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:177) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) 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:177) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189) at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16) at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177) 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:177) 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:177) 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 $Proxy2920.execute(Unknown Source) at sun.reflect.GeneratedMethodAccessor6017.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:362) at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:69) 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:977) 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) |
Hi,
PI7.1 version supports only till java1.5 version. So compile your java mapping code with JDK1.5
//BR,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thread closed.
This issue solved by changing jdk compile version to 1.5 in Project properties(Eclipsc)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
package com.gesmallworld.sbi.sapmapper;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import java.io.*;
import java.util.Date;
import java.util.Map;
import org.jdom.Document;
import org.jdom.Namespace;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
@SuppressWarnings("deprecation")
public abstract class AbstractSAPMapper implements StreamTransformation {
private static final String sapNamespacePrefix = "ns1";
private static final String sapNamespaceURI = "urn:sap-com:document:sap:rfc:functions";
private static final String rfcNamespacePrefix = "rfc";
private static final String rfcNamespaceURI = "urn:sap-com:document:sap:rfc:functions";
private static final String sxiNamespacePrefix = "sxi";
private static final String sxiNamespaceURI = "http://sap.com/xi/XI/SplitAndMerge";
private static final String gmlNamespacePrefix = "gml";
private static final String gmlNamespaceURI = "http://www.opengis.net/gml";
private static final String swGmlNamespacePrefix = "swgml";
private static final String swGmlNamespaceURI = "http://www.gesmallworld.com/swgml";
private static final String swApplicationNamespacePrefix = "sw";
private static final String swApplicationNamespaceURI = "http://www.gesmallworld.com/sw";
protected Namespace getSAPNamespace() {
return Namespace.getNamespace(sapNamespacePrefix, sapNamespaceURI);
}
// Same URI as getSAPNamespace() but different prefix !
protected Namespace getRFCNamespace() {
return Namespace.getNamespace(rfcNamespacePrefix, rfcNamespaceURI);
}
protected Namespace getSXINamespace() {
return Namespace.getNamespace(sxiNamespacePrefix, sxiNamespaceURI);
}
protected Namespace getGMLNamespace() {
return Namespace.getNamespace(gmlNamespacePrefix, gmlNamespaceURI);
}
protected Namespace getSWGMLNamespace() {
return Namespace.getNamespace(swGmlNamespacePrefix, swGmlNamespaceURI);
}
protected Namespace getSWApplicationNamespace() {
// Note: this is configurable in GSS so should not be hard-coded here
return Namespace.getNamespace(swApplicationNamespacePrefix, swApplicationNamespaceURI);
}
@SuppressWarnings("rawtypes")
public void setParameter(Map map) {
// Do nothing - this method is required by the interface StreamTransformation
}
/**
* Is called from the runtime after executing setParameter(java.util.Map).
* This method contains an java.io.InputStream for the source document and
* an java.io.OutputStream for the target document as parameters. These
* streams are usually XML documents. The target document must be written in
* the passed java.io.OutputStream out. For parsing XML document
* javax.xml.parsers.SAXParser or javax.xml.parsers.DocumentBuilder can be
* used. During converting bytes to java.lang.String or java.lang.String to
* bytes take care about the encoding. A StreamTransformationException
* indicates a problem . The message than gets an error state in the
* pipeline.
*
* @param inputStream
* source document
* @param outputStream
* target document to fill
* @throws StreamTransformationException
* - indicates a problem during execution of the mapping program
*/
public abstract void execute(InputStream inputStream, OutputStream outputStream)
throws StreamTransformationException;
protected void writeResult(OutputStream out, String result) throws StreamTransformationException {
try {
out.write(result.getBytes());
out.flush();
out.close();
} catch (IOException e) {
throw new StreamTransformationException("Could not write transformation to output stream");
}
}
protected void writeResult(OutputStream out, Document result) throws StreamTransformationException {
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
try {
outputter.output(result, out);
} catch (IOException e) {
throw new StreamTransformationException("Could not write transformation to output stream");
}
}
protected String readInputStream(InputStream in) {
StringBuffer sb = new StringBuffer();
try {
int c;
c = in.read();
while (c != -1) {
sb.append((char) c);
c = in.read();
}
} catch (IOException e) {
// e.printStackTrace();
return null;
}
return sb.toString();
}
/*
This function is for debugging on the SAP system. Call with
inputStream = logInputStream(inputstream) above. It will log
the request into a log file on the SAP instance.
*/
protected InputStream logInputStream(InputStream in) {
StringBuffer sb = new StringBuffer();
try {
String fileName = "C:\\Temp\\log_message_" + new Date().getTime() + ".txt";
File f = new File(fileName);
FileWriter fw = new FileWriter(f);
int c;
while ((c = in.read()) != -1) {
sb.append((char) c);
}
fw.write(sb.toString());
fw.flush();
fw.close();
} catch (IOException e) {
e.printStackTrace();
}
return new ByteArrayInputStream(sb.toString().getBytes());
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello.
You can download the mapping JAR files directly from your PI server.
You can refer to this wiki to find out where the JARs are located:
http://wiki.scn.sap.com/wiki/display/XI/Where+to+get+the+libraries+for+XI+development
Or, you can write the Java Mapping directly in a Message Mapping by just writting the Method transform in its "Functions" tab, "Methods and Attributes" section.
Refer to Sunil Chandra's blog:
http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/13/write-java-mapping-directly-in-es...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.