Skip to Content
author's profile photo Former Member
Former Member

Issue in Excel to XML Conversion

Hi Gurus,

I am creating a custom java module in sap nwds 7.3 for Excel to XML Conversion. But I am getting following error

Classpath dependency validator message.

Classpath entry will not be exported or published. Runtime ClassNotFoundExceptions may result.


I imported the Jars from a different PI system and i am using NWDS in local PC with creating a separate folder with all JARs and also imported them using build path option.

This issue is occuring for all the jars imported.

I am using following code.

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.InputStream;

import java.io.OutputStream;

import java.util.Map;

import com.sap.aii.mapping.api.StreamTransformation;

import com.sap.aii.mapping.api.AbstractTrace;

import java.util.HashMap;

import jxl.Cell;

import jxl.Workbook;

public class JavaMappingExcelToXML implements StreamTransformation{

private Map map = null;

private AbstractTrace trace = null;

public void setParameter(Map arg0) {

map = arg0; // Store reference to the mapping parameters

if (map == null) {

this.map = new HashMap();

}

}

/*

public static void main(String args[]) { //FOR EXTERNAL STANDALONE TESTING

try {

FileInputStream fin = new FileInputStream ("c:/ashu.xls"); //INPUT FILE (PAYLOAD)

FileOutputStream fout = new FileOutputStream ("C:/Users/ashutosh.a.upadhyay/My Documents/ashuXML2.xml"); //OUTPUT FILE (PAYLOAD)

JavaMappingXLStoXML mapping = new JavaMappingXLStoXML ();

mapping.execute(fin, fout);

}

catch (Exception e1) {

e1.printStackTrace();

}

}*/

public void execute(InputStream inputstream, OutputStream outputstream) {

String msgType = "Message Type name will come here";

String nameSpace = "Namespace Name will come here";

String xmldata = "";

try {

Workbook wb = Workbook.getWorkbook(inputstream);

xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ "<ns0:"+msgType+" "+"xmlns:ns0=\""+nameSpace+"\n">";

Cell[] cells ;

Cell[] cellNames ;

cellNames = wb.getSheet(0).getRow(0);

for(int j=1;j<wb.getSheet(0).getRows();j++){

xmldata = xmldata+"\n<Record>\n";

cells = wb.getSheet(0).getRow(j);

for(int i=0;i<wb.getSheet(0).getColumns();i++){

xmldata = xmldata+"\t<"+cellNames[i].getContents()+">"+cells[i].getContents()+"</"+cellNames[i].getContents()+">\n";

}

xmldata = xmldata+"</Record>";

}

xmldata = xmldata+"\n</ns0:"+msgType+">";

System.out.print(xmldata);

xmldata.getBytes();

wb.close();

byte by[] = xmldata.getBytes();

outputstream.write(by);

inputstream.close();

outputstream.close();

System.out.println("\n"+"File processed");

}

catch (Exception e) {

e.printStackTrace();

}

}

}

Request you to guide how to resolve this issue.

Thanks in advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    Posted on Sep 16, 2014 at 06:41 AM

    Hi,

    If you have NWDS 7.3 then try this

    In the build path screen of the ejb project click add library

    select XPI library

    Select XPI adapter library

    apart from the standard jars if you have any other jars, add them manually.

    Thanks,

    Anand


    Untitled-1.png (107.5 kB)
    Untitled.png (20.3 kB)
    Untitled1.png (24.8 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Jyothi Anagani

      Hi Jyothi,

      I have imported all these except these two classes

      import com.sap.aii.af.service.auditlog.Audit;

      import com.sap.aii.af.service.auditlog.AuditDirection;


      as the following jar is unavailable in my setup. com.sap.aii.af.service.auditlog

      Thanks

      Mridul Manchanda

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2014 at 10:47 AM

    Hi gurus,

    I am not finding following package

    com.sap.aii.af.service.auditlog with class Audit and Audit Direction in my PI 7.3 setup. Can u please guide where i can find these 2 classes.

    Thanks in advance

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2014 at 12:03 PM

    Hi Jyothi

    I checked at the location mentioned in all the folders but could not find the respective Jar file.

    Thanks

    Mridul Manchanda

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 23, 2014 at 12:06 PM

    Hi Jyothi,

    Also to inform You I am having one portable version of NWDS 7.3 which i downloaded from this location

    https://nwds.sap.com/swdc/downloads/updates/netweaver/nwds/nw/730/doc/auto_latest_distributions.html

    It contains a plugin folder which also doesnot contain the Jar file with the classes Audit and Audit Direction.

    Thanks

    Mridul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 26, 2014 at 08:57 AM

    HI Jyothi,

    Can u please help in getting this JAR file.

    Thanks

    Mridul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 01, 2014 at 01:09 PM

    Hi gurus can i use

    com.sap.engine.interfaces.messaging.api.auditlog.AuditAccess following class instead of

    • com.sap.aii.af.service.auditlog.Audit

    as the audit class is unavailable

    Thanks in advance

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 06, 2014 at 12:08 PM

    Hi

    after using Audit Access I am getting following error.

    Cannot make a static reference to the non-static method addAuditLogEntry(MessageKey, AuditLogStatus, String)

    from the type AuditAccess

    this error i am getting everywhere where addAuditLog Entry is getting used.

    Request you to put some light on this issue.

    Thanks

    Mridul

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 31, 2014 at 06:48 AM

    Hi Gurus ,

    Issue has been resolved by using Audit Access class insted of audit and declaring Audit Access locally.

    Now We are facing two issues.

    1. Build folder is empty

    2. Where to give JNDI name. In JNDI we are not getting any option of mentioning JNDI name.

    Thanks in advance for Help.


    Capture.PNG (5.6 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2014 at 11:50 AM

    Issue Resolved

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.