I'm a new to spring and trying few sample codes in spring . When I try to access DB (Oracle) using
JDBC Template. It complies without any issues, but throws the below runtime exception.
My App-context xml file is
I use the following jars.
spring.jar
spring-core.jar
spring-jdbc.jar
ojdbc.jar
commons-dbcp.jar
commons-logging.jar
commons-pool.jar
The URL values are correct, I'm able to establish connection using JDBC.
I tried running this (as a stand lone App) using eclipse and
ANT scripts as well. But getting the same error.
[java] Oct 21, 2009 9:51:19 AM org.springframework.beans.factory.xml.XmlBea
nDefinitionReader loadBeanDefinitions
[java] INFO: Loading XML bean definitions from class path resource [sampleD
AO.xml]
[java] Exception in thread "main" org.springframework.beans.factory.BeanCre
ationException: Error creating bean with name 'sampleDAO' defined in class path
resource [sampleDAO.xml]: Error setting property values; nested exception is org
.springframework.beans.PropertyBatchUpdateExceptio n; nested PropertyAccessExcept
ions (1) are:
[java] PropertyAccessException 1: org.springframework.beans.MethodInvocatio
nException: Property 'dataSource' threw exception; nested exception is java.lang
.NullPointerException
[java] at org.springframework.beans.factory.support.Abstract AutowireCap
ableBeanFactory.applyPropertyValues(AbstractAutowi reCapableBeanFactory.java:1243
)
[java] at org.springframework.beans.factory.support.Abstract AutowireCap
ableBeanFactory.populateBean(AbstractAutowireCapab leBeanFactory.java:978)
[java] at org.springframework.beans.factory.support.Abstract AutowireCap
ableBeanFactory.doCreateBean(AbstractAutowireCapab leBeanFactory.java:462)
[java] at org.springframework.beans.factory.support.Abstract AutowireCap
ableBeanFactory$1.run(AbstractAutowireCapableBeanF actory.java:404)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at org.springframework.beans.factory.support.Abstract AutowireCap
ableBeanFactory.createBean(AbstractAutowireCapable BeanFactory.java:375)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory
$1.getObject(AbstractBeanFactory.java:263)
[java] at org.springframework.beans.factory.support.DefaultS ingletonBea
nRegistry.getSingleton(DefaultSingletonBeanRegistr y.java:170)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory
.doGetBean(AbstractBeanFactory.java:260)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory
.getBean(AbstractBeanFactory.java:184)
[java] at org.springframework.beans.factory.support.Abstract BeanFactory
.getBean(AbstractBeanFactory.java:163)
[java] at com.sample.dao.SampleDAOClient.main(Unknown Source)
[java] Caused by: org.springframework.beans.PropertyBatchUpdateExcep tion; n
ested PropertyAccessExceptions (1) are:
[java] PropertyAccessException 1: org.springframework.beans.MethodInvocatio
nException: Property 'dataSource' threw exception; nested exception is java.lang
.NullPointerException
[java] at org.springframework.beans.AbstractPropertyAccessor .setPropert
yValues(AbstractPropertyAccessor.java:104)
Thanks for any help!!
Vivek