IntelliJ open source
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Products » JBoss
 
RSS feed
 
New topic
Author

Exception propogation in Jboss EJB.

Shivey Upadhyay
Greenhorn

Joined: Oct 05, 2007
Messages: 29


public interface HelloWorldHome extends javax.ejb.EJBHome{
public void create() throws java.rmi.RemoteException, com.MyException;

--This is a BMP--
public class HelloWorldBean implements EntityBean{
----implemented methods----
public HelloWorldEntity ejbCreate() throws com.MyException{
throw new MyException("This is explicitly thrown.")
}
}

package com;

public class MyException extends RuntimeException{
--custom code goes here--
}


Hi,
I am trying to run above BMP in JBoss, i want to get the message "This is explicitly thrown." at client, but my exception is not wrapped
into Remote exception(that i get at client) and the message that i get is like "java.lang.IllegalStateException Cannot obtain isMethod flag for....".
Is there any way i can send this specific runtime exception message to client.

Thanks in advance.

Thanks,
Shivey
SCJP, SCWCD, and Aspiring SCDJWS
Shivey Upadhyay
Greenhorn

Joined: Oct 05, 2007
Messages: 29

Hi,

I am facing this issue on Jboss 4.0.2 on Windows XP machine and EJB version is 2.0.

Thanks in adcance.

Thanks,
Shivey
SCJP, SCWCD, and Aspiring SCDJWS
Peter Johnson
author
Bartender

Joined: May 14, 2008
Messages: 2374

It might help if you post the exception stack traces for the errors. The ones in the console log (or server.log) would be best.

JBoss In Action
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Messages: 490

Shivey Upadhyay wrote:
public interface HelloWorldHome extends javax.ejb.EJBHome{
public void create() throws java.rmi.RemoteException, com.MyException;

--This is a BMP--
public class HelloWorldBean implements EntityBean{
----implemented methods----
public HelloWorldEntity ejbCreate() throws com.MyException{
throw new MyException("This is explicitly thrown.")
}
}

package com;

public class MyException extends RuntimeException{
--custom code goes here--
}


This link talks about what is checked and unchecked exceptions in the EJB arena and could be useful to you.

SCJP 1.5, SCEA, ICED (287,484,486)
Shivey Upadhyay
Greenhorn

Joined: Oct 05, 2007
Messages: 29

Hi,

First of all Thanks for your replies....

Peter, client in my application is TestServlet25, the exception stack trace that i get in server.log is

com.home.HelloWorldHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException:
java.lang.IllegalStateException: Cannot obtain inMethodFlag for: getPrimaryKey occurs.
at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:180)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:78)
at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:146)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:116)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:613)
at org.jboss.ejb.Container.invoke(Container.java:894)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)
at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)
at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:179)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:165)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
at $Proxy54.create(Unknown Source)
at com.model.POJMessageGenerator.getMessage(POJMessageGenerator.java:26)
at com.TestServlet25.doGet(TestServlet25.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
2010-02-10 16:29:03,513 WARN [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/TestWeb].[TestServlet25]] Servlet.service() for servlet TestServlet25 threw exception
java.io.IOException: EJBException:; nested exception is:
java.lang.IllegalStateException: Cannot obtain inMethodFlag for: getPrimaryKey occurs.
at com.TestServlet25.doGet(TestServlet25.java:39)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)

JBoss swallows the exception that i throw from Implementation class and gives me a new exception at client...with no trace of what might have gone wrong...

This message was edited 1 time. Last update was at by Shivey Upadhyay


Thanks,
Shivey
SCJP, SCWCD, and Aspiring SCDJWS
Shivey Upadhyay
Greenhorn

Joined: Oct 05, 2007
Messages: 29

Hi,

Please can anyone help me with following exception.....

java.rmi.ServerException: RuntimeException; nested exception is: java.lang.IllegalStateException: Cannot obtain inMethodFlag for: getPrimaryKey

Why does it come????? Is there any workaround to avoid it?

Thanks in advance...


Thanks,
Shivey
SCJP, SCWCD, and Aspiring SCDJWS
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Messages: 490

Shivey Upadhyay wrote:Hi,

Please can anyone help me with following exception.....

java.rmi.ServerException: RuntimeException; nested exception is: java.lang.IllegalStateException: Cannot obtain inMethodFlag for: getPrimaryKey

Why does it come????? Is there any workaround to avoid it?

Thanks in advance...



Follow this webpage

SCJP 1.5, SCEA, ICED (287,484,486)
Shivey Upadhyay
Greenhorn

Joined: Oct 05, 2007
Messages: 29

Hi,

The code was calling getPrimaryKey() method on EntityContext reference from unsetEntityContext() method. I wrapped that call in try-catch block and it worked fine. I am still wandering, as i am migrating this application from Weblogic to JBOSS, how the same thing used to work on Weblogic without throwing any IllegalStateException...?

Thanks again for your replies..

Thanks,
Shivey
SCJP, SCWCD, and Aspiring SCDJWS
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Products » JBoss
 
RSS feed
 
New topic
hibernate profiler

.