powered by Jive Software

Building plugins (ant/build scripts) plugin directory/structure

Hi guys

im a bit confused as to how to go about building a plugin that im creating. I have provided the code for the plugin as an attachment.

My plugin is a very simple plugin that **does not require the admin console **since there is nothing to set . The only jar file the plugin needs is the openfire.jar file.

i have already seen the plugin development help page and im familiar with the directory structure the plugin need to be complied correctly by the openfire build script.

with the above details i have assumed that my plugin directory structure should look like this:

ConExLock/

      -| plugin.xml            

      -| src

              -| java              

                      -| ConExLock

                               -| ConceptionExLock.java

My question is do i need any of the other folder/files mentioned in the help page?

as i see it i dont need

-the classes folder (no properties)

-the lib folder (only jar im using is the openfire.jar)

-the database folder in the src folder

-the web folder in the src folder (since i dont need admin console controls)

I put my plugin folder in the src/plugin folder of the openfire source directory and ran the build using ant plugins and i get the message saying the build was successful.

The problem im having right now is when i run the openfire server my plugin does not load and i get the following error:

2009.10.08 04:29:10 [org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.jav a:507)
] **Error loading plugin: C:\SreesApplications\Openfire\plugins\conexlock **
**java.lang.ClassNotFoundException: org.example.ExamplePlugin **
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.java :385)
at org.jivesoftware.openfire.container.PluginManager.access$300(PluginManager.java :47)
at org.jivesoftware.openfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:1032)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknow n Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

I dumbfounded… can someone please tell me wht im doing wrong?

Thanks in advance

Sreejit
plugin.xml (1197 Bytes)
ConceptionExLock.java.zip (1569 Bytes)

Hi guys,

It seem everytime i ask a question on the forum and i go back to tinker with the files, i find the answer to the question embarassed

The clue was in the error message, only i didnt know where to look for it.

The classnotfoundexception mentioned org.example.ExamplePlugin. The prob was that in my plugin.xml file i had set the tag as ‘org.example.ExamplePlugin’. It is actually supposed to be based on the directory structure where the main plugin java file is meant to be. I.e: the directory path after the src/java. So the correct entry in the tag would:

conexlock.ConceptionExLock

also i noticed while building the plugin that if you do not used the line below in the java file **even if there is only one file **there, the build will not be successful.

package conexlock.ConceptionExLock; // to indicate the folder path with all the java files

working with netbeans usually the package is included by default… so i dont know if this build error is something to do with general java programming or not!

Well thats abt it… now my plugin i atleast being recognized by the openfire server! i still have to test it to make sure it does what i want it to !!!

Untill next time folks!!