Announcement Announcement Module
Collapse
No announcement yet.
Spring + Hibernate using Oracle, Apache Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring + Hibernate using Oracle, Apache

    hi,

    I had encouter run time error when using apache on a Spring + MVC + Hibernate project, the project was downloaded
    from internet,

    The error output is very long, and below is a portion of it, does anyone know where it could be the issue?

    DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@23f1bb: defining beans [org.springframework.context.annotation.internalCon figurationAnnotationProcessor,org.springframework. context.annotation.internalAutowiredAnnotationProc essor,org.springframework.context.annotation.inter nalRequiredAnnotationProcessor,org.springframework .context.annotation.internalCommonAnnotationProces sor,org.springframework.context.annotation.interna lPersistenceAnnotationProcessor,contactFormValidat or,contactsControllers,contactsDAO,org.springframe work.web.servlet.mvc.annotation.DefaultAnnotationH andlerMapping#0,org.springframework.format.support .FormattingConversionServiceFactoryBean#0,org.spri ngframework.web.servlet.mvc.annotation.AnnotationM ethodHandlerAdapter#0,org.springframework.web.serv let.handler.MappedInterceptor#0,org.springframewor k.beans.factory.config.PropertyPlaceholderConfigur er#0,messageSource,org.springframework.aop.config. internalAutoProxyCreator,org.springframework.trans action.annotation.AnnotationTransactionAttributeSo urce#0,org.springframework.transaction.interceptor .TransactionInterceptor#0,org.springframework.tran saction.config.internalTransactionAdvisor,transact ionManager,sessionFactory,dataSource]; root of factory hierarchy
    DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@23f1bb: defining beans [org.springframework.context.annotation.internalCon figurationAnnotationProcessor,org.springframework. context.annotation.internalAutowiredAnnotationProc essor,org.springframework.context.annotation.inter nalRequiredAnnotationProcessor,org.springframework .context.annotation.internalCommonAnnotationProces sor,org.springframework.context.annotation.interna lPersistenceAnnotationProcessor,contactFormValidat or,contactsControllers,contactsDAO,org.springframe work.web.servlet.mvc.annotation.DefaultAnnotationH andlerMapping#0,org.springframework.format.support .FormattingConversionServiceFactoryBean#0,org.spri ngframework.web.servlet.mvc.annotation.AnnotationM ethodHandlerAdapter#0,org.springframework.web.serv let.handler.MappedInterceptor#0,org.springframewor k.beans.factory.config.PropertyPlaceholderConfigur er#0,messageSource,org.springframework.aop.config. internalAutoProxyCreator,org.springframework.trans action.annotation.AnnotationTransactionAttributeSo urce#0,org.springframework.transaction.interceptor .TransactionInterceptor#0,org.springframework.tran saction.config.internalTransactionAdvisor,transact ionManager,sessionFactory,dataSource]; root of factory hierarchy
    ContextLoader - Context initialization failed
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'contactsControllers': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private com.sivalabs.contacts.ContactsDAO com.sivalabs.contacts.ContactsControllers.contacts DAO; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'contactsDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private org.hibernate.SessionFactory com.sivalabs.contacts.ContactsDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateExcep tion; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationExceptio n: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver]
    at org.springframework.beans.factory.annotation.Autow iredAnnotationBeanPostProcessor.postProcessPropert yValues(AutowiredAnnotationBeanPostProcessor.java: 285)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1074)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
    at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
    at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:425)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4206)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4705)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1057)
    at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:840)
    at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(Sta ndardService.java:525)
    at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalin a.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:414)
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private com.sivalabs.contacts.ContactsDAO com.sivalabs.contacts.ContactsControllers.contacts DAO; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'contactsDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: private org.hibernate.SessionFactory com.sivalabs.contacts.ContactsDAO.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateExcep tion; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationExceptio n: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver]

  • #2
    Hello

    Next time use code tags to make more readable the error stack trace

    [applicationContext.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationExce ption:
    Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]:
    Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateExcep tion;
    nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationExceptio n:
    Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException:
    Could not load JDBC driver class [oracle.jdbc.OracleDriver]
    Be sure your Oracle driver is in your classpath (Maven dependency or jar file)

    Comment


    • #3
      Sorry, how to use code tags in forum?

      Yes, after I include the library in classpath in Eclipse IDE , it works now. thanks.

      Comment

      Working...
      X