views:

63

answers:

0

I am using a Datasource to log my audit information per user-request. The bean is defined in a springContext.xml sourced during initialization.

Whenever the DB is down, the bean initialization fails with following error: DataAccessException.

What I want to do is continue after this exception(since it is ok not to be able to log). How do I handle this scenario?

Error 500--Internal Server Error
Error creating bean with name 'AuditLogSequenceFactory' defined in ServletContext resource [/WEB-INF/AuditTrailContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.String org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.nextStringValue() throws org.springframework.dao.DataAccessException] threw exception; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceDisabledException: Pool Simple/Datasource/Local is disabled, cannot allocate resources to applications.. - action - zip:C:/bea/user_projects/domains/Simple/./servers/AdminServer/tmp/_WL_user/simpleWN/j5vygk/war/WEB-INF/lib/_wl_cls_gen.jar!/struts_global.xml:9:60
 at com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:199)
 ....
    weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
 at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
 at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
 at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AuditLogSequenceFactory' defined in ServletContext resource [/WEB-INF/AuditTrailContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.String org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.nextStringValue() throws org.springframework.dao.DataAccessException] threw exception; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceDisabledException: Pool Simple/Datasource/Local is disabled, cannot allocate resources to applications..
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:442)
    ....
 at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
 at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3151)

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.String org.springframework.jdbc.support.incrementer.AbstractDataFieldMaxValueIncrementer.nextStringValue() throws org.springframework.dao.DataAccessException] threw exception; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceDisabledException: Pool Simple/Datasource/Local is disabled, cannot allocate resources to applications..
 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:125)
    .... 
 at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
 at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
    Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceDisabledException: Pool Simple/Datasource/Local is disabled, cannot allocate resources to applications..
 at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
    .... at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:167)

Caused by: java.sql.SQLException: Internal error: Cannot obtain XAConnection weblogic.common.resourcepool.ResourceDisabledException: Pool Simple/Datasource/Local is disabled, cannot allocate resources to applications..
 at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1295)
 at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:436)
 at weblogic.jdbc.jta.DataSource.connect(DataSource.java:392)
 at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
    .... at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:126)