on 05-29-2008 9:36 AM
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
Hi
Are you implementing these two interfaces?
javax.ejb.SessionBean &
com.sap.aii.af.mp.module.Module
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
Check the EAR file, if there are any additional libraries inside.
If so, delete them before deploying.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
> 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
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
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
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
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>
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
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
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.