-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: net.sf.hibernate.JDBCException: Cannot open connection
PostPosted: Tue Nov 02, 2004 12:25 am 
Newbie

Joined: Fri Oct 29, 2004 4:21 am
Posts: 4
Posted: Fri Oct 29, 2004 8:27 am Post subject: net.sf.hibernate.JDBCException: Cannot open connection

Hi All,

Iam getting the following error/eception while running my code
--------------------------------------------------------------------------
org.apache.jasper.JasperException: net.sf.hibernate.JDBCException: Cannot open connection

WARNING: Could not obtain connection metadata
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '
' for connect URL 'null'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:780)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:540)
at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnectio
n(DatasourceConnectionProvider.java:59)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.ja
va:73)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1
155)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.
java:789)
at com.edhand.example1.ConnectionFactory.<init>(Unknown Source)
at com.edhand.example1.ConnectionFactory.getInstance(Unknown Source)
at com.edhand.example1.ItemService.getItemList(Unknown Source)
at org.apache.jsp.pages.AddItem_jsp._jspService(AddItem_jsp.java:120)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:2
92)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp
atcher.java:704)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(Applica
tionDispatcher.java:474)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD
ispatcher.java:409)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis
patcher.java:312)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.
java:1069)
at org.apache.struts.action.RequestProcessor.processForwardConfig(Reques
tProcessor.java:455)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:148
2)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
ContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:16
0)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NullPointerException
at java.lang.String.regionMatches(String.java:950)
at com.microsoft.jdbc.base.BaseURLParser.parse(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.acceptsURL(Unknown Source)
at java.sql.DriverManager.getDriver(DriverManager.java:232)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:773)
... 52 more
Oct 29, 2004 11:58:37 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: false
Oct 29, 2004 11:58:37 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
Oct 29, 2004 11:58:37 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
Oct 29, 2004 11:58:37 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: echoing all SQL to stdout
Oct 29, 2004 11:58:37 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {no='N', true=1, yes='Y', false=0}
Oct 29, 2004 11:58:37 AM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
Oct 29, 2004 11:58:37 AM net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
Oct 29, 2004 11:58:37 AM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Oct 29, 2004 11:58:38 AM net.sf.hibernate.impl.SessionFactoryObjectFactory addIn
stance
INFO: Not binding factory to JNDI, no JNDI name configured
Oct 29, 2004 11:58:38 AM net.sf.hibernate.util.JDBCExceptionReporter logExceptio
ns
WARNING: SQL Error: 0, SQLState: null
Oct 29, 2004 11:58:38 AM net.sf.hibernate.util.JDBCExceptionReporter logExceptio
ns
SEVERE: Cannot create JDBC driver of class '' for connect URL 'null'
Oct 29, 2004 11:58:38 AM net.sf.hibernate.JDBCException <init>
SEVERE: Cannot open connection
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '
' for connect URL 'null'
--------------------------------------------------------------------------


I have done the following addition to my server .xml file (iam using tomcat 5.27)

--------------------------------------------------------------------------
<Context path="/quickstart" docBase="quickstart">
<Resource name="jdbc/quickstart" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/quickstart">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- DBCP database connection settings -->
<parameter>
<name>url</name>
<value>jdbc:microsoft:sqlserver://eip-in-a-box:1433;Database=TEST1</value>
</parameter>
<parameter>
<name>driverClassName</name><value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</parameter>
<parameter>
<name>username</name>
<value>test</value>
</parameter>
<parameter>
<name>password</name>
<value>test</value>
</parameter>
<!-- DBCP connection pooling options -->
<parameter>
<name>maxWait</name>
<value>3000</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>100</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>10</value>
</parameter>
</ResourceParams>
</Context>
--------------------------------------------------------------------------

I've added following lines to my web.xml
--------------------------------------------------------------------------
<resource-ref> <description>My Datasource</description>
<res-ref-name>jdbc/quickstart</res-ref-name> <res-type> javax.sql.DataSource</res-type>
<res-auth>Container</res-auth> </resource-ref>
--------------------------------------------------------------------------

My hibernate.properties file looks like this
--------------------------------------------------------------------------
hibernate.connection.datasource java:comp/env/jdbc/quickstart
hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect
--------------------------------------------------------------------------


Can any body suggest why am i getting such an error. The error says that URL and class are null . but i have mentioned all these properties inside the server.xml file.

please help!

thanks in advance
-Jim


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.