Problem Connecting to Tigase server when launching in Debug

13 posts / 0 new
Last post
Anonymous
Problem Connecting to Tigase server when launching in Debug

ConfiguratorAbstract.setProperties() SEVERE: Can't initialize auth default repository: tigase.db.DBInitException: Problem initializing jdbc connection: jdbc:derby:tigase-derbydb;create=true
at tigase.db.jdbc.JDBCRepository.initRepository(JDBCRepository.java:699)
at tigase.db.RepositoryFactory.getAuthRepository(RepositoryFactory.java:167)
at tigase.conf.ConfiguratorAbstract.addAuthRepo(ConfiguratorAbstract.java:828)
at tigase.conf.ConfiguratorAbstract.setProperties(ConfiguratorAbstract.java:714)
at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:811)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:195)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:1)
at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java:127)
at tigase.server.MessageRouter.addRegistrator(MessageRouter.java:151)
at tigase.server.MessageRouter.setConfig(MessageRouter.java:565)
at tigase.server.MessageRouter.setProperties(MessageRouter.java:607)
at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:811)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:195)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:1)
at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java:127)
at tigase.server.MessageRouter.addRegistrator(MessageRouter.java:151)
at tigase.server.MessageRouter.setConfig(MessageRouter.java:565)
at tigase.server.XMPPServer.main(XMPPServer.java:135)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:derby:tigase-derbydb;create=true
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at tigase.db.jdbc.DataRepositoryImpl.initRepo(DataRepositoryImpl.java:298)
at tigase.db.jdbc.DataRepositoryImpl.initRepository(DataRepositoryImpl.java:200)
at tigase.db.RepositoryFactory.getDataRepository(RepositoryFactory.java:215)
at tigase.db.jdbc.JDBCRepository.initRepository(JDBCRepository.java:666)
... 17 more

Application: 

The error says:
No suitable driver found for jdbc:derby:tigase-derbydb;create=true
You need a derby db driver in your libs directory.

Anonymous

I have setup tigase source code in eclipse as defined in dev guide and setting tigase in eclipse to run in debug. Project tigase-server contains libs folder which has all derby, groovy, mysql and postgresql jars. Server compiles without any error/warnings but when I run it debug mode it throws above mentioned errors/exceptions.
Are there any extra steps required for this to work?
Thanks

Shawn Clark

Are you using maven to setup the dependencies between the two project in Eclipse?

How do you start the Tigase? Are you trying to run it within IDE? I personally do not use Eclipse, I use NetBeans right now. Regardless, I never run Tigase form within IDE so I cannot help you too much with IDE settings for running Tigase. I am pretty sure that the Tigase cannot find derby library.
There are actually two elements required for it to work properly:

  1. Derby library in the CLASSPATH
  2. JDBC driver setting via system property like this:
    -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver
    

I guess you missed one or another element in your configuration.

Anonymous

Yeh, I use maven.

Anonymous

@Shawn, Yeh I use maven

@Artur
-Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver
In eclipse I already set this as vm argument in debug configurations
Derby library exists in tigase-server/libs folder, but I don't know how to add /libs to CLASSPATH

I do not know Eclipse that well so I cannot tell you but I guess there must be some setting in Eclipse to setup CLASSPATH for running application under eclipse.
Most likely the Tigase libs/ folder is not used under Eclipse.

Shawn Clark

Having the jar file within the lib folder has no relevance when working with a maven project in Eclipse.

If you were following the comment that you linked then you will have to add a derby jdbc connector library to your tigase-local project. For example... in my case I use mysql but my pom.xml in my tigase-local maven project has:

tigase
tigase-server
5.0.4

mysql
mysql-connector-java
5.1.12

org.slf4j
slf4j-nop
1.5.11

tariq

Thanks Shawn Clark

Your hint really helps for proceeding further... now the next exception which i am getting is

ConfiguratorAbstract.setProperties() SEVERE: Can't initialize user default repository: tigase.db.DBInitException: Problem initializing jdbc connection: jdbc:derby:F:\Tigase Server\tigase-server\tigase-derbydb
at tigase.db.jdbc.JDBCRepository.initRepository(JDBCRepository.java:699)
at tigase.db.RepositoryFactory.getUserRepository(RepositoryFactory.java:318)
at tigase.conf.ConfiguratorAbstract.addUserRepo(ConfiguratorAbstract.java:861)
at tigase.conf.ConfiguratorAbstract.setProperties(ConfiguratorAbstract.java:696)
at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:811)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:195)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:75)
at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java:127)
at tigase.server.MessageRouter.addRegistrator(MessageRouter.java:151)
at tigase.server.MessageRouter.setConfig(MessageRouter.java:565)
at tigase.server.XMPPServer.main(XMPPServer.java:135)
Caused by: java.sql.SQLSyntaxErrorException: 'TIGGETDBPROPERTY' is not recognized as a function or procedure.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeQuery(Unknown Source)
at tigase.db.jdbc.JDBCRepository.checkDBSchema(JDBCRepository.java:1067)
at tigase.db.jdbc.JDBCRepository.initRepository(JDBCRepository.java:667)

Now connection in created successfully but "'TIGGETDBPROPERTY' is not recognized as a function or procedure." error is here...

Anonymous

@Shawn
Thanks for your reply.
I am newbie to maven, I would appreciate If you elaborate more to setup tigase-local for dependencies OR it would be great if your share your tigase-local project.

Tigase tries to connect to a real database at location F:\Tigase Server\tigase-server\tigase-derbydb. Apparently the database does not exist. You have to create one. There are 2 ways: one is to run the Tigase installer which should create a database for you automatically. You can use the database for your tests.
Alternatively you can create the database manually, there are scripts to help you with this. Follow instructions in this guide to set this up.

tariq

Thanks Artur.

Yes the problem was due to unavailability of DB at the path. I have created that manually just by updating the create DB script for windows as I am running the server on Windows.

set CLASSPATH=DERBY_LIBS_PATH\derby.jar;DERBY_LIBS_PATH\derbytools.jar;TIGASE_SNAPSHOT_PATH\tigase-server-5.1.0-SNAPSHOT.jar;

java -Dij.protocol=jdbc:derby: -Dij.database="DBPATH\NAME\;create=true" -Dderby.system.home="ScriptsDIR" org.apache.derby.tools.ij "DB_SCRIPT_PATH\derby-schema-4.sql"
java -Dij.protocol=jdbc:derby: -Dij.database=DBPATH\NAME\ -Dderby.system.home="ScriptsDIR" org.apache.derby.tools.ij "DB_SCRIPT_PATH\derby-schema-4-sp.schema"
java -Dij.protocol=jdbc:derby: -Dij.database=DBPATH\NAME\ -Dderby.system.home="ScriptsDIR" org.apache.derby.tools.ij "DB_SCRIPT_PATH\derby-schema-4-props.sql"

After this I am able to run the server withing netbeans IDE without "pubsub" and "muc". Now I want to add these modules in my repository so that I can debug pubsub features etc...

Thanks everybody for your help and quick replies.