Spring: ClassPathXmlApplicationContext File Lookup / Database Exceptions

Quick Tip: When you are trying to look up your xml Spring configuration file, ensure that you put the xml file into the build path source directory of your project. In my case, the ejbModule directory. I had it in the root of the EJB project and Spring (rightfully so) could not find it.

Also, one of the benefits of using the Spring framework is that you get back exceptions from databases that are actually relevant. Here, my J2C Authentication Alias is incorrect and I get back a nice Spring CannotGetJdbcConnectionException instead of just attempting to decipher what DSRA0010E: SQL State = 72000, Error Code = 1,017 means.

[7/10/08 11:31:01:171 EDT] 0000004c ExceptionUtil E

CNTR0020E: EJB threw an unexpected (non-declared) exception

during invocation of method "onMessage" on bean

"BeanId(LoggingEAR#LoggingEJB.jar#LoggingMDB, null)".

Exception data:

org.springframework.jdbc.CannotGetJdbcConnectionException:

Could not get JDBC Connection; nested exception is java.sql.SQLException:

 ORA-01017: invalid username/password; logon denied

DSRA0010E: SQL State = 72000, Error Code = 1,017

 at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)

Author: dan

Leave a Reply

Your email address will not be published. Required fields are marked *