This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes mysql connectivity with jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "mysql connectivity with jboss" Watch "mysql connectivity with jboss" New topic
Author

mysql connectivity with jboss

archie gall
Greenhorn

Joined: Dec 03, 2011
Posts: 4
Hi All,

I am working on one project for which i am using eclipse(helios) ,jboss(jboss-5.0.1-GA) as server and mysql(Microsoft SQL Server 2005) as database.
When i am trying to connect to database i am getting following error:

12:58:56,578 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc..........

i tried every possible alternative to solve this error.. replace hsql-ds.xml with mysql-ds.xml.

Please help on this.
Its very urgent.

Thanks in advance.

Waiting for your reply.
Reply soon

Regards,
Archie
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Could you post your datasource, or your url connection?

ps.: welcome to javaranch. [=


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
archie gall
Greenhorn

Joined: Dec 03, 2011
Posts: 4
Hi Hebert,

Thanks for replying.

Please find the below code of my "mysql-ds.xml":

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>DefaultDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/ProjectDB</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>sa</user-name>
<password>archana</password>
</local-tx-datasource>
</datasources>
archie gall
Greenhorn

Joined: Dec 03, 2011
Posts: 4
Hi,

This is my connection class. Please let me know if I am doing anything wrong in this class file.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19674
    
  18

Welcome to the Ranch, Archie!
Can you please UseCodeTags next time? See how much better your code looks with them.

archie gall wrote:12:58:56,578 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Failed to register driver for: com.mysql.jdbc.Driver; - nested throwable: (java.lang.ClassNotFoundException: com.mysql.jdbc..........

There is probably no error in your code. What this error says is that the MySQL driver is missing from the class path - that's the ClassNotFoundException you're seeing.

Its very urgent.
...
Reply soon

Please EaseUp. There is no such thing as urgent around here.

archie gall wrote:

Never ever ever ever do that. If an exception occurs you won't even know it, and you'll be asking yourself why things are going wrong. The least you should do is print the exception; not with System.out.println the way you are doing at other points but with e.printStackTrace(). This will not only show you the exception itself, but also the path leading up to it. This will help you find the cause.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
archie gall
Greenhorn

Joined: Dec 03, 2011
Posts: 4
But what can be the reason for getting following error:

Caused by: org.jboss.util.NestedSQLException: Could not create connection; - nested throwable:

this is the first time i using jboss and mysql....

so dont have much idea...
 
 
subject: mysql connectivity with jboss