在eclipse中搭建openfire
源码下载
官网下载地址:https://www.igniterealtime.org/downloads/source.jsp
github下载地址:https://github.com/igniterealtime/Openfire/releases
重命名配置文件
解压源码后目录如下图,将classpath、project、settings拷贝到文件根目录,并分别重命名为.classpath、.project、.settings,通过命令行重命名,例如mv classpath .classpath;下图分别为修改前和修改后
image.png
image.png
将openfire源码导入eclipse
image.pngimage.png
image.png image.png
运行openfirefire
image.pngimage.png
image.png
项目运行过程中常见问题
问题描述 1:
Could not locate home
java.io.FileNotFoundException
at org.jivesoftware.openfire.XMPPServer.locateOpenfire(XMPPServer.java:795)
at org.jivesoftware.openfire.XMPPServer.initialize(XMPPServer.java:296)
at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:415)
at org.jivesoftware.openfire.XMPPServer.<init>(XMPPServer.java:baojiandeyouxiang@163.com)
解决办法:
用红色内容替换上一行的黑色代码,如下,
// If we still don't have home, let's assume this is standalone
// and just look for home in a standard sub-dir location and verify
// by looking for the config file
if (openfireHome == null) {
try {
openfireHome = verifyHome("..", jiveConfigName).getCanonicalFile();
openfireHome = verifyHome("/Users/swordwong/Documents/workspace/openfire/target/openfire", jiveConfigName).getCanonicalFile();
} catch (IOException ie) {
// Ignore.
}
}
问题描述 2:12:01:39,288 ERROR AdminConsole:222 - Failed to load admin-sidebar.xml file from Openfire classes - admin console will not work correctly.
java.lang.NullPointerException
at org.jivesoftware.admin.AdminConsole.getAppName(AdminConsole.java:111)
image.png
问题2原因:
编译后的class下面没有admin-sidebar.xml文件
问题2解决办法:
将src目录下的resource下面的jar文件夹添加到 build path
image.png
问题3描述:
12:08:25,271 INFO PluginManager:472 - Successfully loaded plugin 'admin'.
12:08:40,854 ERROR LocaleUtils:377 - Can't find bundle for base name openfire_i18n, locale en
java.util.MissingResourceException: Can't find bundle for base name openfire_i18n, locale en
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1322)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:795)
image.png