Can't initialize auth default repository

11 posts / 0 new
Last post
Anonymous
Can't initialize auth default repository

I installed the latest version of Tigase, its database is mysql. I want to use Tigase to authenticate my users. I currently tested on my Local server. I have a database (using mysql), it has an encrypted password. How do I have to configure in order to let my users (in my database) login in and chat with each other on Tigase Server? I have already followed the instructions here but encountered some errors:
My tigase.log.0

2011-03-15 15:39:44 DataRepositoryImpl.initRepository() INFO: Initialized database connection: jdbc:mysql://localhost/hellochao?user=admin&password=adminadmin
2011-03-15 15:39:44 TigaseCustomAuth.getParamWithDef() CONFIG: Custom query loaded for 'init-db-query': 'update tig_users set online_status = 0'
2011-03-15 15:39:44 TigaseCustomAuth.getParamWithDef() CONFIG: Default query loaded for 'add-user-query': '{ call TigAddUserPlainPw(?, ?) }'
2011-03-15 15:39:44 ConfiguratorAbstract.setProperties() SEVERE: Can't initialize auth default repository:
tigase.db.DBInitException: Problem initializing jdbc connection: jdbc:mysql://localhost/hellochao?user=admin&password=adminadmin
at tigase.db.jdbc.TigaseCustomAuth.initRepository(TigaseCustomAuth.java)
at tigase.db.RepositoryFactory.getAuthRepository(RepositoryFactory.java)
at tigase.conf.ConfiguratorAbstract.addAuthRepo(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.setProperties(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java)
at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java)
at tigase.server.MessageRouter.addRegistrator(MessageRouter.java)
at tigase.server.MessageRouter.setConfig(MessageRouter.java)
at tigase.server.XMPPServer.main(XMPPServer.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java)
at java.lang.Thread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION TigAddUserPlainPw does not exist
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 com.mysql.jdbc.Util.handleNewInstance(Util.java)
at com.mysql.jdbc.Util.getInstance(Util.java)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java)
at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java)
at com.mysql.jdbc.DatabaseMetaData.getProcedureOrFunctionColumns(DatabaseMetaData.java)
at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java)
at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java)
at com.mysql.jdbc.CallableStatement.(CallableStatement.java)
at com.mysql.jdbc.JDBC4CallableStatement.(JDBC4CallableStatement.java)
at sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java)
at com.mysql.jdbc.CallableStatement.getInstance(CallableStatement.java)
at com.mysql.jdbc.ConnectionImpl.parseCallableStatement(ConnectionImpl.java)
at com.mysql.jdbc.ConnectionImpl.prepareCall(ConnectionImpl.java)
at com.mysql.jdbc.ConnectionImpl.prepareCall(ConnectionImpl.java)
at tigase.db.jdbc.DataRepositoryImpl.prepareQuery(DataRepositoryImpl.java)
at tigase.db.jdbc.DataRepositoryImpl.initPreparedStatement(DataRepositoryImpl.java)
at tigase.db.DataRepositoryPool.initPreparedStatement(DataRepositoryPool.java)
at tigase.db.jdbc.TigaseCustomAuth.initRepository(TigaseCustomAuth.java)
at tigase.db.RepositoryFactory.getAuthRepository(RepositoryFactory.java)
at tigase.conf.ConfiguratorAbstract.addAuthRepo(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.setProperties(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java)
at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java)
at tigase.server.MessageRouter.addRegistrator(MessageRouter.java)
at tigase.server.MessageRouter.setConfig(MessageRouter.java)
at tigase.server.XMPPServer.main(XMPPServer.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java)
at java.lang.Thread.run(Unknown Source)

My init.properties:

--cluster-mode = true
config-type = --gen-config-all
--cluster-nodes = Alessandro-PC
--debug = server,xmpp.impl,cluster
--user-db = mysql
--admins = admin@127.0.0.1
--user-db-uri = jdbc:mysql://localhost/tigasedb?user=tigase&password=tigase12&autoCreateUser=true
--auth-db = tigase-custom
--auth-db-uri = jdbc:mysql://localhost/hellochao?user=admin&password=adminadmin
--virt-hosts = 127.0.0.1
--comp-class-2 = tigase.pubsub.PubSubClusterComponent
--comp-name-2 = pubsub
--comp-class-1 = tigase.muc.MUCComponent
--comp-name-1 = muc
--sm-plugins = +jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,+basic-filter,+domain-filter,+pep,-zlib
basic-conf/auth-repo-params/conn-valid-query=select 1
basic-conf/auth-repo-params/init-db-query=update tig_users set online_status = 0
basic-conf/auth-repo-params/user-login-query={ call TigUserLoginPlainPw(?, ?) }
basic-conf/auth-repo-params/user-logout-query=update tig_users, set online_status = online_status - 1 where user_id = ?
basic-conf/auth-repo-params/get-password-query=select user_pw from tig_users where user_id = ?
basic-conf/auth-repo-params/non-sasl-mechs=password

Thank any for help.

The database error says: "FUNCTION TigAddUserPlainPw does not exist". Apparently the server tries to initialize such function/procedure (which is a default procedure for creating user accounts) but it is not defined in your database.
You have to either implement this procedure in your database or change configuration in the init.properties file to use a different query for account creation in db.

Alessandro

I implemented procedure “TigAddUserPlainPw” in my database. I used "SHOW PROCEDURE STATUS" statement and have seen procedure “TigAddUserPlainPw” already exists in my database and database of tigase, but errors above still appeared on log. Please tell me how to overcome this situation?

When I install tigase-server-5.1.0-b2512-beta1.jar package, step 20 have an error: "Adding XMPP admin accounts: Error initializing DB".

In such a case, I think you added the stored procedure and it is available, however it may not work correctly. It may either have incorrect set of parameters or maybe it throws an error when executed.
Try to run it manually from the MySQL shell like this:

call TigAddUserPlainPw('user_id@example.com', 'password');
Alessandro

I excuted "call TigAddUserPlainPw('user_id@example.com', 'password')" statement on my database and database tigase. It run ok. Errors above still appeared on log.

Hm, in such a case I do not really know why it is not working in your installation. For some reason Tigase can't see the procedure or cannot use it. Maybe this is a permission problem? Are you certain you now have the same exact error? Maybe it looks similar but the actual error is different?

Alessandro

I tried reinstalling the package "tigase-server-5.1.0-beta2-b2555.jar", please have a look at my “init.properties” file. When I logged on Tigase server (use user which have in my database), I encountered a few problems:
My init.properties:

--cluster-mode = true
config-type = --gen-config-all
--cluster-nodes = 127.0.0.1
--debug = server,xmpp.impl,cluster
--user-db = mysql
--admins = admin@127.0.0.1
--user-db-uri = jdbc:mysql://localhost/tigasedb?user=tigase&password=tigase12&autoCreateUser=true
--auth-db = tigase-custom
--auth-db-uri = jdbc:mysql://localhost/dict?user=dict1&password=dict2
--virt-hosts = 127.0.0.1
--comp-class-2 = tigase.pubsub.PubSubClusterComponent
--comp-name-2 = pubsub
--comp-class-1 = tigase.muc.MUCComponent
--comp-name-1 = muc
--sm-plugins = +jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,+basic-filter,+domain-filter,+pep,-zlib
basic-conf/auth-repo-params/conn-valid-query=select 1
basic-conf/auth-repo-params/init-db-query=update tig_users set online_status = 0
basic-conf/auth-repo-params/user-login-query=select user_id from tig_users where (user_id = ?) AND (user_pw = ?)
basic-conf/auth-repo-params/add-user-query=insert into tig_users (user_id, user_pw) values (?, ?)
basic-conf/auth-repo-params/del-user-query=delete from tig_users where user_id = ?
basic-conf/auth-repo-params/update-password-query=update tig_users set user_pw = ? where user_id = ?
basic-conf/auth-repo-params/user-logout-query=update tig_users, set online_status = online_status - 1 where user_id = ?
basic-conf/auth-repo-params/get-password-query=select user_pw from tig_users where user_id = ?
basic-conf/auth-repo-params/users-count-query=select count(*) from tig_users
basic-conf/auth-repo-params/non-sasl-mechs=password,digest

Error 1: in my log file: there was an message – told me that “The system cannot find the file specified”, a file called “bosh-extra-haders.txt” in “etc” folder, but I could not find it there.

ConnectionManager$ConnectionListenerImpl.accept() FINEST: Accept called for service: null@null
BoshIOService.() WARNING: Problem reading Bosh extra headers file: etc/bosh-extra-haders.txt
java.io.FileNotFoundException: etc\bosh-extra-haders.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileReader.(Unknown Source)
at tigase.server.bosh.BoshIOService.(BoshIOService.java)
at tigase.server.bosh.BoshConnectionManager.getXMPPIOServiceInstance(BoshConnectionManager.java)
at tigase.server.bosh.BoshConnectionManager.getXMPPIOServiceInstance(BoshConnectionManager.java)
at tigase.server.ConnectionManager$ConnectionListenerImpl.accept(ConnectionManager.java)
at tigase.net.ConnectionOpenThread.run(ConnectionOpenThread.java)
at java.lang.Thread.run(Unknown Source)

Error 2: When I used this command “call TigAddUserPlainPw('user_id@example.com', '123456');”, this procedure - TigAddUserPlainPw - uses password as plain text, but in my database, it was encrypted. So, I could not log on Tigase server by using ‘123456’ as password, I had to encrypt this password first, after that, I logged on successfully. Could you please tell me how to config in order to use plain password (such as ‘123456’) to log on.
Thanks for your consideration

Alessandro

I connected to the tigase server use my database on localhost, but when I change "localhost" to "my IP address" in database connect, I can not connect to tigase server use my database again. I should configure how to other computers can connect to the server tigase use my database.

My init.properties:(my IP address is "192.168.1.20")

--cluster-mode = false
config-type = --gen-config-def
--cluster-nodes = 127.0.0.1
--debug = server
--user-db = mysql
--auth-db = tigase-custom
--admins = admin@127.0.0.1
--user-db-uri = jdbc:mysql://192.168.1.20/tigasedb?user=tigaseuser&password=tigasepass&autoCreateUser=true
--virt-hosts = 127.0.0.1
--comp-class-1 = tigase.muc.MUCComponent
--comp-name-1 = muc
--sm-plugins = +jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,+basic-filter,+domain-filter,+pep,-zlib
--auth-db-uri = jdbc:mysql://192.168.1.20/hlc?user=dict1&password=dict2
basic-conf/auth-repo-params/conn-valid-query=select 1
basic-conf/auth-repo-params/init-db-query=update tig_users set online_status = 0
basic-conf/auth-repo-params/user-login-query=select user_id from tig_users where (user_id = ?) AND (user_pw = ?)
basic-conf/auth-repo-params/add-user-query=insert into tig_users (user_id, user_pw) values (?, ?)
basic-conf/auth-repo-params/del-user-query=delete from tig_users where user_id = ?
basic-conf/auth-repo-params/update-password-query=update tig_users set user_pw = ? where user_id = ?
basic-conf/auth-repo-params/user-logout-query=update tig_users, set online_status = online_status - 1 where user_id = ?
basic-conf/auth-repo-params/get-password-query=select user_pw from tig_users where user_id = ?
basic-conf/auth-repo-params/users-count-query=select count(*) from tig_users
basic-conf/auth-repo-params/non-sasl-mechs=password

My tigase.log.0

ConnectionManager$ConnectionListenerImpl.accept() FINEST: Accept called for service: null@null
BoshIOService.() WARNING: Problem reading Bosh extra headers file: etc/bosh-extra-haders.txt
java.io.FileNotFoundException: etc\bosh-extra-haders.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileReader.(Unknown Source)
at tigase.server.bosh.BoshIOService.(BoshIOService.java)
at tigase.server.bosh.BoshConnectionManager.getXMPPIOServiceInstance(BoshConnectionManager.java)
at tigase.server.bosh.BoshConnectionManager.getXMPPIOServiceInstance(BoshConnectionManager.java)
at tigase.server.ConnectionManager$ConnectionListenerImpl.accept(ConnectionManager.java)
at tigase.net.ConnectionOpenThread.run(ConnectionOpenThread.java)
at java.lang.Thread.run(Unknown Source)
ConnectionManager.serviceStarted() FINER: [[bosh]] Connection started: 127.0.0.1_5280_127.0.0.1_51313, type: accept, Socket: Socket[addr=/127.0.0.1,port=51313,localport=5280]

Alessandro

I connected to the tigase server use my database on localhost, but when I change "localhost" to "my IP address" in database connect, I can not connect to tigase server use my database again. I should configure how to other computers can connect to the server tigase use my database.

My init.properties:(my IP address is "192.168.1.20")

--cluster-mode = false
config-type = --gen-config-def
--cluster-nodes = 127.0.0.1
--debug = server
--user-db = mysql
--auth-db = tigase-custom
--admins = admin@127.0.0.1
--user-db-uri = jdbc:mysql://192.168.1.20/tigasedb?user=tigaseuser&password=tigasepass&autoCreateUser=true
--virt-hosts = 127.0.0.1
--comp-class-1 = tigase.muc.MUCComponent
--comp-name-1 = muc
--sm-plugins = +jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,+basic-filter,+domain-filter,+pep,-zlib
--auth-db-uri = jdbc:mysql://192.168.1.20/hlc?user=dict1&password=dict2
basic-conf/auth-repo-params/conn-valid-query=select 1
basic-conf/auth-repo-params/init-db-query=update tig_users set online_status = 0
basic-conf/auth-repo-params/user-login-query=select user_id from tig_users where (user_id = ?) AND (user_pw = ?)
basic-conf/auth-repo-params/add-user-query=insert into tig_users (user_id, user_pw) values (?, ?)
basic-conf/auth-repo-params/del-user-query=delete from tig_users where user_id = ?
basic-conf/auth-repo-params/update-password-query=update tig_users set user_pw = ? where user_id = ?
basic-conf/auth-repo-params/user-logout-query=update tig_users, set online_status = online_status - 1 where user_id = ?
basic-conf/auth-repo-params/get-password-query=select user_pw from tig_users where user_id = ?
basic-conf/auth-repo-params/users-count-query=select count(*) from tig_users
basic-conf/auth-repo-params/non-sasl-mechs=password

My tigase.log.0

ConnectionManager$ConnectionListenerImpl.accept() FINEST: Accept called for service: null@null
BoshIOService.() WARNING: Problem reading Bosh extra headers file: etc/bosh-extra-haders.txt
java.io.FileNotFoundException: etc\bosh-extra-haders.txt (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileReader.(Unknown Source)
at tigase.server.bosh.BoshIOService.(BoshIOService.java)
at tigase.server.bosh.BoshConnectionManager.getXMPPIOServiceInstance(BoshConnectionManager.java)
at tigase.server.bosh.BoshConnectionManager.getXMPPIOServiceInstance(BoshConnectionManager.java)
at tigase.server.ConnectionManager$ConnectionListenerImpl.accept(ConnectionManager.java)
at tigase.net.ConnectionOpenThread.run(ConnectionOpenThread.java)
at java.lang.Thread.run(Unknown Source)
ConnectionManager.serviceStarted() FINER: [[bosh]] Connection started: 127.0.0.1_5280_127.0.0.1_51313, type: accept, Socket: Socket[addr=/127.0.0.1,port=51313,localport=5280]

Thank any for help

Mentioned exception with missing 'etc/bosh-extra-haders.txt' has nothing to to with the database (and at the moment, until it go to the release pack, you can obtain such file from our svn). If you have no other error/exception in the log file then there is no indication of the problem with the database connection.

Why don't use default server configuration and set your own SQL queries instead? I am pretty sure this is the source of your problems. Try with default settings first and once you get it working try to modify parameters you need and then you will know what and why is not working.