Skip to main content

GlassFish needs useful exception messages

5 replies [Last post]
cayhorstmann
Offline
Joined: 2003-06-13
Points: 0

I just got the exception report below, followed by the note: The full stack trace of the root cause is available in the Sun Java System Application Server Platform Edition 9.0 logs.

The note is wrong--the logs contain the same stack trace.

The stack trace is useless--it only unravels one layer of remote exceptions.

This is extremely infuriating. A developer has nothing to go by except these stack traces when something goes wrong somewhere.

The hope with EJB3 is that more developers will be attracted by the "ease of development" features. But then GlassFish needs to do its part and produce useful exception and logging messages.

This should be the "out of the box" default. If someone wants fewer messages, they can set that through the admin interface.

Cay

===================================
org.apache.jasper.JasperException: javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:311)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:256)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:289)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:172)
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:214)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:569)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:350)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:243)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:248)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:73)

root cause

javax.ejb.EJBException: nested exception is: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException
elvis.session._Greeter_Wrapper.getUsers(elvis.session._Greeter_Wrapper.java)
org.apache.jsp.index_jsp._jspService(index_jsp.java:103)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:335)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:311)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:256)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:289)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:172)
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:214)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:569)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:350)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:243)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:248)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:73)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zubinraja
Offline
Joined: 2009-05-21
Points: 0

hey bro..
same exception here
u got solution??

cayhorstmann
Offline
Joined: 2003-06-13
Points: 0

Just to amplify the point of my previous post: I logged the exception in the source of my bean, and I got this error message:

java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName simple

Ok, that gives me something to work with.

Why not log the innermost of the nested exceptions instead of the outermost two?

ludo
Offline
Joined: 2003-06-10
Points: 0

Niced thread started, based on this post:
https://glassfish.dev.java.net/servlets/BrowseList?list=dev&by=thread&fr...

Thanks for the feedback,
Ludo

cayhorstmann
Offline
Joined: 2003-06-13
Points: 0

I had a peek and got a chuckle out of "Cay Horstmann isn't exactly a novice either".

Here are my thoughts.

1) The raw stack trace is like a slap in the face of the developer who is already stressed. It's poor usability.

2) It is the nature of the beast that exceptions are wrapped inside other exceptions. Showing just the outer two layers, when they contribute no information, is terrible.

3) Lying about more detail in the logs, when in fact no such detail is provided, makes it worse.

4) Having to look at the logs for every piddly problem is a pain.

Why not have a smarter exception view?

*) Show the message and the first few lines of EACH stack frame in the "cause" chain (and be smart about obtaining that chain--not all exception hierarchies use getCause yet)
*) Highlight the innermost one--it is most likely the most useful one
*) Allow the user to click on each frame to expand it. It is rarely useful to do so, but once in a while it is, particularly if you have the app server source

Cay

cayhorstmann
Offline
Joined: 2003-06-13
Points: 0

I just discovered the "log viewer" in the admin console. Well, that's certainly nicer than reading the raw server log.

Here is a suggestion. When an error message with a stack trace is displayed, why not include a link to the log viewer? "Click here for more detail" is a lot better than "Find the logs yourself to prove that you are a Real Programmer".

I realize that the feature needs to be turned off in a production server. But if we can keep a few more budding developers from giving up in frustration, it will be worth it.