#52 NPE in JdbcMonitor

open
nobody
None
5
2009-12-22
2009-12-22
Mike R. Haller
No

A productive web application fails to initialize when run with Glassbox installed.
Using Tomcat 6.0.20. The app is checking for the existence of a specific SQL Table. The DataSource is obtained from the container and backed by a H2 database.

22.12.2009 21:32:41 org.apache.catalina.core.StandardContext loadOnStartup
SCHWERWIEGEND: Servlet /example threw load() exception
java.lang.NullPointerException
at glassbox.monitor.resource.JdbcMonitor.ajc$interFieldGetDispatch$glassbox_monitor_resource_JdbcMonitor$glassbox_monitor_resource_JdbcMonitor$TrackedStatement$key(JdbcMonitor.aj)
at glassbox.monitor.resource.JdbcMonitor.getStatementKey(JdbcMonitor.aj:418)
at glassbox.monitor.resource.JdbcMonitor.ajc$if_5(JdbcMonitor.aj:133)
at org.h2.jdbc.JdbcResultSet.next(JdbcResultSet.java:113)
at org.example.web.application.AbstractWicketApplication.checkDataSource(AbstractWicketApplication.java:155)
at org.example.web.application.AbstractWicketApplication.init(AbstractWicketApplication.java:109)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:719)
at org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:213)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)

(AbstractWicketApplication.java:155) performs the following operation at servlet initialization:

connection = this.dataSource.getConnection();
ResultSet tables = connection.getMetaData().getTables( null, null, "IM_USER", null );
if( tables.next() ) // line 155
{
log.debug( "IM_USER Table found, assuming database is correctly initialized" );
return true;
}
else
{
log.debug( "No IM_USER Table found, assuming first installation" );
return false;
}

Discussion

  • Mike R. Haller
    Mike R. Haller
    2009-12-22

    • summary: NPE in --> NPE in JdbcMonitor