It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
Hi,
I got an active object reference by using:
ao = ComponentAccessor.getOSGiComponentInstanceOfType(ActiveObjects.class);
but when I try to ise it:
ao.find(<Some class>);
a java.lang.reflect.InvocationTargetException is thrown.
Any idea?
Thanks,
Pablo.
The problem is that the object receiving the injected ActiveObject is a spring bean, so all its initialization parameters must be declared in the spring context (META-INF/spring/context.xml) and I am unable to configure ActiveObjects with Spring. Any suggestion?
Hi Jobin, I've also read this interesting article from you:
http://www.j-tricks.com/1/post/2012/07/active-objects-injection.html
But I still face the same problem: If I use the JTricksManagerImpl to get a valid reference to the ActiveObject instance, that should also be declared in the spring context:
public class X{ private ActiveObject ao; public X(JTricksManager trick){ ao = trick.getActiveObjects(); } }
In the spring context...
<beans:bean id="foo" class="X"> <beans:constructor-arg index="1" ref="trick" /> </beans:bean>
And the trick reference should also be included in the context:
<beans:bean id="trick" class="com.jtricks.manager.JTricksManagerImpl"> <beans:constructor-arg index="1" ref="ActiveObject?????" /> </beans:bean>
Pablo.
[Edited]
I've guess I did not get the point from your article:
if (this.jTricksManager == null)
this.jTricksManager = ComponentAccessor.getOSGiComponentInstanceOfType(JTricksManager.class);
It looks like I do not need to inject the JtricksManager object.
I'll try your solution!
Ok. Thank you! mainly because this great article:
http://www.j-tricks.com/1/post/2012/07/active-objects-injection.html
Finally, it worked for me.
if (this.jTricksManager == null)
this.jTricksManager = ComponentAccessor.getOSGiComponentInstanceOfType(JTricksManager.class);
it was returning always null becuase it must be called after the spring context is fully initialized, so the problem was in calling it from inside a bean constructor.
Now, I let the bean fully initialize and get the active object reference just before it is going to be used.
Thanks,
Pablo
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreAtlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.