You're right.  I actually misleaded you.
The type attribute is only available for <argument> elements.
Blueprint mandates that properties be JavaBean compliants, i.e. the
getter and setter have the same type and you only have one of those.
I don't think there is a work around other than changing or wrapping your code.
If you can't change it, you can create a bean which will act as a
factory for your real bean.

On Tue, Mar 9, 2010 at 06:05, Leoincedo <[email protected]> wrote:
>
> As you mentioned, I had tried to add 'type' attribute but didn't work.
>
> i using karaf(1.4.0) in geronimo-blueprint.. 1.0.0 Bundles
>
> thank you.
>
> xml:
> <bean id="test" class="test.impl.BlueprintBean">
>                <property name="defaultLocalAddress" ref="localAddress"
> type="java.net.InetSocketAddress"/>
> </bean>
>
> error:
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
> validate xml
>        at
> org.apache.geronimo.blueprint.container.Parser.validate(Parser.java:281)
>        at
> org.apache.geronimo.blueprint.container.Parser.populate(Parser.java:263)
>        at
> org.apache.geronimo.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:259)
>        at
> org.apache.geronimo.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:211)
>        at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>        at
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
>        at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:637)
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute
> 'type' is not allowed to appear in element 'property'.
>        at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
>        at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
>        at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
>        at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2630)
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2037)
>        at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:273)
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:240)
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:186)
>        at
> com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:100)
>        at javax.xml.validation.Validator.validate(Validator.java:127)
>        at
> org.apache.geronimo.blueprint.container.Parser.validate(Parser.java:278)
>        ... 11 more
>
>
>
> gnodet wrote:
>>
>> This is in the spec, but you should be able to work around the problem
>> using the following construction:
>>
>>  <bean id="test" class="test.impl.BlueprintBean">
>>         <property name="defaultLocalAddress" ref="localAddress"
>> type="java.net.SocketAddress" />
>>  </bean>
>>
>>
>> On Mon, Mar 8, 2010 at 01:56, Leoincedo <[email protected]> wrote:
>>>
>>> I was trying change spring ioc to blueprint
>>>
>>> but i'm failed because blueprint not support to multiply same name
>>> function..
>>>
>>> and when used once function is not problem..
>>>
>>> is this bug? Not or Spec?
>>>
>>>
>>>
>>>
>>> xml file…
>>>
>>> <bean id="test" class="test.impl.BlueprintBean">
>>>        <property name="defaultLocalAddress" ref="localAddress" />
>>> </bean>
>>>
>>> class file…
>>>
>>> import java.net.InetSocketAddress;
>>> import java.net.SocketAddress;
>>>
>>>
>>> public class BlueprintBean {
>>>
>>>        public void setDefaultLocalAddress( SocketAddress addr )
>>>        {
>>>                System.out.println("Blueprint setDefaultLocalAddress it's
>>> me! : "+addr);
>>>        }
>>>
>>>        public void setDefaultLocalAddress( InetSocketAddress addr )
>>>        {
>>>                System.out.println("Blueprint Bean setDefaultLocalAddress
>>> it's me! :
>>> "+addr);
>>>        }
>>>
>>>
>>> }
>>>
>>>
>>> error message....
>>>
>>> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable
>>> to
>>> find property descriptor defaultLocalAddress on class
>>> test.impl.BlueprintBean
>>>        at
>>> org.apache.geronimo.blueprint.container.BeanRecipe.getPropertyDescriptor(BeanRecipe.java:635)
>>>        at
>>> org.apache.geronimo.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:600)
>>>        at
>>> org.apache.geronimo.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:577)
>>>        at
>>> org.apache.geronimo.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:558)
>>>        at
>>> org.apache.geronimo.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:508)
>>>        at
>>> org.apache.geronimo.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
>>>        at
>>> org.apache.geronimo.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:212)
>>>        at
>>> org.apache.geronimo.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:140)
>>>        at
>>> org.apache.geronimo.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:603)
>>>        at
>>> org.apache.geronimo.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:310)
>>>        at
>>> org.apache.geronimo.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:211)
>>>        at
>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>>>        at
>>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>>>        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>>>        at
>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
>>>        at
>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
>>>        at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>        at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>        at java.lang.Thread.run(Thread.java:637)
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Problem-Blueprint-ioc..-tp27816095p27816095.html
>>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://fusesource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Problem-Blueprint-ioc..-tp27816095p27831435.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to