5 Replies Latest reply on Jul 8, 2011 2:42 AM by Aldoras

    Plugin stopped working in Spark2.6.0

    Aldoras Bronze

      Hello,

       

        i have written a plugin for spark 2.5.8 last year and it was working great, until i installed spark 2.6.0 yesterday.

      There is a line where i want to get the current user directory:

       

      private static String userDirectory = SparkManager.getUserDirectory().getPath();

       

      since i installed 2.6.0 this one is causing me trouble with the following error:

       


      15.06.2011 13:20:05 org.jivesoftware.spark.util.log.Log error
      SCHWERWIEGEND: Unable to load plugin
      java.lang.ExceptionInInitializerError
      at org.[myPlugin].<clinit>(plugin.java:94)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at java.lang.Class.newInstance0(Unknown Source)
      at java.lang.Class.newInstance(Unknown Source)
      at org.jivesoftware.spark.PluginManager.loadPublicPlugin(PluginManager.java:347)
      at org.jivesoftware.spark.PluginManager.loadPublicPlugins(PluginManager.java:692)
      at org.jivesoftware.spark.PluginManager.loadPlugins(PluginManager.java:237)
      at org.jivesoftware.Spark.startup(Spark.java:209)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jivesoftware.launcher.Startup.start(Startup.java:94)
      at org.jivesoftware.launcher.Startup.main(Startup.java:44)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
      at com.exe4j.runtime.WinLauncher.main(Unknown Source)


      Caused by: java.lang.NullPointerException
      at org.jivesoftware.spark.SparkManager.getUserDirectory(SparkManager.java:366)
      at org.[myPlugin].<clinit>(pluginSettings.java:20)
      ... 23 more

       

       

      did anything change in the source for SparkManager that i have to adapt to, or is this a bug?

       

       

      Thanks in advance

       

      - Aldoras

      15.06.2011 13:20:05 org.jivesoftware.spark.util.log.Log error
      SCHWERWIEGEND: Unable to load plugin org.pidas.aci.client.ACIClient.
      java.lang.ExceptionInInitializerError
      at org.pidas.aci.client.ACIClient.<clinit>(ACIClient.java:94)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at java.lang.Class.newInstance0(Unknown Source)
      at java.lang.Class.newInstance(Unknown Source)
      at org.jivesoftware.spark.PluginManager.loadPublicPlugin(PluginManager.java:347)
      at org.jivesoftware.spark.PluginManager.loadPublicPlugins(PluginManager.java:692)
      at org.jivesoftware.spark.PluginManager.loadPlugins(PluginManager.java:237)
      at org.jivesoftware.Spark.startup(Spark.java:209)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jivesoftware.launcher.Startup.start(Startup.java:94)
      at org.jivesoftware.launcher.Startup.main(Startup.java:44)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
      at com.exe4j.runtime.WinLauncher.main(Unknown Source)
      Caused by: java.lang.NullPointerException
      at org.jivesoftware.spark.SparkManager.getUserDirectory(SparkManager.java:366)
      at org.pidas.aci.client.resources.Settings.<clinit>(Settings.java:20)
      ... 23 more

       

        • Plugin stopped working in Spark2.6.0
          Aldoras Bronze

          bump <.<

            • Plugin stopped working in Spark2.6.0
              Wolf Gold

              nope nothing changed with SparkManager.java

               

              you will need to post the source of your plugin for anyone to find an answer

                • Plugin stopped working in Spark2.6.0
                  Aldoras Bronze

                  ok, but there isnt that much more code before this error occurs.

                  the main class looks like this:

                   

                  public class MyPlugin implements Plugin {

                   

                    private static final String SETTINGS = pluginSettings.SETTINGS_STRING;

                   

                    public void initialize() {

                       System.out.println(SETTINGS);

                       // continue with the rest of the plugin

                      (...)

                    }

                   

                  }

                   

                   

                  and the settings class:

                   

                  public class pluginSettings {

                     private static String userDirectory = SparkManager.getUserDirectory().getPath();

                   

                     public static final String SETTINGS_STRING = "UD is: "+userDirectory;

                  }

                   

                   

                   

                  i cut the rest since the plugin doesn't even get that far anymore. when initialising MyPlugin he has to initialize pluginSettings, for that he needs to get the User Directory and that one throws a null pointer.

                   

                  as i said, it works with 2.5.8

                   

                  i have it installed on win7 on d:/Spark  (note that its not on c:/programs where i would need admin rights)

                  and my user directory also is on d:/user

                   

                  i noticed that 2.5.8 created the user directory in user/Spark whereas 2.6 creates it in user/AppData/Roaming/Spark (and AppData is a hidden folder). Other java programs can access this folder tho, but maybe theres a problem for spark?

                   

                   

                  - Aldoras

                    • Plugin stopped working in Spark2.6.0
                      Wolf Gold

                      i can currently not verify my thesis, cause i just upgraded to osx10.7 and dont have the java-jkd yet but here it goes:

                       

                      since 2.6 plugins will be loaded before workspace initialization, therefore the getUserDirectory() is not set yet

                       

                      this is only a thought i have, will check later.

                       

                       

                      you might want to try something like

                       

                      private static String userDirectory = "~/Library/Application Support/Spark/" // or whatever path

                       

                      instead of

                      private static String userDirectory = SparkManager.getUserDirectory().getPath();

                       

                      and ill check if this is actually true

                        • Plugin stopped working in Spark2.6.0
                          Aldoras Bronze

                          thanks for your help ^^ i tried this and it seems 2.6.x really loads plugins first - which sucks coz now i have to get the user directory using a method instead of on initialization (i have several filepath-variables using that directory which i now have to set after the plugin started instead of in the public static final line)

                           

                          - Aldoras