Unable to load JDBC driver

I can’t connect to my custom mysql database. I have openfire 3.4.1

Here is an openfire.xml:

<?xml version=“1.0” encoding=“UTF-8”?>

<!–

This file stores bootstrap properties needed by Openfire.

Property names must be in the format: “prop.name.is.blah=value”

That will be stored as:

<prop>

<name>

<is>

<blah>value</blah>

</is>

</name>

</prop>

Most properties are stored in the Openfire database. A

property viewer and editor is included in the admin console.

–>

<!-- root element, all properties must be under this element -->

<jive>

<adminConsole>

<!-- Disable either port by setting the value to -1 -->

<port>9090</port>

<securePort>9091</securePort>

</adminConsole>

<admin>

<!-- Use this section to define users that will have admin privileges. Below,

you will find two ways to specify which users are admins. Admins will

have access to the admin console (only local users) and may have also access

to other functionalities like ad-hoc commands. -->

<!-- By default, only the user with the username “admin” can login

to the admin console. Alternatively, you can specify a comma-delimitted

list usernames that should be authorized to login to the admin console

by setting the <authorizedUsernames> field below. -->

<authorizedUsernames>warior, admin</authorizedUsernames>

<!-- Comma-delimitted list of bare JIDs. The JIDs may belong to local

or remote users. -->

<!-- <authorizedJIDs></authorizedJIDs> -->

</admin>

<locale>cs_CZ</locale>

<!-- Network settings. By default, Openfire will bind to all network interfaces.

Alternatively, you can specify a specific network interfaces that the server

will listen on. For example, 127.0.0.1. This setting is generally only useful

on multi-homed servers. -->

<!–

<network>

<interface></interface>

</network>

–>

<connectionProvider>

<className>org.jivesoftware.database.DefaultConnectionProvider</classN ame>

</connectionProvider>

<database>

<defaultProvider>

<driver>com.mysql.jdbc.Driver</driver>

<serverURL>jdbc:mysql://localhost:3306/XXXX</serverURL>

<username>root</username>

<password>XXXXX</password>

<minConnections>5</minConnections>

<maxConnections>15</maxConnections>

<connectionTimeout>1.0</connectionTimeout>

</defaultProvider>

</database>

<provider>

<auth>

<className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className& gt;

</auth>

<user>

<className>org.jivesoftware.openfire.user.JDBCUserProvider</className& gt;

</user>

</provider>

<jdbcAuthProvider>

<passwordSQL>SELECT password FROM accounts WHERE username=?</passwordSQL>

<passwordType>md5</passwordType>

</jdbcAuthProvider>

<jdbcUserProvider>

<loadUserSQL>SELECT name,email FROM accounts WHERE username=?</loadUserSQL>

<userCountSQL>SELECT COUNT(*) FROM accounts</userCountSQL>

<allUsersSQL>SELECT username FROM accounts</allUsersSQL>

<searchSQL>SELECT username FROM accounts WHERE</searchSQL>

<usernameField>username</usernameField>

<nameField>name</nameField>

<emailField>email</emailField>

</jdbcUserProvider>

<setup>true</setup>

</jive>

Here is the error:

2007.11.09 16:52:15 org.jivesoftware.openfire.auth.JDBCAuthProvider.(JDBCAuthProvider.java:81) Unable to load JDBC driver: null

java.lang.NullPointerException

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:164)

at org.jivesoftware.openfire.auth.JDBCAuthProvider.<init>(JDBCAuthProvider.j ava:78)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

at java.lang.Class.newInstance0(Class.java:350)

at java.lang.Class.newInstance(Class.java:303)

at org.jivesoftware.openfire.auth.AuthFactory.initProvider(AuthFactory.java:79)

at org.jivesoftware.openfire.auth.AuthFactory.<clinit>(AuthFactory.java:47)

at org.jivesoftware.openfire.handler.IQAuthHandler.<init>(IQAuthHandler.java :79)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

at java.lang.Class.newInstance0(Class.java:350)

at java.lang.Class.newInstance(Class.java:303)

at org.jivesoftware.openfire.XMPPServer.loadModule(XMPPServer.java:535)

at org.jivesoftware.openfire.XMPPServer.loadModules(XMPPServer.java:492)

at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:436)

at org.jivesoftware.openfire.XMPPServer.<init>(XMPPServer.java:155)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

at java.lang.Class.newInstance0(Class.java:350)

at java.lang.Class.newInstance(Class.java:303)

at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:105)

at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:50)

2007.11.09 16:52:16 org.jivesoftware.openfire.user.JDBCUserProvider.(JDBCUserProvider.java:86) Unable to load JDBC driver: null

java.lang.NullPointerException

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:164)

at org.jivesoftware.openfire.user.JDBCUserProvider.<init>(JDBCUserProvider.j ava:83)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

at java.lang.Class.newInstance0(Class.java:350)

at java.lang.Class.newInstance(Class.java:303)

at org.jivesoftware.openfire.user.UserManager.initProvider(UserManager.java:407)

at org.jivesoftware.openfire.user.UserManager.<init>(UserManager.java:75)

at org.jivesoftware.openfire.user.UserManager.<init>(UserManager.java:35)

at org.jivesoftware.openfire.user.UserManager$UserManagerContainer.<clinit>( UserManager.java:39)

at org.jivesoftware.openfire.user.UserManager.getInstance(UserManager.java:60)

at org.jivesoftware.openfire.XMPPServer.getUserManager(XMPPServer.java:1178)

at org.jivesoftware.openfire.spi.PresenceManagerImpl.initialize(PresenceManagerImp l.java:478)

at org.jivesoftware.openfire.XMPPServer.initModules(XMPPServer.java:548)

at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:438)

at org.jivesoftware.openfire.XMPPServer.<init>(XMPPServer.java:155)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:494)

at java.lang.Class.newInstance0(Class.java:350)

at java.lang.Class.newInstance(Class.java:303)

at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:105)

at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:50)

Hey Warior,

It seems that you forgot to add the following section to your openfire.xml file. Replace the values of the following sample with real ones.

<jdbcProvider>
       <driver>com.mysql.jdbc.Driver</driver>
       <connectionString>jdbc:mysql://localhost/dbname?user=username&password=secret</connectionString>
   </jdbcProvider>

Regards,

– Gato

thanks a lot

problem solved