Hello, I won't argue it is good or not, it's just not in line with bean specs. However blueprint specs says: #factoryMethod - A static or instance factory method name that corresponds to a publicly accessible method on the given class or factory manager.
So it's not pointing to return value of the factory method. To be honest, it's not important for me how this combination might be done - it might be done just like we did this in Spring - with MethodInvokingFactoryBean. But I wish to don't copy unnecessary code when it might be done in existing. WDYT? Best regards, Lukasz -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Alasdair Nottingham Sent: Tuesday, February 22, 2011 1:58 PM To: [email protected] Subject: Re: Void factory method Can you raise a JIRA to make the error message better? JIRA issues can be raised here: https://issues.apache.org/jira/browse/ARIES Thanks for bringing this to our attention. Alasdair 2011/2/22 Alasdair Nottingham <[email protected]>: > Hi, > > You can't do what you are trying to do here. The factory-method needs > to return an object > that represents the bean. In this case it returns void. It is not a > very nice error, we shouldn't > throw a NullPointerException. > > In this scenario you are defining a bean without providing an instance > that could back that bean. > > Alasdair > > 2011/2/22 Łukasz Dywicki <[email protected]>: >> Hello, >> I have small problem with Aries. I try to configure jetty with blueprint. >> Jetty requires to register some objects using void methods, for example: >> Server.addConnector(Connector). >> >> I try to use blueprint XML: >> >> <bean id="server" class="org.eclipse.jetty.server.Server" >> init-method="start" destroy-method="stop" >> /> >> >> <bean id="http" factory-ref="server" factory-method="addConnector" >> depends-on="jersey"> >> <argument> >> <bean >> class="org.eclipse.jetty.server.nio.SelectChannelConnector"> >> <property name="port" value="8080" /> >> <property name="host" value="0.0.0.0" /> >> </bean> >> </argument> >> </bean> >> >> This configuration causes following error: >> org.apache.aries.blueprint - 0.2.0.incubating | Unable to start blueprint >> container for bundle jetty-server >> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to >> instantiate components >> at >> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEager >> Components(BlueprintContainerImpl.java:628)[7:org.apache.aries.blueprint:0.2 >> .0.incubating] >> at >> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintC >> ontainerImpl.java:315)[7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintCon >> tainerImpl.java:213)[7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6 >> .0_21] >> at >> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_21 >> ] >> at >> java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_21] >> at >> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$ >> 301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_21] >> at >> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Sch >> eduledThreadPoolExecutor.java:207)[:1.6.0_21] >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja >> va:886)[:1.6.0_21] >> at >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:9 >> 08)[:1.6.0_21] >> at java.lang.Thread.run(Thread.java:619)[:1.6.0_21] >> Caused by: java.lang.NullPointerException >> at >> java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)[:1.6. >> 0_21] >> at >> org.apache.aries.blueprint.container.BlueprintRepository.addPartialObject(Bl >> ueprintRepository.java:357)[7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> org.apache.aries.blueprint.di.AbstractRecipe.addPartialObject(AbstractRecipe >> .java:84)[7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.ja >> va:736)[7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[ >> 7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(Blu >> eprintRepository.java:219)[7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> org.apache.aries.blueprint.container.BlueprintRepository.createAll(Blueprint >> Repository.java:147)[7:org.apache.aries.blueprint:0.2.0.incubating] >> at >> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEager >> Components(BlueprintContainerImpl.java:624)[7:org.apache.aries.blueprint:0.2 >> .0.incubating] >> ... 10 more >> >> >> > > > > -- > Alasdair Nottingham > [email protected] > -- Alasdair Nottingham [email protected]
