Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting No suitable driver error using hibernate.

 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


I am working on ana application which is integration of struts 2, spring and hibernate. Below is the code for web.xml and applicationContext.xml.












I am using Oracle as Database. When I start tomcat it gives me following error:

java.sql.SQLException: No suitable driver found for jdbcracle:thin:@localhost:
1521:ibpm
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnec
tionFromDriverManager(DriverManagerDataSource.java:291)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnec
tionFromDriverManager(DriverManagerDataSource.java:277)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnec
tionFromDriverManager(DriverManagerDataSource.java:259)
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnec
tion(DriverManagerDataSource.java:241)
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.
getConnection(LocalDataSourceConnectionProvider.java:80)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:
72)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1869
)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1162)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:800)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPrope
rtiesSet(LocalSessionFactoryBean.java:726)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory$1.run(AbstractAutowireCapableBeanFactory.java:412)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:383)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:276)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:273)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:175)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:479)
at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:716)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:377)
at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:254)
at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:198)
at org.springframework.web.context.ContextLoaderListener.contextInitiali
zed(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3795)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
252)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:74
0)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)

at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:927)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
ava:890)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492
)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
at org.apache.catalina.core.StandardService.start(StandardService.java:4
48)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700
)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)



Can anybody tell me why this error occurs.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you put the Oracle driver file in the classpath?
 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception message suggests otherwise. You get this message for two reasons:
  • The JDBC url is invlaid
  • The driver is not on the classpath


  • I'd check again.
     
    pawan chopra
    Ranch Hand
    Posts: 417
    jQuery Mac Objective C
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Paul,

    Thanks for the reply. I have resolved this error not sure how. What I have done is just replaces struts 2 and spring jar with the latest available build. Now everything is working fine. I have noticed another thing that I am using struts 2 and spring still while deployment it asks for Action class of struts 1.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic