on 03-23-2009 2:16 PM
Hi friends,
I am tryin java mapping for first time.. and created one java program using link https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field
But when I am compiling it using JAVAC, I am getting following error message that
package com.sap.aii.mapping.api does not exist . How can I solve this error.
Complete error is as follows:
C:j2sdk1.4.2_16-x64in>javac PayloadToXMLField.java
PayloadToXMLField.java:1: package com.sap.aii.mapping.api does not exist
import com.sap.aii.mapping.api.StreamTransformation;
^
PayloadToXMLField.java:2: package com.sap.aii.mapping.api does not exist
import com.sap.aii.mapping.api.AbstractTrace;
^
PayloadToXMLField.java:3: package com.sap.aii.mapping.api does not exist
import com.sap.aii.mapping.api.StreamTransformationConstants;
^
PayloadToXMLField.java:8: cannot resolve symbol
symbol : class StreamTransformation
location: class PayloadToXMLField
public class PayloadToXMLField implements StreamTransformation {
^
PayloadToXMLField.java:16: cannot resolve symbol
symbol : class AbstractTrace
location: class PayloadToXMLField
AbstractTrace trace;
^
PayloadToXMLField.java:27: cannot resolve symbol
symbol : class AbstractTrace
location: class PayloadToXMLField
(AbstractTrace) param.get(
^
PayloadToXMLField.java:28: cannot resolve symbol
symbol : variable StreamTransformationConstants
location: class PayloadToXMLField
StreamTransformationConstants.MAPPING_TRACE);
^
PayloadToXMLField.java:43: cannot resolve symbol
symbol : variable outputPayload
location: class PayloadToXMLField
outputPayload =
^
PayloadToXMLField.java:50: cannot resolve symbol
symbol : variable outputPayload
location: class PayloadToXMLField
out.write(outputPayload.getBytes());
^
9 errors
Thanks,
Brijesh Soni
Include the aai_map_api.jar file using PATH command. Better use NWDS for this. Much simpler job.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not yet answered,but will to try to put the question in better way...
Thanks all.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
what i have to give in class path.
C:\j2sdk1.4.2_16-x64\bin>set CLASSPATH=%CLASSPATH%;aii_map_api.jar
is it the location where ;aii_map_api.jar file is?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanx praveen,
path of tht jar file in my system is K:\usr\sap\SXD\DVEBMGS00\j2ee\cluster\server0\apps\sap.com\com.sap.xi.services\aii_map_api.jar
so hw should i give the path,
C:\j2sdk1.4.2_16-x64\bin> set CLASSPATH=%K:\usr\sap\SXD\DVEBMGS00\j2ee\cluster\server0\apps\sap.com\com.sap.xi.services%;aii_map_api.jar
is it correct?
thanks , it is done now..
the program is compiled properly and class file is generated.
but m gettin error in mapping.
in IR i created two message type with data type as string.
and i had imported the class file and java program using Imported archives.
now in interface mapping mapping program i had selected type as Java Class.and name of java program.
but when i tested it, it is giving error as Linkage error occurred when loading class zip/PayloadToXMLField
Please suggest, M i doing some thing wrong?is any thing missing?
Program tht i had used in java
from link (https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field):
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.AbstractTrace;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import java.util.Map;
import java.io.*;
public class PayloadToXMLField implements StreamTransformation {
String strXML = new String();
String outputPayload = new String();
//Declare the XML tag for your XML message
String StartXMLTag = "<Payload>";
String EndXMLTag = "</Payload>";
AbstractTrace trace;
private Map param = null;
public void setParameter(Map param) {
this.param = param;
}
public void execute(InputStream in, OutputStream out) {
trace =
(AbstractTrace) param.get(
StreamTransformationConstants.MAPPING_TRACE);
trace.addInfo("Process Started");
try {
StringBuffer strbuffer = new StringBuffer();
byte[] b = new byte[4096];
for (int n;(n = in.read(b)) != -1;) {
strbuffer.append(new String(b, 0, n));
}
strXML = strbuffer.toString();
} catch (Exception e) {
System.out.println("Exception Occurred");
}
outputPayload =
"<?xml version="1.0" encoding="UTF-8"?>"
+ StartXMLTag
+ strXML
+ EndXMLTag;
try {
out.write(outputPayload.getBytes());
trace.addInfo("Process Completed");;
} catch (Exception e) {
trace.addInfo("Process Terminated: Error in writing out payload");;
}
}
}
and detailed trace of error is:
11:34:21 Start of test
LinkageError at JavaMapping.load(): Could not load class: zip/PayloadToXMLField
java.lang.NoClassDefFoundError: zip/PayloadToXMLField (wrong name: PayloadToXMLField) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.lang.ClassLoader.defineClass(ClassLoader.java:448) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.load(RepJavaMapping.java:136) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:50) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.transform(MapServiceRemoteObjectImpl0_0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
11:34:21 End of test
I don't see a problem in your code. The same code without any modification is working for me.
Is there any extra package statement in your code which you have not posted in thread like.
package zip;
If yes remove that line. Recompile & zip the class file and load again then test from Interface mapping.
Thanks,
- Gujjeti.
>
> No that is the exact code that i had created.
> I think there is some problem in setting class path, home path and path... i was tryin to search for that..
> is it working properly at ur side?
Yes for me it is working as expected.
Try creating the same program with different class name. Compile it then zip and reload the arhieve.
then use it in interface mapping and test...............
Thanks A lot....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in java mapping, you will have to use the jar aii_map_api.jar
To locate the jar, Go to your XI server folders and use this path, j2ee\cluster\server0\apps\sap.com\com.sap.xi.services. Inside com.sap.xi.services folder you'll find the jar file. Import the jar for your mapping.
Also as mentioned above, it always better to use NWDS for any XI related development.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Get the jar file aii_map_api.jar and copy it in your working directory(C:\j2sdk1.4.2_16-x64\bin)
now in dos prompt use the following command.
C:\j2sdk1.4.2_16-x64\bin>set CLASSPATH=%CLASSPATH%;aii_map_api.jar
now execute your java program.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.