• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Problems with EJB 2.0 Exceptions in WSAD 5.1.2

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I'm using WSAD 5.1.2, IBM DB2 8.1 and EJB 2.0....

I have two CMP beans: A Bean1 have 1 to many relationship with Bean2

When I tried to remove a registry of Bean1 that has relationship with Bean2, I get this error:

[5/3/05 17:48:45:017 VET] 7ac07ac DataAccessReq E PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@1a791a79
[5/3/05 17:48:45:017 VET] 7ac07ac DataAccessReq E PMGR0000E: Call stack:
com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@1a791a79
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at com.ibm.ws.exception.WsException.<init>(WsException.java:74)
at com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException.<init>(Unknown Source)
at com.ibm.ws.ejbpersistence.dataaccess.DataAccessRequestImpl.execute(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.executeRemove(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.CBReadyState.ejbRemove(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.ejbRemove(Unknown Source)
at com.ibm.ve.entity.ConcreteEstado_9a3ed048.ejbRemove(ConcreteEstado_9a3ed048.java:51)
at com.ibm.ejs.container.EntityBeanO.remove(EntityBeanO.java:1386)
at com.ibm.ejs.container.EJSContainer.removeBean(EJSContainer.java:2007)
at com.ibm.ejs.container.EJSLocalWrapper.remove(EJSLocalWrapper.java:154)
at com.ibm.ve.facade.OrganizacionStatelessBean.eliminarEstado(OrganizacionStatelessBean.java)
at com.ibm.ve.facade.EJSRemoteStatelessOrganizacionStateless_4cfc072c.eliminarEstado(EJSRemoteStatelessOrganizacionStateless_4cfc072c.java:341)
at com.ibm.ve.facade._OrganizacionStateless_Stub.eliminarEstado(_OrganizacionStateless_Stub.java:2177)
at com.ibm.ve.businessDelegate.CommonBusinessDelegate.eliminarEstado(CommonBusinessDelegate.java)
at com.ibm.ve.actions.estado.EstadoAction.execute(EstadoAction.java)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at com.ibm.ve.filters.RequestFilter.doFilter(RequestFilter.java:61)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:939)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)
---- Begin backtrace for nested exception
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0532N A parent row cannot be deleted because the relationship "SCHEMA.CENTRO.CENTRO_ESTADO" restricts the deletion. SQLSTATE=23504

at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at java.sql.SQLException.<init>(SQLException.java:51)
at COM.ibm.db2.jdbc.DB2Exception.<init>(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
at com.ibm.ve.entity.websphere_deploy.DB2UDBNT_V8_1.EstadoBeanFunctionSet_9a3ed048.Remove(EstadoBeanFunctionSet_9a3ed048.java:91)
at com.ibm.ve.entity.websphere_deploy.DB2UDBNT_V8_1.EstadoBeanFunctionSet_9a3ed048.execute(EstadoBeanFunctionSet_9a3ed048.java:365)
at com.ibm.ws.rsadapter.cci.WSInteractionImpl.execute(WSInteractionImpl.java:347)
at com.ibm.ws.rsadapter.cci.WSRelationalRAAdapter.executeRemove(WSRelationalRAAdapter.java:328)
at com.ibm.ws.ejbpersistence.dataaccess.DataAccessRequestImpl.execute(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.executeRemove(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.CBReadyState.ejbRemove(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanStatefulInstanceExtensionImpl.ejbRemove(Unknown Source)
at com.ibm.ve.entity.ConcreteEstado_9a3ed048.ejbRemove(ConcreteEstado_9a3ed048.java:51)
at com.ibm.ejs.container.EntityBeanO.remove(EntityBeanO.java:1386)
at com.ibm.ejs.container.EJSContainer.removeBean(EJSContainer.java:2007)
at com.ibm.ejs.container.EJSLocalWrapper.remove(EJSLocalWrapper.java:154)
at com.ibm.ve.facade.OrganizacionStatelessBean.eliminarEstado(OrganizacionStatelessBean.java)
at com.ibm.ve.facade.EJSRemoteStatelessOrganizacionStateless_4cfc072c.eliminarEstado(EJSRemoteStatelessOrganizacionStateless_4cfc072c.java:341)
at com.ibm.ve.facade._OrganizacionStateless_Stub.eliminarEstado(_OrganizacionStateless_Stub.java:2177)
at com.ibm.ve.businessDelegate.CommonBusinessDelegate.eliminarEstado(CommonBusinessDelegate.java)
at com.ibm.ve.actions.estado.EstadoAction.execute(EstadoAction.java)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
at com.ibm.ve.filters.RequestFilter.doFilter(RequestFilter.java:61)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:939)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java)




Debugging the application, the method that execute the remove, throws the following exception: TransactionRolledbackLocalException
And in the try-catch block I receive that exception and I throw an Application Exception (OwnRemoveException) with the exception details.
The problem is that in the class that call the method in the stateless bean, it throws ServerException instead OwnRemoveException..


So, if you have any suggestions or solutions please help me with this problem...

Thanks.
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eliana Diaz O.:
Hi!
I have two CMP beans: A Bean1 have 1 to many relationship with Bean2

When I tried to remove a registry of Bean1 that has relationship with Bean2, I get this error:


COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0532N A parent row cannot be deleted because the relationship "SCHEMA.CENTRO.CENTRO_ESTADO" restricts the deletion. SQLSTATE=23504



I have never used websphere and i accidentally ran into this post. So I might be wrong. I trimmed the stacktrace quite a bit for clarity. So Bean 1 is a parent bean and Bean2 is a child bean.
So you have a Fk from table represented by Bean2 to that represented by Bean1. But you dont have a cascade delete specified on the constraint.
So when you try to remove Bean1 w/o removing Bean2, you get this error?
Either change the order of removal of beans ie remove all Bean2s before Bean1 OR better specify a cascade delete on the CMR and also on the databse schema (on the FK from Table2 (bean2) to table1 (bean1).
 
Eliana Diaz O.
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Karthik!

Thanks for your response.

Well, Bean 1 is a parent bean and Bean2 is a child bean.

But I don't need the cascade deletion, neither remove Bean 2 first and then Bean 1.

What I need is that the EJB container don�t let me remove Bean 1 by throwing an exception, catch that exception, throw my OwnRemoveException and then catch my OwnRemoveException in the class that call the method, to show a correct message to the user.

The problem is that in the class that call the method, it throws ServerException instead OwnRemoveException..

Thanks very much.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic