cancel
Showing results for 
Search instead for 
Did you mean: 

Adapter Module Development -- Getting FileName

Former Member
0 Kudos

Hi All,

I have following problem faced in Adapter Module Development.

My Deployment shows perfect but when used it throws following error:

Error: java.lang.ClassCastException: class com.sap.zfilename.Zsrinifilename_finalLocalHomeImpl0_0 can not be casted to ModuleLocalHome or SModuleLocalHome

Attempt to process file failed with java.lang.ClassCastException: class com.sap.zfilename.Zsrinifilename_finalLocalHomeImpl0_0 can not be casted to ModuleLocalHome or SModuleLocalHome

Following has been done:

ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"

"http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>

<description>EJB JAR description</description>

<display-name>EJB JAR</display-name>

<enterprise-beans>

<session>

<ejb-name>Zsrinifilename_finalBean</ejb-name>

<home>com.sap.aii.af.mp.module.ModuleHome</home>

<remote>com.sap.aii.af.mp.module.ModuleRemote</remote>

<local-home>com.sap.aii.af.mp.module.ModuleLocalHome</local-home>

<local>com.sap.aii.af.mp.module.ModuleLocal</local>

<ejb-class>com.sap.zfilename.Zsrinifilename_finalBean</ejb-class>

<session-type>Stateless</session-type>

<transaction-type>Container</transaction-type>

</session>

</enterprise-beans>

</ejb-jar>

ejb-j2ee-engine.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">

<ejb-j2ee-engine>

<enterprise-beans>

<enterprise-bean>

<ejb-name>Zsrinifilename_finalBean</ejb-name>

<jndi-name>Zsrinifilename_finalBean</jndi-name>

<session-props/>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

In Enterprise Application Project

application-j2ee-engine.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">

<application-j2ee-engine>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="library">com.sap.aii.af.lib</reference-target>

</reference>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="library">com.sap.xi.util.misc</reference-target>

</reference>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="service">com.sap.aii.adapter.xi.svc</reference-target>

</reference>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="service">com.sap.aii.af.svc</reference-target>

</reference>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="service">com.sap.aii.af.cpa.svc</reference-target>

</reference>

<reference

reference-type="weak">

<reference-target

provider-name="sap.com"

target-type="library">com.sap.xi.util.xml</reference-target>

</reference>

<provider-name>sap.com</provider-name>

<fail-over-enable

mode="disable"/>

</application-j2ee-engine>

Went to the Visual Admin and checked Ejb is active and changed the jndi name as mentioned above also.

Wat could be the problem now still ??

kindly advice

thx in advance

srini

Accepted Solutions (1)

Accepted Solutions (1)

former_member190389
Active Contributor
0 Kudos

Hi

Are you implementing these two interfaces?

javax.ejb.SessionBean &

com.sap.aii.af.mp.module.Module

Former Member
0 Kudos

hi,

yes am using two interfaces kindly check below

public class Zsrinifilename_finalBean implements SessionBean,Module {

I guess i should check if .ear file has some library files , but i donno how to check those things

rest things i had a check seems to be fine.

thx in advance for help

srini

Former Member
0 Kudos

if i see in the CC Monitoring in RWB

Error: org.xml.sax.SAXParseException: Document root element is missing.

What could be the cause

Srini

stefan_grube
Active Contributor
0 Kudos

Did you put your module in the module chain before the SAP module?

Maybe you post your code, to see if there is an issue inside.

Regards

Stefan

Former Member
0 Kudos

Code

package com.sap.zfilename;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

import javax.ejb.CreateException;

// Classes for Module development & Trace

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.service.trace.Trace;

import java.util.Hashtable;

// XML parsing and transformation classes

import javax.xml.parsers.*;

import org.w3c.dom.*;

import java.io.InputStream;

import java.io.ByteArrayOutputStream;

import com.sap.aii.af.ra.ms.api.XMLPayload;

import javax.xml.transform.*;

import javax.xml.transform.Source;

import javax.xml.transform.Result;

import javax.xml.transform.dom.DOMSource;

import javax.xml.transform.stream.StreamResult;

/**

  • @ejbHome <{com.sap.zfilename.Zsrinifilename_finalHome}>

  • @ejbLocal <{com.sap.zfilename.Zsrinifilename_finalLocal}>

  • @ejbLocalHome <{com.sap.zfilename.Zsrinifilename_finalLocalHome}>

  • @ejbRemote <{com.sap.zfilename.Zsrinifilename_final}>

  • @stateless

  • @transactionType Container

*/

public class Zsrinifilename_finalBean implements SessionBean,Module {

public static final String VERSION_ID = "$Id:// tc/aii/30_REL/src/_adapters/_sample/java/com/sap/aii/af/sample/module/GetFileNameBean.java#1 $";

private static final Trace TRACE = new Trace(VERSION_ID);

public void ejbRemove() {

}

public void ejbActivate() {

}

public void ejbPassivate() {

}

public void setSessionContext(SessionContext context) {

myContext = context;

}

private SessionContext myContext;

/**

  • Create Method.

*/

public void ejbCreate() throws CreateException {

// TODO : Implement

}

/* (non-Javadoc)

  • @see com.sap.aii.af.mp.module.Module#process(com.sap.aii.af.mp.module.ModuleContext, com.sap.aii.af.mp.module.ModuleData)

*/

public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {

// TODO Auto-generated method stub

Object obj = null;

Message msg = null;

String fileName = null;

try {

obj = inputModuleData.getPrincipalData();

msg = (Message) obj;

Hashtable mp = (Hashtable)

inputModuleData.getSupplementalData("module.parameters");

if (mp != null) fileName = (String)

mp.get("FileName");

} catch (Exception e) {

ModuleException me = new ModuleException(e);

throw me;

}

try{

XMLPayload xmlpayload = msg.getDocument();

DocumentBuilderFactory factory;

factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder =

factory.newDocumentBuilder();

Document document = builder.parse((InputStream)

xmlpayload.getInputStream());

Element rootNode =

document.getDocumentElement();

if(rootNode != null){

Element childElement =

document.createElement("FileName");

childElement.appendChild(document.createTextNode(fileName));

rootNode.appendChild(childElement);

}

// Transforming the DOM object to Stream object.

TransformerFactory tfactory =

TransformerFactory.newInstance();

Transformer transformer =

tfactory.newTransformer();

Source src = new DOMSource(document);

ByteArrayOutputStream myBytes = new

ByteArrayOutputStream();

Result dest = new StreamResult(myBytes);

transformer.transform(src,dest);

byte[] docContent = myBytes.toByteArray();

if(docContent != null){

xmlpayload.setContent(docContent);

inputModuleData.setPrincipalData(msg);

}

} catch (Exception e) {

ModuleException me = new ModuleException(e);

throw me;

}

return inputModuleData;

}

}

S i have configured in the Adapter Module (FileSender) Above the normal module with the name

localejbs/JNDIName

Kindly revert back if anything to be changed

With regards

Srinivas

stefan_grube
Active Contributor
0 Kudos

Change this:

if (mp != null) 
    fileName = (String) mp.get("FileName");

to

if (mp != null)
    fileName = (String) mp.get("FileName");
else 
    fileName = "default";

As you have use the code from teched session is template, you should enhance the code for audit log entries to see, what happens on runtime.

Regards

Stefan

stefan_grube
Active Contributor
0 Kudos

What do you want to achieve with this part of code?

Hashtable mp = (Hashtable)
inputModuleData.getSupplementalData("module.parameters");
if (mp != null) fileName = (String)
mp.get("FileName");

stefan_grube
Active Contributor
0 Kudos

Better change this:

String fileName = null;

to

String fileName = "default";

Former Member
0 Kudos

Hi inside : XsriniFile_FinalProj.ear

I have following files :

Manifest.mf

Sap_manifest.mf

sda-dd.xml

aii_adapter_xi_svc.jar

aii_af_cci.jar

aii_af_cpa.jar

aii_af_mp.jar

aii_af_ms_api.jar

aii_af_ms_spi.jar

aii_af_trace.jar

aii_util_misc.jar

aii_util_xml.jar

ejb20.jar

exception.jarapplication-j2ee-engine.xml

application.xml

XFileName_final.jar

I was said to delete extra librarf files and then deploy , what all the file should i delete and deploy.I deleted hilighted one and tried to deploy but it thows error as follows:

May 30, 2008 11:09:26 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:

[006]Deployment aborted

Settings

SDM host : pixxxxxx

SDM port : 5xxxxx

URL to deploy : file:/C:/DOCUME1/9000031/LOCALS1/Temp/temp44936XsriniFile_FinalProj.ear

Result

=> deployment aborted : file:/C:/DOCUME1/9000031/LOCALS1/Temp/temp44936XsriniFile_FinalProj.ear

Aborted: development component 'XsriniFile_FinalProj'/'sap.com'/'localhost'/'2008.05.30.11.07.57'/'1':

Caught exception during application deployment from SAP J2EE Engine's deploy service:

java.rmi.RemoteException: Cannot deploy application sap.com/XsriniFile_FinalProj.. Reason: Exception during generation of components of application sap.com/XsriniFile_FinalProj in container EJBContainer.; nested exception is: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/XsriniFile_FinalProj in container EJBContainer.

(message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)

Deployment exception : The deployment of at least one item aborted

Kindly advice which .jar files should i , delete and deploy.

Advice needed

Srini

Answers (1)

Answers (1)

stefan_grube
Active Contributor
0 Kudos

Check the EAR file, if there are any additional libraries inside.

If so, delete them before deploying.

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

I am new to this adapter module development and ejb stuffs..

am using NWDS , kindly step me out om which i should click and check if i have any additinal library files.

kindly step me out..Should i right click "Enterprise Application Project" and check properties.

where should i ??

plz reply back urgent

srini

Former Member
0 Kudos

How to see additinal library files present in the EAR ??

i saw some saying kindly use winzip how ?? please advice me how to do this ??

am new to this..am using NWDS ??

any replies on this ?

thxs

srini

stefan_grube
Active Contributor
0 Kudos

> How to see additinal library files present in the EAR ??

>

> i saw some saying kindly use winzip how ?? please advice me how to do this ??

Yes, use Winzip. Java libraries (jar, ear, war, rar, sda, sca) can be extracted be WinZip.

You can delete the additional jars with WinZip also.

You can assossiate ear with winzip once, then you can do this directly from NWDS.

Regards

Stefan

Edited by: Stefan Grube on May 29, 2008 12:59 PM

Former Member
0 Kudos

Hi stefan,

lemme know how to do this using NWDS,

i right click on .ear and say open it doesnot show up anything , i went and searched for .ear file in the local owrkspace but couls not find...

am in a lag ... now i can see .ear in my NWDS , from now how to proceed , to see if there any additinal libraries and delete them if any present,

Advice

thx

srini

stefan_grube
Active Contributor
0 Kudos

Check, where your EAR file is stored in the file system. You can see this in properties.

Go to the file system and open it with winzip and check "alwasy open with". Then you can open it from NWDS directl with winzip.

it should be in <workspace>/<EARproject>

Regards

Stefan

Edited by: Stefan Grube on May 29, 2008 1:19 PM

Former Member
0 Kudos

Hi Stefen,

u said to delete additional libraries from .ear , what are those ??? i have listed all the files in my .ear file in the below threads , kindly reply back to that , am facing a problem

With regards

Srini

stefan_grube
Active Contributor
0 Kudos

Delete all jar files besides XFileName_final.jar, but no other file.

Stefan

Former Member
0 Kudos

hi

No i have only these files in my .jar file

rest i deleted but when i deployed i got below error

Manifest.mf

Sap_manifest.mf

sda-dd.xml

application-j2ee-engine.xml

application.xml

XFileName_final.jar

Error

May 30, 2008 5:30:37 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:

[010]Deployment aborted

Settings

SDM host : pixxxx

SDM port : 5xxxxx

URL to deploy : file:/C:/DOCUME1/9000031/LOCALS1/Temp/temp44940XsriniFile_FinalProj.ear

Result

=> deployment aborted : file:/C:/DOCUME1/9000031/LOCALS1/Temp/temp44940XsriniFile_FinalProj.ear

Aborted: development component 'XsriniFile_FinalProj'/'sap.com'/'localhost'/'2008.05.30.13.12.17'/'0':

Caught exception during application deployment from SAP J2EE Engine's deploy service:

java.rmi.RemoteException: Cannot deploy application sap.com/XsriniFile_FinalProj.. Reason: Exception during generation of components of application sap.com/XsriniFile_FinalProj in container EJBContainer.; nested exception is: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/XsriniFile_FinalProj in container EJBContainer.

(message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)

Deployment exception : The deployment of at least one item aborted

Regards

Srini

stefan_grube
Active Contributor
0 Kudos

Replace your application-j2ee-engine.xml with this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
<application-j2ee-engine>
	<reference 
		reference-type="hard">
		<reference-target 
			provider-name="sap.com" 
			target-type="library">com.sap.aii.af.lib</reference-target>
	</reference>
	<reference 
		reference-type="hard">
		<reference-target 
			provider-name="sap.com" 
			target-type="service">com.sap.aii.adapter.xi.svc</reference-target>
	</reference>
	<reference 
		reference-type="hard">
		<reference-target 
			provider-name="sap.com" 
			target-type="service">com.sap.aii.af.svc</reference-target>
	</reference>
	<reference 
		reference-type="hard">
		<reference-target 
			provider-name="sap.com" 
			target-type="service">com.sap.aii.af.cpa.svc</reference-target>
	</reference>
	<fail-over-enable 
		mode="disable"/>
</application-j2ee-engine>

Former Member
0 Kudos

Still

May 30, 2008 6:08:11 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:

[012]Deployment aborted

Settings

SDM host : pixxxxx

SDM port : 5xxxxxx

URL to deploy : file:/C:/DOCUME1/9000031/LOCALS1/Temp/temp44942XsriniFile_FinalProj.ear

Result

=> deployment aborted : file:/C:/DOCUME1/9000031/LOCALS1/Temp/temp44942XsriniFile_FinalProj.ear

Aborted: development component 'XsriniFile_FinalProj'/'sap.com'/'localhost'/'2008.05.30.18.07.10'/'0':

Caught exception during application deployment from SAP J2EE Engine's deploy service:

java.rmi.RemoteException: Cannot deploy application sap.com/XsriniFile_FinalProj.. Reason: Exception during generation of components of application sap.com/XsriniFile_FinalProj in container EJBContainer.; nested exception is: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception during generation of components of application sap.com/XsriniFile_FinalProj in container EJBContainer.

(message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)

Deployment exception : The deployment of at least one item aborted