cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in Excel to XML Conversion

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

anandvithal
Active Participant
0 Kudos

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

Former Member
0 Kudos

HI anand,

Thanks for your help it resolved some errors but still i m facing some errors.

Can u help on resolving these issues.

Thanks Mridul

jyothi_anagani
Active Contributor
0 Kudos

Hi Mridul,

As per your error, Please import the below class in your imports.

com.sap.aii.mapping.api.AbstractTransformation;

And When I see your thread that its an Adapter module then why are you using an AbstractTransformation?

Please follow the bellow blog to create an adapter module to read an excel file

http://www.saptechnical.com/Tutorials/XI/Adapter/Index.htm

Thanks

Jyothi A

Former Member
0 Kudos

Hi Jyothi,

Thanks for your valuable help. But I am struck at one point I imported all the jars in NWDS 7.3

Former Member
0 Kudos

Hi Jyothi,

Thanks for your help. But i am struck at one point I importd all Jars according to  NWDS 7.3 but for following classes I am not able to figure out which jar to use

Audit;

AuditDirection;

AuditMessageKey;


for AuditLogStatus;


i am using the below mentioned api

com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;


It would be really helpful if u can tell where to get these classes.

jyothi_anagani
Active Contributor
0 Kudos

Hi Mridul,

Have you imported these?

import com.sap.aii.af.mp.module.Module;
import com.sap.aii.af.mp.module.ModuleContext;
import com.sap.aii.af.mp.module.ModuleData;
import com.sap.aii.af.mp.module.ModuleException;
import com.sap.aii.af.ra.ms.api.Message;
import com.sap.aii.af.ra.ms.api.MessageDirection;
import com.sap.aii.af.ra.ms.api.XMLPayload;
import com.sap.aii.af.service.auditlog.Audit;
import com.sap.aii.af.service.auditlog.AuditDirection;
import com.sap.aii.af.service.auditlog.AuditLogStatus;
import com.sap.aii.af.service.auditlog.AuditMessageKey;

For more information please refer

XI libraries for development - Process Integration - SCN Wiki

Adapter Module Development

PI 7.0(3.0)
PI 7.1/7.3
aii_af_mp.jar
com.sap.aii.af.lib.mod.jar
aii_af_ms_api.jar
com.sap.aii.af.ms.ifc_api.jar
aii_af_trace.jar
sap.com~tc~logging~java~impl.jar
aii_af_svc.jar
com.sap.aii.af.svc_api.jar
aii_af_cpa.jar
com.sap.aii.af.cpa.svc.api.jar

Please let me know if you need more details.

Thanks

Jyothi A

Former Member
0 Kudos

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

Answers (8)

Answers (8)

Former Member
0 Kudos

Issue Resolved

Former Member
0 Kudos

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.

anandvithal
Active Participant
0 Kudos

Hi,

Please follow below guide on how to create custom adapter modules.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e674...

In this PDF, on page 13 you can set the JNDI name for your module.

Hope it helps,

Thanks,

Anand

Former Member
0 Kudos

Thanks Anand,

PDF shared by you was extremely helpful. Now I have successfully developed and deployed the adapter. But while using it in Communication Channel I am getting following error.

Error: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name localejbs/ExcelToXML, cannot resolve object reference. [Root exception is javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name: Type: clientAppName Content: sap.com/SAP_Exel_To_XMLEAR Type: interfaceType Content: local Type: ejb-link Content: Excel_To_XML Type: jndi-name Content: ExcelToXML Type: local-home Content: sap.com.excelToXML.Excel_To_XMLLocalHome Type: local Content: sap.com.excelToXML.Excel_To_XMLLocal com.sap.engine.services.ejb3.runtime.impl.refmatcher.EJBResolvingException: Cannot start applicationsap.com/SAP_Exel_To_XMLEAR; nested exception is: java.rmi.RemoteException: [ERROR CODE DPL.DS.6125] Error occurred while starting application locally and wait.; nested exception is: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: [ERROR CODE DPL.DS.5029] Exception in operation [startApp] with application [sap.com/SAP_Exel_To_XMLEAR]. at com.sap.engine.services.ejb3.runtime.impl.DefaultContainerRepository.startApp(DefaultContainerRepository.java:398) at com.sap.engine.services.ejb3.runtime.impl.DefaultContainerRepository.getEnterpriseBeanContainer(DefaultContainerRepository.java:182) at com.sap.engine.services.ejb3.runtime.impl.DefaultRemoteObjectFactory.resolveReference(DefaultRemoteObjectFactory.java:55) at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:144) at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:63) at com.sap.engine.system.naming.provider.ObjectFactoryBuilderImpl._getObjectInstance(ObjectFactoryBuilderImpl.java:76) at com.sap.engine.system.naming.provider.ObjectFactoryBuilderImpl.access$100(ObjectFactoryBuilderImpl.java:33) at com.sap.engine.system.naming.provider.ObjectFactoryBuilderImpl$DispatchObjectFactory.getObjectInstance(ObjectFactoryBuilderImpl.java:226) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:283) at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:434) at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:223) at com.sap.engine.services.jndi.implclient.OffsetClientContext.lookup(OffsetClientContext.java:242) at javax.naming.InitialContext.lookup(InitialContext.java:351) at javax.naming.InitialContext.lookup(InitialContext.java:351) at com.sap.aii.af.lib.util.ejb.FastEjbFactory.createEjbInstance(FastEjbFactory.java:69) at com.sap.aii.af.lib.util.ejb.FastEjbFactory.createEjbInstance(FastEjbFactory.java:50) at com.sap.aii.af.app.mp.ejb.ModuleProcessorBean.getModuleLocal(ModuleProcessorBean.java:419) at com.sap.aii.af.app.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:287) at sun.reflect.GeneratedMethodAccessor946.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 com.sun.proxy.$Proxy3299.process(Unknown Source) at com.sap.aii.adapter.file.File2XI.send(File2XI.java:3605) at com.sap.aii.adapter.file.File2XI.processFileList(File2XI.java:1374) at com.sap.aii.adapter.file.File2XI.invoke(File2XI.java:669) at com.sap.aii.af.lib.scheduler.JobBroker$Worker.run(JobBroker.java:534) 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:182) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:280) ]

pl

please help

anandvithal
Active Participant
0 Kudos

Hi,

After checking the error message, it seems to me that channel is not able to find the deployed module.

What ever you have mentioned in the JNDI name in EJB deployment xml descriptor, provide the same(don't prefix anything) in the channel module tab after deploying it.

And also,Double check if the deployment of the EAR was successful by connecting your NWDS to PI Java AS and in the deploy view of NWDS select the PI system and check for the module deployed. It should be green and started.

Thanks,

Anand

Former Member
0 Kudos

Thanks Anand Issue is resolved by your advice.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

HI Jyothi,

Can u please help in getting this JAR file.

Thanks

Mridul

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Jyothi

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

Thanks

Mridul Manchanda

Former Member
0 Kudos

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

jyothi_anagani
Active Contributor
0 Kudos

Hi,

You can find in

usr/sap/<SID>/DVEBMGS<nr>/j2ee/cluster/bin/ ->

where your PI server is installed.

Please let me know if you couldnt able to find it there.

Thanks

Jyothi A