You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Dubois, Fabien" <fa...@capgemini.com> on 2008/04/24 10:17:30 UTC

Datasource and Hibernate

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.

RE: Datasource and Hibernate

Posted by "Dubois, Fabien" <fa...@capgemini.com>.
Thank you for your help, I have modified my context.xml, like this :
<Context
	path="/appWicket-1.0" 
	docBase="appWicket-1.0"
	reloadable="true" 
	crossContext="true">
	<Resource
	  name="jdbc/hibernate"  
	  auth="Container"
	  type="javax.sql.DataSource"
	  description="DB Connection" 
	  driverClass="com.mysql.jdbc.Driver" 
	  validationQuery="select 1"
	  jdbcUrl="jdbc:mysql://localhost:3306/opensource"  
	  user="root" 
	  password="xxxx"/>
</Context>


In my web xml I have this : 
	<resource-ref>
        <description>Connection Pool</description>
        <res-ref-name>jdbc/hibernate</res-ref-name>
        <res-type>javax.sql.Datasource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>


And in my hibernate.cfg.xml : 

    	<property name="hibernate.connection.datasource">java:comp/env/jdbc/hibernate</property>
       
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.c3p0.max_size">5</property>
        <property name="hibernate.c3p0.min_size">3</property>
        <property name="hibernate.c3p0.timeout">1800</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.format_sql">true</property>
        <property name="hibernate.show_sql">true</property>

But unfortunately, I have the same error.

Thank you in advance for your help

-----Message d'origine-----
De : David Smith [mailto:dns4@cornell.edu] 
Envoyé : jeudi 24 avril 2008 13:04
À : Tomcat Users List
Objet : Re: Datasource and Hibernate

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








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


Re: Datasource and Hibernate

Posted by David Smith <dn...@cornell.edu>.
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


RE: Datasource and Hibernate

Posted by "Dubois, Fabien" <fa...@capgemini.com>.
It's working, thank you all for your help :)

-----Message d'origine-----
De : Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Envoyé : jeudi 24 avril 2008 14:32
À : Tomcat Users List
Objet : RE: Datasource and Hibernate

> From: Dubois, Fabien [mailto:fabien.dubois@capgemini.com] 
> Subject: Datasource 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" 

You must never, under any circumstances, specify a path attribute in the
conf/context.xml file.  The purpose of this context.xml is to supply
common attributes for all webapps, not a particular one.

You should be placing your webapp-specific elements and attributes in
your webapp's META-INF/context.xml file; when doing so, you must not use
a path attribute there either, since the path is derived from the name
of the webapp.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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








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


RE: Datasource and Hibernate

Posted by "Dubois, Fabien" <fa...@capgemini.com>.
I have backup the $CATALINA_HOME/CONF/context.xml of tomcat.

And deploy my contexte.xml in the repertory $CATALINA_HOME/webapps/myapp/META-INF/context.xml 
<?xml version='1.0' encoding='utf-8'?>
<Context
	reloadable="true" 
	crossContext="true">
	<Resource
	  name="jdbc/hibernate"  
	  auth="Container"
	  type="javax.sql.DataSource"
	  description="DB Connection" 
	  driverClass="com.mysql.jdbc.Driver" 
	  validationQuery="select 1"
	  jdbcUrl="jdbc:mysql://localhost:3306/opensource"  
	  user="root" 
	  password="xxxx"/>
</Context>


And I have the same error :( :

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(BasicDataSource.java:1150)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
	at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.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:1292)
	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.capgemini.HomePage.<init>(Unknown Source)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.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(AbstractRequestCycleProcessor.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(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.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:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
	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(BasicDataSource.java:1143)

-----Message d'origine-----
De : Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Envoyé : jeudi 24 avril 2008 14:32
À : Tomcat Users List
Objet : RE: Datasource and Hibernate

> From: Dubois, Fabien [mailto:fabien.dubois@capgemini.com] 
> Subject: Datasource 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" 

You must never, under any circumstances, specify a path attribute in the
conf/context.xml file.  The purpose of this context.xml is to supply
common attributes for all webapps, not a particular one.

You should be placing your webapp-specific elements and attributes in
your webapp's META-INF/context.xml file; when doing so, you must not use
a path attribute there either, since the path is derived from the name
of the webapp.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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








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


RE: Datasource and Hibernate

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dubois, Fabien [mailto:fabien.dubois@capgemini.com] 
> Subject: Datasource 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" 

You must never, under any circumstances, specify a path attribute in the
conf/context.xml file.  The purpose of this context.xml is to supply
common attributes for all webapps, not a particular one.

You should be placing your webapp-specific elements and attributes in
your webapp's META-INF/context.xml file; when doing so, you must not use
a path attribute there either, since the path is derived from the name
of the webapp.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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