Question : Jboss 5.0 problem with Hibernate

Hello Experts,

i am not able to connect mysql database from my web  application using hibernate with Jboss 5.0 Application server....if i use Jboss 4.x ,it is working fine....with Jboss 5.0 it is giving(Could not obtain connection metadata java.sql.SQLException: No suitable driver) following exception..!!


Exception:

15:57:11,622 INFO  [Environment] Hibernate 3.3.1.GA
15:57:11,714 INFO  [Configuration] configuring from resource: /hibernate.cfg.xml
15:57:11,715 INFO  [Configuration] Configuration resource: /hibernate.cfg.xml
15:57:11,731 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/UserType.hbm.xml
15:57:11,801 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.UserType -> UserType
15:57:11,826 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/Agency.hbm.xml
15:57:11,852 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.Agency -> Agency
15:57:11,853 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/User.hbm.xml
15:57:11,874 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.User -> User
15:57:11,944 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/Country.hbm.xml
15:57:11,953 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.Country -> Country
15:57:11,954 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/State.hbm.xml
15:57:12,048 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.State -> State
15:57:12,049 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/District.hbm.xml
15:57:12,063 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.District -> District
15:57:12,073 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/City.hbm.xml
15:57:12,089 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.City -> City
15:57:12,090 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/AddressType.hbm.xml
15:57:12,137 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.AddressType -> AddressType
15:57:12,138 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/Address.hbm.xml
15:57:12,148 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.Address -> Address
15:57:12,149 INFO  [Configuration] Reading mappings from resource : eaft/admanagement/hibernate/AgencyAddress.hbm.xml
15:57:12,165 INFO  [HbmBinder] Mapping class: eaft.admanagement.hibernate.AgencyAddress -> AgencyAddress
15:57:12,167 INFO  [Configuration] Configured SessionFactory: null
15:57:12,169 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.UserType.users -> User
15:57:12,170 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.Agency.users -> User
15:57:12,170 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.Agency.agencyAddresses -> AgencyAddress
15:57:12,170 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.Country.states -> State
15:57:12,174 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.Country.addresses -> Address
15:57:12,175 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.State.districts -> District
15:57:12,175 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.State.addresses -> Address
15:57:12,175 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.District.addresses -> Address
15:57:12,175 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.District.cities -> City
15:57:12,175 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.City.addresses -> Address
15:57:12,175 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.AddressType.addresses -> Address
15:57:12,175 INFO  [HbmBinder] Mapping collection: eaft.admanagement.hibernate.Address.agencyAddresses -> AgencyAddress
15:57:12,330 INFO  [DriverManagerConnectionProvider] Using Hibernate built-in connection pool (not for production use!)
15:57:12,330 INFO  [DriverManagerConnectionProvider] Hibernate connection pool size: 20
15:57:12,330 INFO  [DriverManagerConnectionProvider] autocommit mode: false
15:57:12,334 INFO  [DriverManagerConnectionProvider] using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/Management
15:57:12,334 INFO  [DriverManagerConnectionProvider] connection properties: {user=root, password=raghu}
15:57:12,335 WARN  [SettingsFactory] Could not obtain connection metadata
java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getConnection(DriverManager.java:545)
        at java.sql.DriverManager.getConnection(DriverManager.java:140)
        at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
        at org.apache.jsp.JSP.Home.UserRegDAO_jsp._jspService(UserRegDAO_jsp.java:134)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)
15:57:12,366 INFO  [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
15:57:12,374 INFO  [TransactionFactoryFactory] Using default transaction strategy (direct JDBC transactions)
15:57:12,377 INFO  [TransactionManagerLookupFactory] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
15:57:12,378 INFO  [SettingsFactory] Automatic flush during beforeCompletion(): disabled
15:57:12,378 INFO  [SettingsFactory] Automatic session close at end of transaction: disabled
15:57:12,380 INFO  [SettingsFactory] Scrollable result sets: disabled
15:57:12,380 INFO  [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
15:57:12,380 INFO  [SettingsFactory] Connection release mode: auto
15:57:12,381 INFO  [SettingsFactory] Maximum outer join fetch depth: 2
15:57:12,382 INFO  [SettingsFactory] Default batch fetch size: 1
15:57:12,382 INFO  [SettingsFactory] Generate SQL with comments: disabled
15:57:12,382 INFO  [SettingsFactory] Order SQL updates by primary key: disabled
15:57:12,382 INFO  [SettingsFactory] Order SQL inserts for batching: disabled
15:57:12,382 INFO  [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
15:57:12,387 INFO  [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
15:57:12,387 INFO  [SettingsFactory] Query language substitutions: {}
15:57:12,387 INFO  [SettingsFactory] JPA-QL strict compliance: disabled
15:57:12,387 INFO  [SettingsFactory] Second-level cache: enabled
15:57:12,387 INFO  [SettingsFactory] Query cache: disabled
15:57:12,387 INFO  [SettingsFactory] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
15:57:12,388 INFO  [SettingsFactory] Optimize cache for minimal puts: disabled
15:57:12,388 INFO  [SettingsFactory] Structured second-level cache entries: disabled
15:57:12,396 INFO  [SettingsFactory] Statistics: disabled
15:57:12,396 INFO  [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
15:57:12,396 INFO  [SettingsFactory] Default entity-mode: pojo
15:57:12,396 INFO  [SettingsFactory] Named query checking : enabled
15:57:12,449 INFO  [SessionFactoryImpl] building session factory
15:57:12,777 INFO  [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
15:57:12,834 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: 08001
15:57:12,835 ERROR [JDBCExceptionReporter] No suitable driver
15:57:12,838 ERROR [STDERR] org.hibernate.exception.JDBCConnectionException: Cannot open connection
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
        at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449)
        at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167)
        at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142)
        at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
        at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1353)
        at org.apache.jsp.JSP.Home.UserRegDAO_jsp._jspService(UserRegDAO_jsp.java:136)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getConnection(DriverManager.java:545)
        at java.sql.DriverManager.getConnection(DriverManager.java:140)
        at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
        at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446)
        ... 31 more

Answer : Jboss 5.0 problem with Hibernate

try to move it from WEB-INF/lib folder to the $JBOSS_HOME/server/default/lib

Random Solutions  
 
programming4us programming4us