tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Datasource and Hibernate
Date Thu, 24 Apr 2008 11:03:38 GMT
You've been answered.  Please take a look at my and Mark's responses.  
If you can't find them in your email, take a look at the list archives.

--David

Dubois, Fabien wrote:
> Hi everybody, 
>
> I'm using tomcat6 and  trying to use datasource for mysql connexion (and
> hibernate). I have looked to the tomcat 6 official documentation, and in
> the $CATALINA_HOME/conf/context.xml, i have declared : 
> <Context 
>         path="/appWicket" 
>         reloadable="true"> 
>         <Resource 
>           name="jdbc/hibernate"   
>           auth="Container" 
>           type="javax.sql.DataSource" 
>           description="DB Connection" 
>           driverClass="com.mysql.jdbc.Driver" 
>  
> jdbcUrl="jdbc:mysql://localhost:3306/opensource?autoReconnect=true"   
>           user="root" 
>           password="xxxx"/> 
> </Context> 
>
>
>
> In my hibernate.cfg.xml, I have done this (add the first line, to
> replace the commented lines): 
>     <session-factory name="appWicketSession"> 
>     
>     <property
> name="connection.datasource">java:comp/env/jdbc/hibernate</property> 
>
>         <!--property
> name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</proper
> ty--> 
>         <!--property
> name="hibernate.connection.password">admin</property--> 
>         <!--property
> name="hibernate.connection.url">jdbc:mysql://localhost:3306/opensource</
> property--> 
>         <!--property
> name="hibernate.connection.username">xxxx</property--> 
>
>         <property
> name="bytecode.use_reflection_optimizer">false</property> 
>         <property name="c3p0.max_size">5</property> 
>         <property name="c3p0.min_size">3</property> 
>         <property name="c3p0.timeout">1800</property> 
>         <property name="current_session_context_class">thread</property>
>
>         <property
> name="dialect">org.hibernate.dialect.MySQLDialect</property> 
>         <property name="format_sql">true</property> 
>         <property name="show_sql">true</property> 
>         
>
>
> When I try to launch the application, an error appears : 
>
>  INFO [http-8080-1] (NamingHelper.java:26) - JNDI InitialContext
> properties:{} 
>  INFO [http-8080-1] (DatasourceConnectionProvider.java:61) - Using
> datasource: java:comp/env/jdbc/hibernate 
>  WARN [http-8080-1] (SettingsFactory.java:117) - Could not obtain
> connection metadata 
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
> driver of class '' for connect URL 'null' 
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
> urce.java:1150) 
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSourc
> e.java:880) 
>         at
> org.hibernate.connection.DatasourceConnectionProvider.getConnection(Data
> sourceConnectionProvider.java:69) 
>         at
> org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
>
>         at
> org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009) 
>         at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1
> 292) 
>         at com.mycompany.hibernate.HibernateUtil.<clinit>(Unknown
> Source) 
>         at com.mycompany.hibernate.GestionBDD.selectQuery(Unknown
> Source) 
>         at com.mycompany.middleware.CDataFromBDD.getListDomaine(Unknown
> Source) 
>         at com.mycompany.commun.PanelTreeView.<init>(Unknown Source) 
>         at com.mycompany.HomePage.initPanels(Unknown Source) 
>         at com.mycompany.HomePage.<init>(Unknown Source) 
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method) 
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorA
> ccessorImpl.java:39) 
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCons
> tructorAccessorImpl.java:27) 
>         at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513) 
>         at
> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.
> java:149) 
>         at
> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.
> java:58) 
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget
> .newPage(BookmarkablePageRequestTarget.java:262) 
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget
> .getPage(BookmarkablePageRequestTarget.java:283) 
>         at
> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget
> .processEvents(BookmarkablePageRequestTarget.java:210) 
>         at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab
> stractRequestCycleProcessor.java:91) 
>         at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java
> :1166) 
>         at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243) 
>         at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1331) 
>         at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
>
>         at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:363
> ) 
>         at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:
> 194) 
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:235) 
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:206) 
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:233) 
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:175) 
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :128) 
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :102) 
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:109) 
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
> 86) 
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:84
> 4) 
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
> Http11Protocol.java:583) 
>         at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) 
>         at java.lang.Thread.run(Thread.java:619) 
> Caused by: java.lang.NullPointerException 
>         at
> sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507) 
>         at
> sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476) 
>         at
> sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307) 
>         at java.sql.DriverManager.getDriver(DriverManager.java:253) 
>         at
> org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSo
> urce.java:1143) 
>
> The log shows that it tries to load the datasource, and at the end of
> the exception, we have this : 
> at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507) 
> and not com.mysql.jdbc.Driver. 
>
> I have put the jdbc driver in $CATALINA_HOME/lib/.. 
>
> My researches on the net, don't help my to solve the problem, so if you
> can help me thank you in advance :).
>
>  
>
>
>
>  
>
>
>
>
>
>
>
> This message contains information that may be privileged or confidential and is the property
of the Capgemini Group. It is 
> intended only for the person to whom it is addressed. If you are not the intended recipient,
you are not authorized to 
> read, print, retain, copy, disseminate, distribute, or use this message or any part thereof.
If you receive this message 
> in error, please notify the sender immediately and delete all copies of this message.
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message