Hello,
I wrote my own create or comment handler extends AbstractMessageHandler. I need there some stored values form the active objects. I did the configuration in the atlassian-plugin.xml and I have access with other classes to the data (listener, action etc). But if I put the ActiveObjects in the constructor of the message handler I got a null pointer exception. How can I get the access to the active objects in a message handler?
Best regards
Stefan
Community moderators have prevented the ability to post new answers.
Correct me if I'm wrong, but your mail handler is not developpped as a plugin but rather as an extra class that goes into JIRA's main class path. Is that correct?
If that is the case you won't be able to use your Active Objects service that you created in your plugin. Each Active Objects service is only available within the plugin that defines it.
I think you are right. I use a plugin with other functions and there is also the mail handler inside. But there is no definition in the atlassian-plugin.xml for the mail handler. For the mail handler I did the registration in the popservice.xml.
Means no chance to get an access to my active objects?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
there is no mail handler plugin point in currently available JIRA versions. JIRA 5.0 is going to have such plugin point at last.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Handler objects are instantiated by JIRA (actually by com.atlassian.jira.service.services.file.AbstractMessageHandlingService) by com.atlassian.jira.service.util.handler.HandlerFactory using parameterless constructors (so injection won't work here).
I think you should be able to access ActiveObjects in your parameterless constructor using ComponentManager.getOSGiComponentInstanceOfType()
I've raised https://jira.atlassian.com/browse/JRA-26188 to track the change to JIRA core to allow DI in the constructor of the handler.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, with this solution I get the access to ActiveObjects. But when I try to access to "my" objects (ao.find(...)) I get an exception:
2011-11-08 11:39:26,515 QuartzWorker-0 ERROR ServiceRunner Support Create Issue [atlassian.activeobjects.osgi.ActiveObjectsServiceFactory] Could not find any active objects configurations for bundle org.apache.felix.framework.
Did you define an 'ao' module descriptor in your plugin?
Try adding this in your atlassian-plugin.xml file: <ao key='some-key' />
2011-11-08 11:39:26,515 QuartzWorker-0 ERROR ServiceRunner Support Create Issue [service.services.mail.MailFetcherService] Support Create Issue[10010]: Exception: com.atlassian.activeobjects.osgi.NoServicesFoundException: Was expecting at least one service reference for interface <com.atlassian.activeobjects.config.ActiveObjectsConfiguration> and filter <(com.atlassian.plugin.key=org.apache.felix.framework)>. Got null !
com.atlassian.plugin.PluginException: com.atlassian.activeobjects.osgi.NoServicesFoundException: Was expecting at least one service reference for interface <com.atlassian.activeobjects.config.ActiveObjectsConfiguration> and filter <(com.atlassian.plugin.key=org.apache.felix.framework)>. Got null !
I think when I access with ComponentManager to the AO there is no "link" to my atlassian-plugin.xml ao description? What I did wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried using AO via your own component specified normaly in atlassian-plugin.xml. You would call a method on this compoment from a handler via ComponentManager.getOSGiComponentInstanceOfType(YourComponent). That could trick AO to work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Wojciech Seliga
I am facing same problem.
as per your suggestion i tried like
ActiveObjects ao = ComponentAccessor.getOSGiComponentInstanceOfType(ActiveObjects.class);
TestPlanCaseExecution tp = ao.create(TestPlanCaseExecution.class);
but its not working ......
any suggestion
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.