aspose file tools*
The moose likes JBoss/WildFly and the fly likes Could not create connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Could not create connection" Watch "Could not create connection" New topic
Author

Could not create connection

Venkatesh Alapati
Greenhorn

Joined: Jul 22, 2011
Posts: 1
I am literally for this.

I placed db2java.zip under jboss-lib folder. and here is my ds-file details

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- See http://www.jboss.org/community/wiki/Multiple1PC for information about local-tx-datasource -->
<!-- $Id: db2-ds.xml 88948 2009-05-15 14:09:08Z jesper.pedersen $ -->


<datasources>
<local-tx-datasource>
<jndi-name>jdbc/myDataSource</jndi-name>
<connection-url>jdbc:db2://clrud.kemp.com:1985/HDOPDCD</connection-url>
<driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>
<user-name>db2ksd</user-name>
<password>db2ksd</password>
<min-pool-size>5</min-pool-size>
<metadata>
<type-mapping>DB2</type-mapping>
</metadata>
</local-tx-datasource>
<track-statements>false</track-statements>
</datasources>

here is my jboss-web.xml

<jboss-web>
<resource-ref>
<res-ref-name>jdbc/myDataSource</res-ref-name>
<jndi-name>java:jdbc/myDataSource</jndi-name>
<res-type>javax.sql.DataSource</res-type>
</resource-ref>
</jboss-web>
---------------------------------------------web.xml---------------------------------
Here is my web.xml resource-ref

<resource-ref>
<res-ref-name>jdbc/myDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
---------------------------------------------web.xml---------------------------------

DB Code for fetching connection.

InitialContext ic = new InitialContext();
dataSource = (DataSource) ic.lookup("java:comp/env/jdbc/myDataSource);
conn= dataSource.getConnection();
System.out.println(" DataSource NAME in try using JNDI:"+dataSource);


I am getting the below exception.
2011-07-22 16:50:27,950 INFO [STDOUT] DataSource NAME in try using JNDI: org.jboss.resource.adapter.jdbc.WrapperDataSource@16becfe
2011-07-22 16:50:27,950 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Wrong driver class for this connection URL)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:190)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:619)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:264)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:575)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:347)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:330)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:402)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:849)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89)
at com.dcx.restricted.intnl.kdwebrep.DBConnectionManager.getConnection(DBConnectionManager.java:199)
at com.dcx.restricted.intnl.kdwebrep.accSecurity.getConnection(accSecurity.java:155)
at com.dcx.restricted.intnl.kdwebrep.accSecurity.getAllAccess(accSecurity.java:49)
at org.apache.jsp.jsp.restricted.intnl.kdwebrep.KDIMS_jsp._jspService(KDIMS_jsp.java:427)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
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:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
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:446)
at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.resource.JBossResourceException: Wrong driver class for this connection URL
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:174)

Can someone help me what could be possible reason for this exception..
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

I don't use DB2 so I don't know what the connection URL should look like, but this error means that the BD2 JDBC driver didn't like the connection URL you specified. Go back to the DB2 JDBC driver documentation and figure out what the connection URL should be.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Could not create connection