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

ClassNotFoundException

srinivas sv
Greenhorn

Joined: Oct 04, 2003
Posts: 13
Hi,

I am doing a simple entity bean example program using JBOSS. I am getting class not found exception though I have put the driver mysql-connector-java-3.1.8a.zip file into the C:\jboss-3.2.3\server\default\lib directory and mysql-ds.xml in the C:\jboss-3.2.3\server\default\deploy. I am not using standardjbosscmp-jdbc.xml file, is this mandatory file.

mysql-ds.xml
<datasources>
<local-tx-datasource>
<jndi-name>MySqlDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/svdatabase
</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>svuser</user-name>
<password>svpassword</password>
</local-tx-datasource>
</datasources>

jbosscmp-jdbc.xml
<jbosscmp-jdbc>
<defaults>
<datasource>java:/MySqlDS</datasource>
<datasource-mapping>mySQL</datasource-mapping>
<create-table>false</create-table>
<remove-table>false</remove-table>
<pk-constraint>true</pk-constraint>
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
</defaults>
<enterprise-beans>
<entity>
<ejb-name>Employee</ejb-name>
<table-name>svemp</table-name>
<cmp-field>
<field-name>EmployeeID</field-name>
<column-name>empId</column-name>
<not-null/>
</cmp-field>
<cmp-field>
<field-name>EmployeeName</field-name>
<column-name>empName</column-name>
<not-null/>
</cmp-field>
<cmp-field>
<field-name>EmployeeSalary</field-name>
<column-name>empSal</column-name>
<not-null/>
</cmp-field>
</entity>
</enterprise-beans>
</jbosscmp-jdbc>

The exception is
2005-05-13 09:36:31,678 INFO [org.jboss.deployment.MainDeployer] Starting deployment of package: file:/C:/jboss-3.2.3/server/default/deploy/Employee.ear
2005-05-13 09:36:31,693 INFO [org.jboss.deployment.EARDeployer] Init J2EE application: file:/C:/jboss-3.2.3/server/default/deploy/Employee.ear
2005-05-13 09:36:32,271 INFO [org.jboss.ejb.EjbModule] Deploying Employee
2005-05-13 09:36:32,771 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection:
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: No ClassLoaders found for: com.mysql.jdbc.Driver))
at

Thanks in Advance.
Heonkoo Lee
Ranch Hand

Joined: Feb 10, 2005
Posts: 85
You need to put mysql jdbc driver jar file, not zip file.

And you already have jbosscmp-jdbc.xml which will be used to deploy your beans, instead of standardjboss-cmp.xml in config directory.
[ May 17, 2005: Message edited by: Heonkoo Lee ]
srinivas sv
Greenhorn

Joined: Oct 04, 2003
Posts: 13
i resolved the problem thanks alot
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
Care to tell us how you did that ? By uncompressing your zip file and then copy the jar file in it to your folder as suggested?

Just like to have a more complete closure to this topic so that anyone else who stumbles onto the same path as yours could benefit.



Originally posted by srinivas sv:
i resolved the problem thanks alot

[ June 04, 2005: Message edited by: Ken Loh ]
 
Consider Paul's rocket mass heater.
 
subject: ClassNotFoundException