powered by Jive Software

Help, Problems with a custom database integration


#1

Hi,

I’m having problems while trying to integrate the Openfire with a already existing Oracle database. I’ve already readed all of the guides and they haven’t solved my problem yet. These are my openfire.xml and and error.log:

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>58458944,admin</authorizedUsernames>

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

or remote users. -->

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

</admin>

<locale>pt_BR</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>

<jdbcProvider>

<driver>oracle.jdbc.driver.OracleDriver</driver>

<connectionString>jdbc:oracle:thin:xxxx/xxxx@xxx.xxx.xxx.xxx:1521:xxx< /connectionString>

</jdbcProvider>

<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 nm_senha FROM salvadm.tb_aas_usuario WHERE cd_usuario=?</passwordSQL>

<passwordType>MD5</passwordType>

</jdbcAuthProvider>

<jdbcUserProvider>

<loadUserSQL>SELECT nm_usuario,nm_email FROM salvadm.tb_aas_usuario WHERE cd_usuario=?</loadUserSQL>

<userCountSQL>SELECT COUNT(*) FROM salvadm.tb_aas_usuario</userCountSQL>

<allUsersSQL>SELECT cd_usuario FROM salvadm.tb_aas_usuario</allUsersSQL>

<searchSQL>SELECT cd_usuario FROM salvadm.tb_aas_usuario WHERE</searchSQL>

<usernameField>cd_usuario</usernameField>

<nameField>nm_usuario</nameField>

<emailField>nm_email</emailField>

</jdbcUserProvider>

</database>

<setup>true</setup>

</jive>

error.log

2007.10.25 16:00:32 org.jivesoftware.database.ConnectionPool.(ConnectionPool.java:65) JDBC driver value is null.

2007.10.25 16:00:32 org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager. java:80) Warning: failed to create the connection provider specified by connectionProvider.className. Using the default pool.

java.lang.NullPointerException

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

at java.lang.Class.forName(Unknown Source)

at org.jivesoftware.util.ClassUtils.loadClass(ClassUtils.java:60)

at org.jivesoftware.util.ClassUtils.forName(ClassUtils.java:39)

at org.jivesoftware.database.ConnectionPool.<init>(ConnectionPool.java:68)

at org.jivesoftware.database.DefaultConnectionProvider.start(DefaultConnectionProv ider.java:83)

at org.jivesoftware.database.DbConnectionManager.setConnectionProvider(DbConnectio nManager.java:459)

at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager .java:77)

at org.jivesoftware.util.JiveProperties.loadProperties(JiveProperties.java:271)

at org.jivesoftware.util.JiveProperties.init(JiveProperties.java:70)

at org.jivesoftware.util.JiveProperties.<init>(JiveProperties.java:52)

at org.jivesoftware.util.JiveProperties.getInstance(JiveProperties.java:46)

at org.jivesoftware.util.JiveGlobals.getProperty(JiveGlobals.java:524)

at org.jivesoftware.openfire.XMPPServer.initialize(XMPPServer.java:286)

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

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

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

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

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

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

2007.10.25 16:00:32 org.jivesoftware.database.ConnectionPool.(ConnectionPool.java:65) JDBC driver value is null.

2007.10.25 16:00:32 org.jivesoftware.util.JiveProperties.loadProperties(JiveProperties.java:282)

java.lang.NullPointerException

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

at java.lang.Class.forName(Unknown Source)

at org.jivesoftware.util.ClassUtils.loadClass(ClassUtils.java:60)

at org.jivesoftware.util.ClassUtils.forName(ClassUtils.java:39)

at org.jivesoftware.database.ConnectionPool.<init>(ConnectionPool.java:68)

at org.jivesoftware.database.DefaultConnectionProvider.start(DefaultConnectionProv ider.java:83)

at org.jivesoftware.database.DbConnectionManager.setConnectionProvider(DbConnectio nManager.java:459)

at org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager .java:83)

at org.jivesoftware.util.JiveProperties.loadProperties(JiveProperties.java:271)

at org.jivesoftware.util.JiveProperties.init(JiveProperties.java:70)

at org.jivesoftware.util.JiveProperties.<init>(JiveProperties.java:52)

at org.jivesoftware.util.JiveProperties.getInstance(JiveProperties.java:46)

at org.jivesoftware.util.JiveGlobals.getProperty(JiveGlobals.java:524)

at org.jivesoftware.openfire.XMPPServer.initialize(XMPPServer.java:286)

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

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

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

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

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

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

2007.10.25 16:00:32 org.jivesoftware.database.DefaultConnectionProvider.getConnection(DefaultConnect ionProvider.java:68) Warning: DbConnectionDefaultPool.getConnection() was called before the internal pool has been initialized.

2007.10.25 16:00:32 org.jivesoftware.database.DbConnectionManager.getConnection(DbConnectionManager. java:95) WARNING: ConnectionManager.getConnection() failed to obtain a connection.

2007.10.25 16:00:32 org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:670) Database could not be accessed

java.lang.NullPointerException

at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:660)

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

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

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

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

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

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

2007.10.25 16:00:32 org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:421)

java.lang.IllegalArgumentException: java.lang.NullPointerException

at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:671)

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

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

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

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

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

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

Caused by: java.lang.NullPointerException

at org.jivesoftware.openfire.XMPPServer.verifyDataSource(XMPPServer.java:660)

… 10 more

I’ve already downloaded the oracle driver and it’s inside the “/op/openfire/lib” directory.


#2

Hi Antonio,

Did you put the Oracle drivers jar in the Openfire lib directory?

Thanks,

Ryan


#3

Hi Antonio,

“JDBC driver value is null” is the error message I did look at. Your configuration file seems to be wrong, the example mentions:

<jive>
   ...
   <jdbcProvider>
      <driver>...

while you did post

<jive>
   ...
   <database>
      <jdbcProvider>
         <driver>...

So removing should enable the JDBC driver.

LG


#4

I removed the <database> and </database> and still the same. :_|


#5

And yes, the ojdbc driver is inside /opt/openfire/lib


#6

Hi,

do you still have the openfire.xml file without the section for the auth provider?

I think that it looks like

<jive>
   ...
   <connectionProvider>
      <className>org.jivesoftware.database.DefaultConnectionProvider</className>
   </connectionProvider>
   <database>
      <defaultProvider>...

For me the XML file you did post looks like you are missing the database.defaultProvider which is used to connect to the Openfire database. This database is still needed, even if you get the user data from another database.

LG


#7

Hi

Thank you guys for your answer, but after a month of research I decided to change my course. I’ve configurated the Openfire using the the default tables and then I’ve made a trigger in SQL to replicate the users to the jive database. Now I can see the users and manage them, but i’m having a problem with the type of encryption that the openfire uses for the passwords. I’m using MD5 in my database, but the MD5 that the Openfire adds is, somehow, different from the other…

Thanks again for you help. =]


#8

I am having this same problem but mine is setup on a MySql database. here is my config file if anyone could help id appreciate it.

<!–

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>

<authorizedUsernames>admin</authorizedUsernames>

</admin>

<locale>en</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>

<jdbcProvider>

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

<connectionString>jdbc:mysql://localhost:3306/xxxx?user=xxxxxx&passwo rd=xxxxxxxxxx</connectionString>

</jdbcProvider>

</defaultProvider>

</database>

<setup>true</setup>

<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 jos_users WHERE username=?</passwordSQL>

<passwordType>md5</passwordType>

</jdbcAuthProvider>

<jdbcUserProvider>

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

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

<allUsersSQL>SELECT username FROM jos_users</allUsersSQL>

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

<usernameField>username</usernameField>

<nameField>name</nameField>

<emailField>email</emailField>

</jdbcUserProvider>

</jive>


#9

Hi,

could you please use the … tag around your xml file, so it will be better displayed.

And please post the file which is working and the code which you did add, for me it looks like jive.jdbcProvider.driver = null and that you should get a similar exception.

LG


#10

this is the current file.

{/code}


#11

This is the one that works for me but isnt a custom user setup.

{/code}


#12

Hi,

is there any reason why you did modify the stuff before ? You must leave the existing database entries there as they make sure that Openfire can connect to it’s database.

The external database is a second one, so you need to add lines to the configuration file which specify the driver, host, … again. Something like this should be fine:

<!-- Openfire database -->
<connectionProvider>
<className>org.jivesoftware.database.DefaultConnectionProvider</className>
</connectionProvider>
<database>
<defaultProvider>
<driver>com.mysql.jdbc.Driver</driver>
<serverURL>jdbc:mysql://localhost:3306/xxxxxx</serverURL>
<username>xxxxx</username>
<password>xxxxxx</password>
<minConnections>5</minConnections>
<maxConnections>15</maxConnections>
<connectionTimeout>1.0</connectionTimeout>
</defaultProvider>
</database> <!-- Database Connection Settings for external database -->
  <jdbcProvider>
    <driver>com.mysql.jdbc.Driver</driver>
    <connectionString>jdbc:mysql://localhost/dbname?user=username&amp;password=secret</connectionString>
  </jdbcProvider> <!-- Authentication and User Integration for external database -->
   <provider>
    <auth>
      <className>org.jivesoftware.openfire.auth.JDBCAuthProvider</className>
    </auth>
    <user>
      <className>org.jivesoftware.openfire.user.JDBCUserProvider</className>
    </user>
  </provider>
  <jdbcAuthProvider>
     <passwordSQL>SELECT password FROM user_account WHERE username=?</passwordSQL>
     <passwordType>plain</passwordType>
  </jdbcAuthProvider>
  <jdbcUserProvider>
     <loadUserSQL>SELECT name,email FROM myUser WHERE username=?</loadUserSQL>
     <userCountSQL>SELECT COUNT(*) FROM myUser</userCountSQL>
     <allUsersSQL>SELECT username FROM myUser</allUsersSQL>
     <searchSQL>SELECT username FROM myUser WHERE</searchSQL>
     <usernameField>username</usernameField>
     <nameField>name</nameField>
     <emailField>email</emailField>
  </jdbcUserProvider>

LG


#13

Yes the reason I did it that way was because I went by the Documentation Page on how to setup a custom Database, and it wasn’t explicit on whether to leave the exsisting database information in the config file and add to it or to replace the current one with a new one. So i figured since the tables for both my user base and the openfire database setup was within the same database it only needed one connection and not two. I will try this new setup as you have explained to me and will get back to you on the results. Thank you for your help and patience.


#14

Update: I updated my config file with the new settings and everything works great!! Thank you again for all your help.


#15

i know this post is like a century old but i hope that you can reply. i wanted to know if this second database will override the first one because i dont want to use 2 databases but i want to have an extended database and have my own schema on top of the openfire schema