Hi Guillaume

Thanks for the quick answer. I id indeed try your first suggestion, by
adding the following method to my pojo:

        public void setContext(javax.jbi.component.ComponentContext context) 
throws
JBIException {
                log.info("FileLinkManager: setContext started");
                this.context = context;
                log.info("FileLinkManager: setContext started1");
        }

However, this gives the following problem in my trace:

2006-10-20 16:05:57,184 DEBUG [org.apache.servicemix.jsr181.Jsr181Component]
Querying service description for
ServiceEndpoint[service={http://servicemix.apache.org/cheese/}filePoller,endpoint=filePoller]
2006-10-20 16:05:57,199 DEBUG [org.apache.servicemix.jsr181.Jsr181Component]
Unable to inject ComponentContext:
test.FileLinkManager.setContext(javax.jbi.component.ComponentContext)
2006-10-20 16:05:57,199 DEBUG [org.apache.servicemix.jsr181.Jsr181Component]
Component started

and the context is never set. Alas, I will now also try your second
suggestion.

Thanks for your help!

Regards

Andreas


gnodet wrote:
> 
> You do not use SU, right ? The context bean is created
> when you deploy an SU with the xbean.xml config file.
> 
> If you want to configure the context on the pojo directly,
> you can just add a
>    public void setContext(ComponentContext context)
> method to your pojo.
> It should be called.
> 
> If you use a static configuration file (no SUs), you can
> also create a client:
>    <bean ...>
>      <property name="client">
>        <sm:client container="#jbi" />
>     </property>
> and defining the following method on your pojo:
>     public void setClient(ServiceMixClient client)
> 
> 
> 
> On 10/20/06, AndreasH <[EMAIL PROTECTED]> wrote:
>>
>> Hi
>>
>> I am trying to deploy a JSR181 endpoint in the servicemix.war and to
>> inject
>> the component context. My applicationContext.xml looks as follows:
>>
>>       <beans xmlns:sm="http://servicemix.apache.org/config/1.0";
>>   xmlns:http="http://servicemix.apache.org/http/1.0";
>>   xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0";
>>   xmlns:my="http://servicemix.apache.org/demo/";
>>   xmlns:foo="http://servicemix.apache.org/cheese/";>
>>
>> ...
>>       <sm:activationSpec>
>>         <sm:component>
>>           <jsr181:component>
>>             <jsr181:endpoints>
>>               <jsr181:endpoint annotations="none"
>> service="foo:filePoller"
>> endpoint="filePoller">
>>                 <jsr181:pojo>
>>                   <bean class="test.FileLinkManager">
>>                     <property name="context" ref="context" />
>>                   </bean>
>>                 </jsr181:pojo>
>>               </jsr181:endpoint>
>>             </jsr181:endpoints>
>>           </jsr181:component>
>>         </sm:component>
>>       </sm:activationSpec>
>>
>> ...
>>
>> Upon deploying I get the error that no bean with reference "context" can
>> be
>> found:
>>
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'test.FileLinkManager' defined in ServletContext resource
>> [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean
>> 'context' while setting bean property 'context'; nested exception is
>> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
>> named 'context' is defined
>> Caused by:
>> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
>> named 'context' is defined
>>         at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:355)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:800)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:237)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
>>         at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
>>         at
>> org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:198)
>>
>> Am I missing something? Incidentally, I am using ServiceMix3.1 from SVN.
>> According to the mailing list, injecting the context should have been
>> added
>> for V3.0 already, so I assumed I should be fine.
>>
>> Any help is greatly appreciated.
>>
>> Regards
>>
>> Andreas
>> --
>> View this message in context:
>> http://www.nabble.com/ServiceMix.war-and-JSR181-context-tf2480516.html#a6916913
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ServiceMix.war-and-JSR181-context-tf2480516.html#a6917514
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to