eclipse - Solved: Integrate (embed) Openfire-Server into another Java-Project -


i cloned openfire-source git-repository (https://github.com/igniterealtime/openfire), set eclipse , did ant-build of it. openfire running prefered custom configuration , connected mysql-database, stores users, passwords... launching server eclipse works fine.

my goal start openfire "invisible" java-project (javafx in case). if possible, want merge both projects one.

the build openfire project added classpath of javafx-application.

1) first tried instantiate openfires startup.jar in existing javafx-stage-controller with

public void initialize(url url, resourcebundle rb) {      initlistener();     initcontents();      org.jivesoftware.openfire.starter.serverstarter.main(null);       ...  } 

like expected, vm-parameters missing:

slf4j: class path contains multiple slf4j bindings. slf4j: found binding in [jar:file:/c:/users/knoop/desktop/java/slf4j-1.7.13/slf4j-jdk14-1.7.13.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/c:/users/knoop/desktop/java/openfire_git/build/lib/ant/slf4j-simple.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: found binding in [jar:file:/c:/users/knoop/desktop/java/openfire_git/build/lib/dist/slf4j-log4j12.jar!/org/slf4j/impl/staticloggerbinder.class] slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. slf4j: actual binding of type [org.slf4j.impl.jdk14loggerfactory] jan 27, 2016 5:52:28 pm org.jivesoftware.util.log warn warnung: admin lib directory ../plugins/admin/webapp/web-inf/lib not exist. web admin console may not work. not locate home java.io.filenotfoundexception     @ org.jivesoftware.openfire.xmppserver.locateopenfire(xmppserver.java:827)     @ org.jivesoftware.openfire.xmppserver.initialize(xmppserver.java:304)     @ org.jivesoftware.openfire.xmppserver.start(xmppserver.java:440)     @ org.jivesoftware.openfire.xmppserver.<init>(xmppserver.java:169)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source)     @ java.lang.reflect.constructor.newinstance(unknown source)     @ java.lang.class.newinstance(unknown source)     @ org.jivesoftware.openfire.starter.serverstarter.start(serverstarter.java:105)     @ org.jivesoftware.openfire.starter.serverstarter.main(serverstarter.java:56)     @ org.server_fx.gui.controller.mainscreencontroller.initialize(mainscreencontroller.java:53)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.load(unknown source)     @ org.server_fx.gui.controller.gui_shared.loadfxmltostage(gui_shared.java:63)     @ org.server_fx.gui.fxml.manager.start(manager.java:24)     @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$163(unknown source)     @ com.sun.javafx.application.platformimpl.lambda$runandwait$176(unknown source)     @ com.sun.javafx.application.platformimpl.lambda$null$174(unknown source)     @ java.security.accesscontroller.doprivileged(native method)     @ com.sun.javafx.application.platformimpl.lambda$runlater$175(unknown source)     @ com.sun.glass.ui.invokelaterdispatcher$future.run(unknown source)     @ com.sun.glass.ui.win.winapplication._runloop(native method)     @ com.sun.glass.ui.win.winapplication.lambda$null$149(unknown source)     @ java.lang.thread.run(unknown source) jan 27, 2016 5:52:28 pm org.jivesoftware.openfire.xmppserver start schwerwiegend: null java.io.filenotfoundexception     @ org.jivesoftware.openfire.xmppserver.locateopenfire(xmppserver.java:827)     @ org.jivesoftware.openfire.xmppserver.initialize(xmppserver.java:304)     @ org.jivesoftware.openfire.xmppserver.start(xmppserver.java:440)     @ org.jivesoftware.openfire.xmppserver.<init>(xmppserver.java:169)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source)     @ java.lang.reflect.constructor.newinstance(unknown source)     @ java.lang.class.newinstance(unknown source)     @ org.jivesoftware.openfire.starter.serverstarter.start(serverstarter.java:105)     @ org.jivesoftware.openfire.starter.serverstarter.main(serverstarter.java:56)     @ org.server_fx.gui.controller.mainscreencontroller.initialize(mainscreencontroller.java:53)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.loadimpl(unknown source)     @ javafx.fxml.fxmlloader.load(unknown source)     @ org.server_fx.gui.controller.gui_shared.loadfxmltostage(gui_shared.java:63)     @ org.server_fx.gui.fxml.manager.start(manager.java:24)     @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$163(unknown source)     @ com.sun.javafx.application.platformimpl.lambda$runandwait$176(unknown source)     @ com.sun.javafx.application.platformimpl.lambda$null$174(unknown source)     @ java.security.accesscontroller.doprivileged(native method)     @ com.sun.javafx.application.platformimpl.lambda$runlater$175(unknown source)     @ com.sun.glass.ui.invokelaterdispatcher$future.run(unknown source)     @ com.sun.glass.ui.win.winapplication._runloop(native method)     @ com.sun.glass.ui.win.winapplication.lambda$null$149(unknown source)     @ java.lang.thread.run(unknown source)  jan 27, 2016 5:52:28 pm org.jivesoftware.util.localeutils getlocalizedstring schwerwiegend: can't find bundle base name openfire_i18n, locale de_de critical error! home directory has not been configured,  prevent application working correctly.  startup.error 

which results in missing openfire-home-directory.

2) openfire.bat contains specific parameters launching server (dopenfirehome="%openfire_home%").

so tried:

public void initialize(url url, resourcebundle rb) {      initlistener();     initcontents();      try {          process proc = runtime.getruntime().exec("java" -dopenfirehome=\"c:\\users\\knoop\\desktop\\java\\openfire_git\\target\\openfire\" -jar c:\\users\\knoop\\desktop\\java\\openfire_git\\target\\openfire\lib\startup.jar");      } catch (ioexception e) {   e.printstacktrace();    }      ...  } 

which results in nothing. no exception or else.

is there way instantiate openfire server java-project, or "invisibly" launch server in background correct launch parameters?

thanks in advance!

ok works now.

javafx-init:

    private void initcontents() {          system.setproperty("openfirehome", "c:/users/knoop/desktop/java/workspace/openfire/target/openfire");         system.setproperty("openfire.lib.dir", "c:/users/knoop/desktop/java/workspace/openfire/target/openfire/lib");          org.jivesoftware.openfire.starter.serverstarter.main(null);      } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -