Could you expain how to correctly embed tigase into java application?

3 posts / 0 new
Last post
Anonymous
Could you expain how to correctly embed tigase into java application?

I am running server like this:

public static void main(String[] args) {
try {
Configurator config = new Configurator();
config.setName("confa");
config.init(args);

MessageRouterIfc router = new MessageRouter();
router.setName(serverName);
router.setConfig(config);
router.start();

} catch (Exception e) {
System.err.println("");
e.printStackTrace();
System.exit(1);
}
}

Without any config specified. I just cannot get how to define config..
How i can config programmatically? I have this exception:

2012-04-24 23:01:41 SSLContextContainer.init() WARNING: There was a problem initializing SSL certificates.
java.lang.NullPointerException
at tigase.io.SSLContextContainer.init(SSLContextContainer.java:219)
at tigase.io.TLSUtil.configureSSLContext(TLSUtil.java:87)
at tigase.conf.ConfiguratorAbstract.setProperties(ConfiguratorAbstract.java:654)
at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:827)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:196)
at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:75)
at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java:127)
at tigase.server.MessageRouter.addRegistrator(MessageRouter.java:149)
at tigase.server.MessageRouter.setConfig(MessageRouter.java:562)

Could you suggest where i can read clear article with examples, how to configure tigase?

Application: 

The exception is thrown because server tries to load certificate files from (by default) "certs/" directory.

When it comes to configuration, in my opinion, an init.properties documentation would be the best place to start.
The bare minimum that you have to provide is

--admins=admin@domain
--virt-hosts=domain
--user-db=db_type
--user-db-uri=jdbc:db_type://…

I'm not sure what do you mean by "How i can config programmatically" but you can pass the configuration as an String array (each one in key=value manner according to the documentation) to the Configurator.

Anonymous

Hi,

I thin he want to start up his tigase server e.g. within his IDE (e.g. eclipse) and from there start and stop the server.

In order to do this he need to set the configuration programatically. Actually it looks like he might take in the configuration by the args (command line). How are they set? I am just curious.

But yes the problem looks like a certificate problem for sure.