Currently if the start of a GBean fails, an error with a stack trace is written to the log.

Sometimes the cause of the GBean failure is a common user error that does not require a stack trace for the user to rectify the problem. An example of this is where a port is already in use and we get a BindException. All the user really needs to be told is that Jetty or Tomcat was attempting to use port x and it was already in use.

Since BindExceptions are a common problem that new users may run into the first time they start Geronimo on their system, seeing a stack trace IMHO is not a good impression. I have heard many people comment that they like Geronimo's startup because it doesn't output heaps of unncessary messages. It would be nice if it still operated that way when users make a common mistake.

Could we introduce a new exception class e.g. GBeanLifecycleException that can be optionally used by GBeans (such the JettyConnector shown below) and change the code in the catch block of GBeanInstanceState.attemptFullStart(..) to check if the exception is an instance of GBeanLifecycleException and if so, call the method on the exception that returns whether the stack trace should be logged.

Comments or other ideas on how we could we improve the current code GBean code so that the start of a GBean can "optionally" result in a message being logged without a stack trace being logged.

An example of one of the stack traces the user would currently see:

09:08:35,375 ERROR [GBeanInstanceState] Error while starting; GBean is now in the FAILED state: objectName="geronimo.server:J2EEAppl
ication=null,J2EEModule=org/apache/geronimo/Jetty,J2EEServer=geronimo,j2eeType=GBean,name=JettyWebConnector"
java.net.BindException: Address already in use: JVM_Bind
       at java.net.PlainSocketImpl.socketBind(Native Method)
       at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:331)
       at java.net.ServerSocket.bind(ServerSocket.java:318)
       at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.mortbay.util.ThreadedServer.newServerSocket(ThreadedServer.java:391)
       at org.mortbay.util.ThreadedServer.open(ThreadedServer.java:477)
at org.apache.geronimo.jetty.connector.JettyConnector.doStart(JettyConnector.java:203) at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:936) at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:325)
       <SNIP>

Thanks,

John

Reply via email to