powered by Jive Software

How to debug plugin in openfire 4.3.2

I have downloaded the src of Openfire 4.3.2 and I’m running it on intellij by maven verifying and executing openfire.sh.
Now I have created a plugin of my own and i want to debug it when I execute openfire.sh to find an error. The documentation states you can use -debug to debug the code.
So, I need answers to the following questions.
1:How to debug openfire.sh like we do it in IDE using breakpoints
2:Is it possible to debug a plugin as to get it loaded in openfire we need to maven verify it and place the jar file in plugins folder of target inside distribution. So technically the plugin is loaded from jar. How can I debug jar to find my error or can i make openfire to load plugin through the src of plugin an dthen I can debug? please need help!!

You’ll need to set up a remote debug in the IntelliJ debug configuration.

Run … Edit Configurations … Add New Configuration. Select “Remote”, change the port to either 8000 (Windows) or 5005 (UNIX).

Greg

1 Like

Thanks man. worked perfectly!!!

Hello,

you can also use Intellij’s build in runtime configuration:

  1. Run -> Edit Configurations… -> Add Application
  2. fill in following values
    1. Name: Openfire
    2. Use classpath of module: starter
    3. Main class: org.jivesoftware.openfire.starter.ServerStarter
    4. VM options:
      • -DopenfireHome="-absolute path to your project folder-\distribution\target\distribution-base"
      • -Xverify:none
      • -server
      • -Dlog4j.configurationFile="-absolute path to your project folder-\distribution\target\distribution-base\lib\log4j2.xml"
      • -Dopenfire.lib.dir="-absolute path to your project folder-\distribution\target\distribution-base\lib"
      • -Dfile.encoding=UTF-8
    5. Working directory: -absolute path to your project folder-
  3. apply

You need to execute mvn verify before you can launch openfire.

1 Like

@chp - that’s useful stuff - thanks. Any chance you could create a PR for README.md at https://github.com/igniterealtime/Openfire/blob/master/README.md to add this information, as it could be useful for many people.

Greg

@gdt done (https://github.com/igniterealtime/Openfire/pull/1431)

2 Likes

thank you!

Hi everyone. I have a REST api plugin. I compile my plugin with maven verify and install it from admin panel. However, when I make a request, I cannot debug my plugin. I found a document about it: https://gist.github.com/fabiomontefuscolo/42b144cc5803051281fc9a1be3286bf7. However, when I implement this, I get a NoClassDefFoundError error. What is the right way? How can I solve this?

My bad sorry. I forgot I added 2 configurations. I was actually turning on the debug mode of the “Openfire Run” configuration.
image
Actually what I need to do is debug in the “Debug” configuration

image

Hello, I have the same question, how to debug the plug-in when debugging openfire? There is only a compiled “.class” file in the plugin jar package. How can I set a breakpoint in the plugin? Seeing you say you have solved this problem, but I still have doubts, I hope you can give me some suggestions, thank you very much.