Return to Jive Software

Skip navigation
3,965 Views 13 Replies Last post: May 15, 2009 10:30 AM by todd.west RSS
dbeutner Intermediate 585 posts since
Apr 14, 2008
Currently Being Moderated

May 4, 2009 9:20 AM

Exactly one plugin of class ... must be specified in spring.xml

Hi there,

 

Just developing a plugin which checks that the user has agreed to some T&Cs before using CS, I am stumbling over differen problems, which have been reported before but not really resolved. Let's start with the first one:

 

It is more or less the same as reported here: http://www.jivesoftware.com/jivespace/thread/42027

 

The stack trace is:

 

17:47:52,703 [Task Engine Worker 2] ERROR com.jivesoftware.base.plugin.PluginManager - com.jivesoftware.base.plugin.PluginConfigurationException: Exactly one plugin of class de.dlh.plugins.tac.TermsAndConditionsPlugin must be specified in spring.xml
com.jivesoftware.base.plugin.PluginException: com.jivesoftware.base.plugin.PluginConfigurationException: Exactly one plugin of class de.dlh.plugins.tac.TermsAndConditionsPlugin must be specified in spring.xml
at com.jivesoftware.base.plugin.PluginManagerImpl.loadPlugin(PluginManagerImpl.java:688)
at com.jivesoftware.base.plugin.PluginManagerImpl$1.run(PluginManagerImpl.java:198)
at com.jivesoftware.util.task.TaskEngine$TaskEngineWorker.run(TaskEngine.java:392)
Caused by: com.jivesoftware.base.plugin.PluginConfigurationException: Exactly one plugin of class de.dlh.plugins.tac.TermsAndConditionsPlugin must be specified in spring.xml
at com.jivesoftware.base.plugin.configurators.SpringConfigurator.configure(SpringConfigurator.java:52)
at com.jivesoftware.base.plugin.PluginManagerImpl.loadPlugin(PluginManagerImpl.java:640)
... 2 more

 

I have followed the instructions and tried to do "the same" as it is done within the feedblog plugin (which works so far and does not(!) throw this exception).

 

I have attached my spring.xml, the plugin.xml and the plugin class.

 

Also the complete plugin jar (which is not complete at all and contains some other stuff, too!), which should help to reproduce this locally, if the given XMLs are not enough.

 

Removing the class entry from the plugin.xml "works" so far, but this is quite annoying in my eyes, as doing "the same" as being told in the how-to should lead to success...

 

Thanks in advance

Detlev

Attachments:
todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 5, 2009 6:51 AM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Hey Detlev,

 

I spent the last 15-20 minutes or so debugging through this plugin but it appears to work correctly for me from the JAR that you've provided. I do not get the PluginManager error but I do see some unrelated database errors:

 

06:45:23,443 [Task Engine Worker 4] ERROR com.jivesoftware - upgrade.database.failure
org.postgresql.util.PSQLException: ERROR: syntax error at or near "("

 

Can you confirm that this plugin is not already installed or maybe there is some duplicae reference with this same name? If you can debug through this to see whats going on from your end, all of the loading is done in the SpringConfigurator:

 

            if (!(plugin instanceof DummyPlugin)) {
                String[] strings = ctx.getBeanFactory().getBeanNamesForType(plugin.getClass());
                if (strings.length != 1) {
                    throw new PluginConfigurationException(String.format(
                            "Exactly one plugin of class %s must be specified in spring.xml",
                            plugin.getClass().getName()));
                }
                ctx.getBeanFactory().configureBean(metaData.getPlugin(), strings[0]);
            }

 

 

Hope that helps.

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 5, 2009 7:39 AM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Hmm, that is very strange. This is not the same behavior that I am seeing locally. Are there any other errors related to this plugin outside of this one? Maybe something related to the loading of the plugin or spring.xml? From this error that you've posted its either not matching the name of the class correctly or the spring.xml in your plugin failed to load. I am leaning more towards the spring.xml not loading, but I am really not sure how this couldn't load.

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 5, 2009 9:07 AM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Hey Detlev,

 

I followed up with some people internally to see if they had any ideas. They had mentioned that they ran into it before but they weren't sure exactly why it happened. However, they did find a way around it. You just need to do something like this:

 

1. Remove the <class>plugin</class> from your plugin.xml

2. Then define your plugin class like this:

 

public class TermsAndConditionsPlugin implements Plugin {
 
 
    public TermsAndConditionsPlugin(TACManager tacManager) {
        this.tacManager = tacManager;
        
        this.init();
    }
     
    private TACManager tacManager; 
 
    public void setTacManager(TACManager tacManager) {
 
        System.out.println("HEY-HO: tacManager has been set within TermsAndConditionsPlugin");
 
        this.tacManager = tacManager;
 
    }
 
    
 
    public TermsAndConditionsPlugin() {
 
        System.out.println("HEY-HO: TermsAndConditionsPlugin created by " + this.getClass().getClassLoader().toString());
 
    }
 
     
    public void init() {
 
        // TODO Auto-generated method stub
 
    }
 
 
    public void destroy() {
 
        // TODO Auto-generated method stub     
    }
 
 
}

 

Apparently the plugin constructor takes spring dependencies as parameters. Hope that helps!

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 5, 2009 9:09 AM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Please let me know if the suggested approach above also solves the other issue. Thanks!

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 5, 2009 2:16 PM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Hey Detlev,

 

This would almost certainly have to be an environmental (not code based) issue since I am not able to reproduce this issue on my local machine. Can you give me a little more information about your environment? OS, Database, App server, JVM version? I wonder if this might be a JVM bug or something odd like that since it seems to be a very isolated issue (only seen 3 people ever run into it). Hopefully we can get everything sorted out.

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 7, 2009 1:43 PM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Thanks Detlev. I'll try to set up a similar environment to see if I can replicate this issue. I'll update you as soon as I have some more information.

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 12, 2009 7:20 AM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Hey Detlev,

 

The following block of code has been pointed out to me by one of our devs:

 

public void run() {
    // waits until context is inialized.
    while (!JiveApplication.isContextInitialized()) {
        try {
            Thread.sleep(500);
        }
        catch (InterruptedException e) {}
    }
   
    // Load plugins that need loaded
    for (PluginDbBean bean : pluginBeans) {
        File pluginDir = new File(pluginDirectory, bean.getName());
        try {
            loadPlugin(pluginDir, bean);
        }
        catch (PluginException e) {
            log.error(e.getMessage(), e);
        }
    }

    loadDevPlugins();
}

 

 

Basically, this will try to load all plugins from the database and then try to load any plugins specified with the pluginDirs option. This means that if the plugin already exists in the database then it would be possible for this to try and load the same plugin twice. Please try running this on a clean database (or just empty out the jivePlugin table). Let me know if that works. Thanks!

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
May 15, 2009 10:30 AM in response to: Detlev Beutner
Re: Exactly one plugin of class ... must be specified in spring.xml

Hey Detlev,

 

I think Will (from support) has figured out the real problem here. He was able to reproduce this issue on his Windows machine with the plugin you've provided. The issue is your plugin name has upper and lowercase letters which will not work (we lowercase the path names automatically). So try editing your plugin.xml and changing TermsAndConditions to termsandconditions and re-reploy the JAR. Let me know if that works. Thanks!

 

-Todd

More Like This

  • Retrieving data ...

Bookmarked By (0)

To better serve our customers we have included functionality to automatically follow up on a case after it has been idle for more than 5 days, and then auto close after an additional 3 days of inactivity. Choose No to acknowledge that this case will remain idle for longer than 5 days.
Making cases public allows other customers to learn from the solution of the case. It can also be used to gain feedback from others in the community. Ask our Support Engineers for more info, but we encourage you to make your cases public.