[ https://issues.apache.org/jira/browse/FELIX-3172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Clement Escoffier resolved FELIX-3172. -------------------------------------- Resolution: Fixed Fix Version/s: ipojo-core-1.8.2 Fixed in trunk. Implements the new API Updates service registration to avoid the cast issue Propagates changes to iPOJO Service Context (and implementations) Configures the maven-compiler-plugin to generate 1.4 bytecode (same trick as for the Felix framework) Could you check ? Thanks > Error when calling BundleContext.register(Class, Object, Dictionary) > -------------------------------------------------------------------- > > Key: FELIX-3172 > URL: https://issues.apache.org/jira/browse/FELIX-3172 > Project: Felix > Issue Type: Bug > Components: iPOJO > Affects Versions: iPOJO-1.8.0 > Environment: Java 1.6, Apache Felix 4.0.1 > Reporter: François Fornaciari > Assignee: Clement Escoffier > Fix For: ipojo-core-1.8.2 > > > I have an error when I try to call the simple BundleContext.register(Class, > Object, Dictionary) method (note the type of the first argument). > It seems that the new signature of the BundleContext.register() method is not > recognised by the IPojoContext. > This simple example reproduces the issue: > @Component > @Instantiate > public class Test{ > > public Test(BundleContext bundleContext) { > bundleContext.registerService(String.class, "test", null); > } > } > With the following trace: > g! [ERROR] : [com.fornacif.osgi.manager.internal.Manager-0] createInstance > -> Cannot invoke the constructor method - the constructor throws an except > ion : > org.apache.felix.ipojo.IPojoContext.registerService(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistr > ation; > java.lang.AbstractMethodError: > org.apache.felix.ipojo.IPojoContext.registerService(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi > /framework/ServiceRegistration; > at com.fornacif.osgi.manager.internal.Manager.<init>(Manager.java:12) > 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 > org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:656) > at > org.apache.felix.ipojo.InstanceManager.getPojoObject(InstanceManager.java:844) > at > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:156) > at > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java) > at > org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471) > at > org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353) > at > org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166) > at > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301) > at > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238) > at > org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343) > at > org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89) > at org.apache.felix.ipojo.Extender.parse(Extender.java:269) > at > org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208) > at org.apache.felix.ipojo.Extender.access$600(Extender.java:52) > at > org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682) > at java.lang.Thread.run(Unknown Source) > [ERROR] com.fornacif.osgi.manager.internal.Manager : Cannot create a POJO > instance, the POJO constructor has thrown an exception: org.apache.felix.ipo > jo.IPojoContext.registerService(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration; > java.lang.RuntimeException: Cannot create a POJO instance, the POJO > constructor has thrown an exception: > org.apache.felix.ipojo.IPojoContext.registerS > ervice(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration; > at > org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:696) > at > org.apache.felix.ipojo.InstanceManager.getPojoObject(InstanceManager.java:844) > at > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:156) > at > org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java) > at > org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471) > at > org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353) > at > org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166) > at > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301) > at > org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238) > at > org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343) > at > org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89) > at org.apache.felix.ipojo.Extender.parse(Extender.java:269) > at > org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208) > at org.apache.felix.ipojo.Extender.access$600(Extender.java:52) > at > org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682) > at java.lang.Thread.run(Unknown Source) > [ERROR] com.fornacif.osgi.manager.internal.Manager : Cannot create a POJO > instance, the POJO constructor has thrown an exception: org.apache.felix.ipo > jo.IPojoContext.registerService(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration; > [ERROR] iPOJO Instance Creator : A matching factory was found for > {component=com.fornacif.osgi.manager.internal.Manager, > instance.name=com.fornacif.os > gi.manager.internal.Manager-0}, but the instantiation failed : The > configuration is not correct for the type > com.fornacif.osgi.manager.internal.Manage > r : Cannot create a POJO instance, the POJO constructor has thrown an > exception: > org.apache.felix.ipojo.IPojoContext.registerService(Ljava/lang/Class; > Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration; -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira