-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: HibernateException.getCause() problems
PostPosted: Thu Apr 14, 2005 11:11 am 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
Hi,

I am using Hibernate3. What I noticed is if I throw new HibernateException(e) where "e" is some preexisting exception, then Tomcat will not display "e" as the underlying cause of the exception. This makes it very difficult to diagnose problems.

If, however, I wrap "e" in any other standard Java exception, it works properly. I can't seem to figure out what is wrong with HibernateException. I'd like to file a bug report if possible.

Thanks,
Gili


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 11:55 am 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
What are you/tomcat calling to display the exception? getCause()?

It should work - the exception model is based on the apache nestable exception model - so what you see when calling printing the trace may be different based on the version of your vm.

What java vm are you using?
What do you see when if you do:
Code:
new HibernateException(new IllegalStateException("test")).printStackTrace();

and

new HibernateException(new IllegalStateException("test")).
    getCause().printStackTrace();


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 12:13 pm 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
drj wrote:
What are you/tomcat calling to display the exception? getCause()?

It should work - the exception model is based on the apache nestable exception model - so what you see when calling printing the trace may be different based on the version of your vm.

What java vm are you using?
What do you see when if you do:
Code:
new HibernateException(new IllegalStateException("test")).printStackTrace();

and

new HibernateException(new IllegalStateException("test")).
    getCause().printStackTrace();


Hi,

I believe the problem is not in getCause() but rather in toString() or something. I know for a fact that invoking getCause().printStackTrace() manually produces the correct output but if Tomcat is allowed to handle it the cause is never displayed. It might have something to do with HibernateException.toString() or other methods that indirectly contain the cause string.

I get the following stack-traces from your test-case:

org.hibernate.HibernateException: java.lang.IllegalStateException: test
at com.be.desktopbeautifier.servlet.InitDB.processRequest(InitDB.java:48)
at com.be.desktopbeautifier.servlet.DefaultServlet.processRequest(DefaultServlet.java:87)
at com.be.desktopbeautifier.servlet.DefaultServlet.doGet(DefaultServlet.java:247)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
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:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
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:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalStateException: test
... 22 more



java.lang.IllegalStateException: test
at com.be.desktopbeautifier.servlet.InitDB.processRequest(InitDB.java:50)
at com.be.desktopbeautifier.servlet.DefaultServlet.processRequest(DefaultServlet.java:87)
at com.be.desktopbeautifier.servlet.DefaultServlet.doGet(DefaultServlet.java:247)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
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:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
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:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 2:01 pm 
Expert
Expert

Joined: Fri Nov 07, 2003 4:24 am
Posts: 315
Location: Cape Town, South Africa
and toString()?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 2:07 pm 
Senior
Senior

Joined: Tue Mar 02, 2004 6:17 pm
Posts: 151
drj wrote:
and toString()?


Last time I checked, empty string. Which seems wrong to me.

Gili


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.