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

Error calling ejbRemove()

Hi there,

I always get following error while trying to delete a row from the datasource.

Thrown error:

[code]com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method removeStatus.

at com.dcx.mcg.itp.aa.projects.eeim.beans.DataObjectImpl0.removeStatus(DataObjectImpl0.java:2889)

at com.dcx.mcg.itp.aa.projects.eeim.beans.Data_Stub.removeStatus(Data_Stub.java:2207)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)

at $Proxy441.removeStatus(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)

at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)

at SoapServlet.doPost(SoapServlet.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

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:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: javax.ejb.EJBException: Exception in method com.dcx.mcg.itp.aa.projects.eeim.beans.StatusLocalHomeImpl0.remove(java.lang.Object).; nested exception is: com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method com.dcx.mcg.itp.aa.projects.eeim.beans.StatusLocalHomeImpl0.remove(java.lang.Object).

at com.dcx.mcg.itp.aa.projects.eeim.beans.DataBean.removeStatus(DataBean.java:813)

at com.dcx.mcg.itp.aa.projects.eeim.beans.DataObjectImpl0.removeStatus(DataObjectImpl0.java:2861)

... 32 more

; nested exception is:

javax.ejb.EJBException: Exception in method com.dcx.mcg.itp.aa.projects.eeim.beans.StatusLocalHomeImpl0.remove(java.lang.Object).; nested exception is: javax.ejb.EJBException: com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method com.dcx.mcg.itp.aa.projects.eeim.beans.StatusLocalHomeImpl0.remove(java.lang.Object).

at com.dcx.mcg.itp.aa.projects.eeim.beans.StatusLocalHomeImpl0.remove(StatusLocalHomeImpl0.java:197)

at com.dcx.mcg.itp.aa.projects.eeim.beans.DataBean.removeStatus(DataBean.java:807)

at com.dcx.mcg.itp.aa.projects.eeim.beans.DataObjectImpl0.removeStatus(DataObjectImpl0.java:2861)

at com.dcx.mcg.itp.aa.projects.eeim.beans.Data_Stub.removeStatus(Data_Stub.java:2207)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)

at $Proxy441.removeStatus(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)

at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)

at SoapServlet.doPost(SoapServlet.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

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:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbLoad().

at com.sap.engine.services.ejb.entity.ContextFP.activate(ContextFP.java:196)

at com.dcx.mcg.itp.aa.projects.eeim.beans.StatusLocalHomeImpl0.remove(StatusLocalHomeImpl0.java:125)

... 34 more

Caused by: java.lang.ClassCastException

at com.dcx.mcg.itp.aa.projects.eeim.beans.StatusBean0Persistent.init(StatusBean0Persistent.java:102)

at com.sap.engine.services.ejb.entity.pm.PersistentCache.supply(PersistentCache.java:85)

at com.dcx.mcg.itp.aa.projects.eeim.beans.StatusBean0PM.ejbLoad(StatusBean0PM.java:237)

at com.sap.engine.services.ejb.entity.ContextFP.activate(ContextFP.java:187)

... 35 more

com.sap.engine.services.ejb.entity.ContainerException: Exception in method ejbLoad().

at com.sap.engine.services.ejb.entity.ContextFP.activate(ContextFP.java:196)

at com.dcx.mcg.itp.aa.projects.eeim.beans.StatusLocalHomeImpl0.remove(StatusLocalHomeImpl0.java:125)

at com.dcx.mcg.itp.aa.projects.eeim.beans.DataBean.removeStatus(DataBean.java:807)

at com.dcx.mcg.itp.aa.projects.eeim.beans.DataObjectImpl0.removeStatus(DataObjectImpl0.java:2861)

at com.dcx.mcg.itp.aa.projects.eeim.beans.Data_Stub.removeStatus(Data_Stub.java:2207)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)

at $Proxy441.removeStatus(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sap.engine.services.webservices.runtime.EJBImplementationContainer.invokeMethod(EJBImplementationContainer.java:126)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:146)

at com.sap.engine.services.webservices.runtime.RuntimeProcessor.process(RuntimeProcessor.java:68)

at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:92)

at SoapServlet.doPost(SoapServlet.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

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:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

Caused by: java.lang.ClassCastException

at com.dcx.mcg.itp.aa.projects.eeim.beans.StatusBean0Persistent.init(StatusBean0Persistent.java:102)

at com.sap.engine.services.ejb.entity.pm.PersistentCache.supply(PersistentCache.java:85)

at com.dcx.mcg.itp.aa.projects.eeim.beans.StatusBean0PM.ejbLoad(StatusBean0PM.java:237)

at com.sap.engine.services.ejb.entity.ContextFP.activate(ContextFP.java:187)

... 35 more[/code]

My code:

[code]

private StatusLocalHome statusHome = null;

...

public void setSessionContext(SessionContext context)

{

...

Status obj = jndiContext.lookup("java:comp/env/ejb/EEIMStatus");

statusHome =

(StatusLocalHome) PortableRemoteObject.narrow(

obj,

StatusLocalHome.class);

...

}

...

public int removeStatus(long id)

{

try

{

StatusLocal statusLocal =

statusHome.findByPrimaryKey(new Long(id));

statusHome.remove(statusLocal);

return 1;

}

catch (EJBException ex)

{

throw new EJBException(ex.getMessage(), ex);

}

catch (FinderException ex)

{

throw new EJBException(ex.getMessage(), ex);

}

catch (RemoveException ex)

{

throw new EJBException(ex.getMessage(), ex);

}

}[/code]

Does somebody recoginzes what I've done wrong?

Thanks for all replies

Regard

Daniel

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jun 06, 2005 at 11:19 AM

    Hello Daniel,

    The first problem that I see is the usage of PortableRemoteObject.narrow method - it must be used only in the case when remote EJB reference is obtained. I assume in your case the EJB reference is local.

    The real problem, however, is the wrong parameter in the remove() method. I suppose it causes the ClassCastException. The parameter must be the primary key, not the EJBObject reference. The code should be:

    statusHome.remove(new Long(id));

    instead of

    StatusLocal statusLocal =

    statusHome.findByPrimaryKey(new Long(id));

    statusHome.remove(statusLocal);

    I hope this helps.

    Regards,

    Svetoslav

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2005 at 11:28 AM

    So easy...

    Thank you very much for your solution

    Regards

    Daniel

    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.