on 02-16-2007 12:41 PM
Hi all,
Im testing JavaMapping using the code from this blog: /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
Ive created two data types (DT_row and MRI_ABSTRACT) and the corresponding Message Interfaces structured as in the example. And Ive created jar file MMapping.jar with the code in the weblog and imported into XI. Now Im testing the mapping program in the interface mapping test tab and Im getting the following error:
======================================================
13:37:37 Start of test
Creating Java mapping com/guarneri/xi/javamap/MRIGenToHierMap
Loaded class com.guarneri.xi.javamap.MRIGenToHierMap
java.lang.IllegalAccessExceptionat JavaMapping.instantiate(): Could not instantiate class: com/guarneri/xi/javamap/MRIGenToHierMapClass com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping can not access a member of class com.guarneri.xi.javamap.MRIGenToHierMap with modifiers ""
13:37:38 End of test
======================================================
I think the problem is something related to classpath or similar, but I cant find the solution.
Can anybody help me?
That drove me almost crazy:
Here:
//Specify the Hirearchial Structure
class MRIGenToHierMap implements StreamTransformation
{
This must be PUBLIC
<b>public class MRIGenToHierMap implements StreamTransformation</b>
Change your code according to this, that should work.
Have a nice week end
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
deleted
Message was edited by:
Stefan Grube
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've changed the method as follows:
public void execute(InputStream in, OutputStream out) throws com.sap.aii.mapping.api.StreamTransformationException
{
//MRIGenToHierMap rel = new MRIGenToHierMap();
//MRIGenToHierMap rel = this;
//rel.buildXsd();
this.buildXsd();
new GenToHierMap(in,out,this.v,"MRI_ABSTRACT","urn:horzon:MRI");
}
but the problem persists....
Hi,
just replace
new GenToHierMap(in,out,this.v,"MRI_ABSTRACT","urn:horzon:MRI");
with
new GenToHierMap(in,out,this.v,"MRI_ABSTRACT",<x>);
Where <x> is your target namespace means the namespace in which you have defined your scenario in IR........Change code in NWDS.......Test it....the output should come with your namespace in NWDS......generate its jar.....import in archive.........edit interface mapping......reslect the java class.......save mapping and activate it.....then test the mapping..........
Thanks,
Rajeev Gupta
For testing the java mapping standalone main method is used. For runtime this is not req in all the java files. Test it by removing the main method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I've commented the main method, export the jar file and imported into XI. What I see in my Imported Archives is:
Name......................................... Path
GenToHierMap.class....................(nothing)
GenToHierMap.java......................(nothing)
MRIGenToHierMap.class..............(nothing)
MRIGenToHierMap.java................(nothing)
Relation.class.............................(nothing)
Relation.java...............................(nothing)
default.txvpck..............................MMaping/
But the test fails again.
I have the file in this location: aii_map_api.jar
/usr/sap/XID/DVEBMGS90/j2ee/cluster/server0/apps/sap.com/com.sap.xi.services
Best Regards,
Roger Allué Vall
Hi,
just now open a new Java prj..........create a package in it.....in this package add all your 3 java files......compile it...........
create jar file....open in winzip except following:
GenToHierMap.class
GenToHierMap.java
MRIGenToHierMap.class)
MRIGenToHierMap.java
Relation.class
Relation.java
delete any other file from it.
import in archive in XI......see the package path will come in path instead of nothing....activate archive........
then test interface mapping .........
Thanks,
Rajeev Gupta
Ok, I've created a new project JavaMapping, I've created the package javaMapping and included my 3 java files on it. I've compiled and exported to a jar file. Then I imported it into XI as and Imported Archive:
GenToHierMap.class javaMapping/
GenToHierMap.java javaMapping/
MRIGenToHierMap.class javaMapping/
MRIGenToHierMap.java javaMapping/
Relation.class javaMapping/
but the test stills giving:
15:55:23 Start of test
Creating Java mapping javaMapping/MRIGenToHierMap
Loaded class javaMapping.MRIGenToHierMap
java.lang.IllegalAccessExceptionat JavaMapping.instantiate(): Could not instantiate class: javaMapping/MRIGenToHierMapClass com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping can not access a member of class javaMapping.MRIGenToHierMap with modifiers ""
15:55:23 End of test
Best Regards.
Hi,
just to check again........put the main function in MRIGenToHierMap.java file in NWDS JAVA PRJ..............test this java file.......with the input XML of blog...Does output of blog comes.........
have you activated your imported archive again....
while testing mapping, are you giving the same source XML file of blog or not...
Can you also tell what data you have specified in your interface mapping...
Thanks,
Rajeev Gupta
Message was edited by:
RAJEEV GUPTA
I've included all the classes in the package: com.sap.javaMapping. I've uncommented the main method and I've executed the function in NWDS again with the same xml file that I use in the test. It worked fine.
All my objects in XI are active in every test I make and every time I import a new jar. I have this files as External JARs in NWDS:
C:aii_map_api.jar
C:aii_util_xml.jar
In my interface mapping I've defined the following:
Source Interface: MI_row_outbound
Target Interface: MI_MRI_ABSTRACT_inbound
Mapping Program: Java Class --> com/sap/javaMapping/MRIGenToHierMap --> javaMapping
Regards,
Roger allué Vall
<?xml version="1.0" encoding="UTF-8" ?>
<ns3:DT_row xmlns:ns3="http://gencat.cat/ics/compresLogistica">
<recordset>
<DATA>
<ROW>"A00"#!1#!2#!3#!4#!5#!6</ROW>
<ROW>"U06"#!1#!2#!3#!4#!5#!6#!7</ROW>
<ROW>"K15"#!1#!2#!3#!4</ROW>
<ROW>"N90"#!1#!2#!3#!4#!5#!6#!8#!9#!10#!11#!12#!13#!14#!15#!16#!17</ROW>
<ROW>"K15"#!1#!2#!3#!4#!5</ROW>
</DATA>
</recordset>
</ns3:DT_row>
I'm able to test the mapping from NWDS using this input xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<ns3:DT_row xmlns:ns3="http://gencat.cat/ics/compresLogistica">
<recordset>
<DATA>
<ROW>"A00"#!1#!2#!3#!4#!5#!6</ROW>
<ROW>"U06"#!1#!2#!3#!4#!5#!6#!7</ROW>
<ROW>"K15"#!1#!2#!3#!4</ROW>
<ROW>"N90"#!1#!2#!3#!4#!5#!6#!8#!9#!10#!11#!12#!13#!14#!15#!16#!17</ROW>
<ROW>"K15"#!1#!2#!3#!4#!5</ROW>
</DATA>
</recordset>
</ns3:DT_row>
Bet Regards,
i fear it might have some issue...just try a comma separator and execute the program....might u need to change the code. we can figure out if this is causing the issue
<?xml version="1.0" encoding="UTF-8" ?>
<ns3:DT_row xmlns:ns3="http://gencat.cat/ics/compresLogistica">
<recordset>
<DATA>
<ROW>"A00",1,2,3,4,5,6</ROW>
<ROW>"U06",1,2,3,4,5,6,7</ROW>
<ROW>"K15",1,2,3,4</ROW>
<ROW>"N90",1,2,3,4,5,6,8,9,10,11,12,13,14,15,16,17</ROW>
<ROW>"K15",1,2,3,4,5</ROW>
</DATA>
</recordset>
</ns3:DT_row>
Hi,
Have you put all the 3 java files in your .jar file....... Have you activated your imported archives java mapping..........
Thanks,
Rajeev Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've imported aii_map_api.jar and aii_util_xml.jar to the project as External JARs. The exported jar file (MMapping.jar) do not contain neither aii_map_api.jar nor aii_util_xml.jar. Do I have to include them in my jar? I think I read something in a post that this is not necessary because the jar files aii_map_api.jar and aii_util_xml.jar are in the server.
All my modifications in XI are activated.
Thanks in advance.
Roger Allué Vall
Hi,
just to check - in your java prj where you created these 3 java files and compiled them, then on giving an input to MRIGenToHierMap class by executing its main function and giving the source XML file as in the blog - does the target XML as in the blog was output.
when you imported your .jar file in imported archives, can you see the name of all the 3 java files and their classes in imported archive.
If both of the above things are there, then in interface mapping, the JAVA prg you have said is MRIGenToHierMap or not.
If all of the above things are there, then giving the sourc XML file of blog in test of interface mapping, you should get the target XML of blog.
Thanks,
Rajeev Gupta
when u create a mapping program in the editor u whud shud have imported these jar files(aii_map_api.jar etc). once u are finished with the mapping all u need is to create a jar file with all the three files(as in blog) specified in the same location,
<b>Ok, so as I understand I need aii_map_api.jar, aii_util_xml.jar and which is the other one?</b>
You find these files in the file system of the J2EE engine, where your XI is running (see note 636447). not req to again have this is the jar file which u will be creating and exporting into the IR
Hi,
so in NWDS it works fine.......good
now how are you creating the jar file.....select your java project..go to file -> export .....choose jar file..choose the options of export sourc files and generated classes..create your jar file with all the 3 source files and their classes......
now import this jar file in XI.........can you see all the 3 java files and its classes in the imported archive...........
now test your Interface Mapping........
Thanks,
Rajeev Gupta
Message was edited by:
RAJEEV GUPTA
Ok,
I've recreated the project, included the files in my jar file and imported it into XI. What I see in Imported Archive is this:
Name......................................... Path
GenToHierMap.class....................(nothing)
GenToHierMap.java......................(nothing)
MRIGenToHierMap.class..............(nothing)
MRIGenToHierMap.java................(nothing)
Relation.class.............................(nothing)
Relation.java...............................(nothing)
.classpath..................................(nothing)
.project......................................(nothing)
aii_map_api.jar...........................(nothing)
aii_util_xml.jar............................(nothing)
And I'm still getting:
14:40:38 Start of test
Creating Java mapping MRIGenToHierMap
Loaded class MRIGenToHierMap
java.lang.IllegalAccessExceptionat JavaMapping.instantiate(): Could not instantiate class: MRIGenToHierMapClass com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping can not access a member of class MRIGenToHierMap with modifiers ""
14:40:39 End of test
Best regards,
Roger Allué Vall
So, what I have to Include in my jar file? Only my classes and if I want java files? That's what I had at the beginning of the post. An this is not working properly.
Now I have a jar file MMApping.jar that contains the following files:
META-INF
MRIGenToHierMap.class
MRIGenToHierMap.java
GenToHierMap.class
GenToHierMap.java
Relation.class
Relation.java
But the error persists.
Any idea?
Best regards,
Roger Allué Vall
Hi Prabhu S,
Yes I have the following as you can see in the weblog:
public void execute(InputStream in, OutputStream out) throws com.sap.aii.mapping.api.StreamTransformationException
{
MRIGenToHierMap rel = new MRIGenToHierMap();
rel.buildXsd();
new GenToHierMap(in,out,rel.v,"MRI_ABSTRACT","urn:horzon:MRI");
}
public static void main (String[] args) throws Exception
{
try
{
MRIGenToHierMap rel = new MRIGenToHierMap();
FileInputStream in = new FileInputStream ("C:/MMApping/DOM_IN.xml");
FileOutputStream out = new FileOutputStream ("C:/MMApping/DOM_OUT.xml");
rel.buildXsd();
new GenToHierMap(in,out,rel.v,"MRI_ABSTRACT","urn:horzon:MRI");
}catch(Exception e) {e.printStackTrace();}
}
}
Best Regards,
remove
public static void main (String[] args) throws Exception
{
try
{
MRIGenToHierMap rel = new MRIGenToHierMap();
FileInputStream in = new FileInputStream ("C:/MMApping/DOM_IN.xml");
FileOutputStream out = new FileOutputStream ("C:/MMApping/DOM_OUT.xml");
rel.buildXsd();
new GenToHierMap(in,out,rel.v,"MRI_ABSTRACT","urn:horzon:MRI");
}catch(Exception e) {e.printStackTrace();}
}
> What I see in Imported Archive is this:
>
> Name......................................... Path
> GenToHierMap.class....................(nothing)
> GenToHierMap.java......................(nothing)
> MRIGenToHierMap.class..............(nothing)
> MRIGenToHierMap.java................(nothing)
> Relation.class.............................(nothing)
> Relation.java...............................(nothing)
>
> .classpath..................................(nothing)
>
> .project......................................(nothing
> )
> aii_map_api.jar...........................(nothing)
> aii_util_xml.jar............................(nothing)
Why is path nothing? It must be the package path like com\sap\sample
Do not add the aii_map_api.jar and aii_util_xml.jar. You cannot add a jar into another jar, this wouldn't work.
Regards
Stefan
when u created the java maaping program did u have the .JAR file imported for java mapping>?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
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.