You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Javier Valdes <ja...@gmail.com> on 2008/01/22 11:26:50 UTC

Problem with Bean Component

Hi,

I am trying an easy example with the bean component (the same that can be
find in http://servicemix.apache.org/servicemix-bean.html) but I do not know
where to put the bean class (in the example:
org.apache.servicemix.bean.beans.ListenerBean).
I have tried to put it directly in the classpath and in the service unit but
I get:
...
Configuration problem: Bean class [
org.apache.servicemix.bean.beans.ListenerBean] not found
...

I am developing using Eclipse, and I am launchin servicemix using
org.codehaus.classworlds.Launcher.

Thanks

Re: Problem with Bean Component

Posted by Lars Heinemann <la...@compart.net>.
If it does not show up in your "Referenced Libraries", then do a
   mvn eclipse:clean eclipse:eclipse
from a comand line inside your main pom folder.
This will rebuild the class path.

Regards,
Lars


Lars Heinemann schrieb:
> Javier,
>
> these annotations are from the geronimo-annotation_1.0_spec-1.0.jar.
>
> This is a dependency of the servicemix-bean's pom.
>
> So make sure you have the:
>
> <dependency>
>      <groupId>org.apache.servicemix</groupId>
>      <artifactId>servicemix-bean</artifactId>
>      <version>${servicemix-version}</version>
>    </dependency>
>
> in your bean SU's pom file.
>
> Regards,
> Lars
>
>
>
> Javier Valdes schrieb:
>> Lars,
>>
>> My problem with Java 5 (I am using jdk1.5.0_14) is that "
>> javax.annotation.Resource" cannot be found, but when I use Java 6 (
>> jdk1.6.0_04) the problem disappear. Do I need some specific jar when 
>> I am
>> using Java 5 that I do not need when using Java 6?
>>
>> Thanks
>>
>> 2008/1/23, Lars Heinemann <la...@compart.net>:
>>  
>>> Javier,
>>>
>>> no problem.
>>> Anyway what you described sounds really strange to me.
>>> Normally it should work with Java 5 like a charm, at least it does it
>>> for me.
>>>
>>> Regards,
>>> Lars
>>>
>>>
>>>
>>> Javier Valdes schrieb:
>>>    
>>>> Lars,
>>>>
>>>> I have corrected the problem: it was that I need to compile with Java
>>>> 1.6and I was using Java
>>>> 1.5.
>>>>
>>>> Thanks a lot for your answers (and speed)
>>>>
>>>> 2008/1/23, Lars Heinemann <la...@compart.net>:
>>>>
>>>>      
>>>>> Javier,
>>>>>
>>>>> please make sure your bean implements the MessageExchangeListener
>>>>> interface.
>>>>> "public class MyBean implements MessageExchangeListener" for example.
>>>>>
>>>>> Then make sure you define this in your bean class as well:
>>>>>
>>>>> @Resource
>>>>> private DeliveryChannel channel;
>>>>>
>>>>> @Resource
>>>>> private ComponentContext context; // if you need the component 
>>>>> context
>>>>>
>>>>> I all of this is done without getting it to work then I am a little
>>>>> curious about that.
>>>>> Maybe it helps when you post both xbean.xml and your class (throw 
>>>>> your
>>>>> private things out of the bean before doing this).
>>>>>
>>>>> Regards,
>>>>> Lars
>>>>>
>>>>>
>>>>>
>>>>> Javier Valdes schrieb:
>>>>>
>>>>>        
>>>>>> Thanks for answering so fast!
>>>>>>
>>>>>> I believed that I was doing what you have said but I had a problem
>>>>>>           
>>> with
>>>    
>>>>> my
>>>>>
>>>>>        
>>>>>> project configuration.
>>>>>>
>>>>>> The problem that I have now is with:
>>>>>>
>>>>>> @Resource
>>>>>>     private DeliveryChannel channel;
>>>>>>
>>>>>>     public void onMessageExchange(MessageExchange exchange) throws
>>>>>> MessagingException {
>>>>>>         System.out.println("Received exchange: " + exchange);
>>>>>>         exchange.setStatus(ExchangeStatus.DONE);
>>>>>>         channel.send(exchange);
>>>>>>     }
>>>>>>
>>>>>>
>>>>>> Now I get a NullPointerException, when "channel.send(exchange)" is
>>>>>>
>>>>>>           
>>>>> executed.
>>>>>
>>>>>        
>>>>>> My problem is that the DeliveryChannel "channel" is not initialized.
>>>>>>           
>>> Am
>>>    
>>>>> I
>>>>>
>>>>>        
>>>>>> forgetting something (like something as "@Resource")?
>>>>>>
>>>>>> Thanks again.
>>>>>>
>>>>>>
>>>>>> 2008/1/22, Lars Heinemann <la...@compart.net>:
>>>>>>
>>>>>>
>>>>>>          
>>>>>>> Hi,
>>>>>>>
>>>>>>> where to put the bean class is clearly defined.
>>>>>>> In your SU you can configure via xbean.xml:
>>>>>>>
>>>>>>> <bean id="listenerBean"
>>>>>>> class="org.apache.servicemix.bean.beans.ListenerBean"/>
>>>>>>>
>>>>>>> This means that you have to place this bean class in your bean 
>>>>>>> SU in
>>>>>>>             
>>> a
>>>    
>>>>>>> package called:
>>>>>>>   org.apache.servicemix.bean.beans
>>>>>>> and with the name:
>>>>>>>   ListenerBean
>>>>>>>
>>>>>>> So if you use eclipse for developing the path should be this:
>>>>>>>   <your project path>/src/org/apache/servicemix/bean/beans/
>>>>>>>
>>>>>>> Hopefully this will help you,
>>>>>>> Lars
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>            
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I am trying an easy example with the bean component (the same that
>>>>>>>>               
>>> can
>>>    
>>>>>>>>               
>>>>>>> be
>>>>>>>
>>>>>>>
>>>>>>>            
>>>>>>>> find in http://servicemix.apache.org/servicemix-bean.html) but 
>>>>>>>> I do
>>>>>>>>
>>>>>>>>               
>>>>> not
>>>>>
>>>>>        
>>>>>>> know
>>>>>>>
>>>>>>>
>>>>>>>            
>>>>>>>> where to put the bean class (in the example:
>>>>>>>> org.apache.servicemix.bean.beans.ListenerBean).
>>>>>>>> I have tried to put it directly in the classpath and in the 
>>>>>>>> service
>>>>>>>>
>>>>>>>>               
>>>>> unit
>>>>>
>>>>>        
>>>>>>> but
>>>>>>>
>>>>>>>
>>>>>>>            
>>>>>>>> I get:
>>>>>>>> ...
>>>>>>>> Configuration problem: Bean class [
>>>>>>>> org.apache.servicemix.bean.beans.ListenerBean] not found
>>>>>>>> ...
>>>>>>>>
>>>>>>>> I am developing using Eclipse, and I am launchin servicemix using
>>>>>>>> org.codehaus.classworlds.Launcher.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>               
>>>>       
>>
>>   
>

Re: Problem with Bean Component

Posted by Lars Heinemann <la...@compart.net>.
Javier,

no problem at all.
If you got further problems just ask at the mailing list.

Regards,
Lars



Javier Valdes schrieb:
> Lars,
>
> You were right that was my problem.
>
> Thank you very much for all your help.
>
> 2008/1/23, Lars Heinemann <la...@compart.net>:
>   
>> Javier,
>>
>> these annotations are from the geronimo-annotation_1.0_spec-1.0.jar.
>>
>> This is a dependency of the servicemix-bean's pom.
>>
>> So make sure you have the:
>>
>> <dependency>
>>       <groupId>org.apache.servicemix</groupId>
>>       <artifactId>servicemix-bean</artifactId>
>>       <version>${servicemix-version}</version>
>>     </dependency>
>>
>> in your bean SU's pom file.
>>
>> Regards,
>> Lars
>>
>>
>>
>> Javier Valdes schrieb:
>>     
>>> Lars,
>>>
>>> My problem with Java 5 (I am using jdk1.5.0_14) is that "
>>> javax.annotation.Resource" cannot be found, but when I use Java 6 (
>>> jdk1.6.0_04) the problem disappear. Do I need some specific jar when I
>>>       
>> am
>>     
>>> using Java 5 that I do not need when using Java 6?
>>>
>>> Thanks
>>>
>>> 2008/1/23, Lars Heinemann <la...@compart.net>:
>>>
>>>       
>>>> Javier,
>>>>
>>>> no problem.
>>>> Anyway what you described sounds really strange to me.
>>>> Normally it should work with Java 5 like a charm, at least it does it
>>>> for me.
>>>>
>>>> Regards,
>>>> Lars
>>>>
>>>>
>>>>
>>>> Javier Valdes schrieb:
>>>>
>>>>         
>>>>> Lars,
>>>>>
>>>>> I have corrected the problem: it was that I need to compile with Java
>>>>> 1.6and I was using Java
>>>>> 1.5.
>>>>>
>>>>> Thanks a lot for your answers (and speed)
>>>>>
>>>>> 2008/1/23, Lars Heinemann <la...@compart.net>:
>>>>>
>>>>>
>>>>>           
>>>>>> Javier,
>>>>>>
>>>>>> please make sure your bean implements the MessageExchangeListener
>>>>>> interface.
>>>>>> "public class MyBean implements MessageExchangeListener" for example.
>>>>>>
>>>>>> Then make sure you define this in your bean class as well:
>>>>>>
>>>>>> @Resource
>>>>>> private DeliveryChannel channel;
>>>>>>
>>>>>> @Resource
>>>>>> private ComponentContext context; // if you need the component
>>>>>>             
>> context
>>     
>>>>>> I all of this is done without getting it to work then I am a little
>>>>>> curious about that.
>>>>>> Maybe it helps when you post both xbean.xml and your class (throw
>>>>>>             
>> your
>>     
>>>>>> private things out of the bean before doing this).
>>>>>>
>>>>>> Regards,
>>>>>> Lars
>>>>>>
>>>>>>
>>>>>>
>>>>>> Javier Valdes schrieb:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> Thanks for answering so fast!
>>>>>>>
>>>>>>> I believed that I was doing what you have said but I had a problem
>>>>>>>
>>>>>>>               
>>>> with
>>>>
>>>>         
>>>>>> my
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> project configuration.
>>>>>>>
>>>>>>> The problem that I have now is with:
>>>>>>>
>>>>>>> @Resource
>>>>>>>     private DeliveryChannel channel;
>>>>>>>
>>>>>>>     public void onMessageExchange(MessageExchange exchange) throws
>>>>>>> MessagingException {
>>>>>>>         System.out.println("Received exchange: " + exchange);
>>>>>>>         exchange.setStatus(ExchangeStatus.DONE);
>>>>>>>         channel.send(exchange);
>>>>>>>     }
>>>>>>>
>>>>>>>
>>>>>>> Now I get a NullPointerException, when "channel.send(exchange)" is
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> executed.
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> My problem is that the DeliveryChannel "channel" is not initialized.
>>>>>>>
>>>>>>>               
>>>> Am
>>>>
>>>>         
>>>>>> I
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> forgetting something (like something as "@Resource")?
>>>>>>>
>>>>>>> Thanks again.
>>>>>>>
>>>>>>>
>>>>>>> 2008/1/22, Lars Heinemann <la...@compart.net>:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> where to put the bean class is clearly defined.
>>>>>>>> In your SU you can configure via xbean.xml:
>>>>>>>>
>>>>>>>> <bean id="listenerBean"
>>>>>>>> class="org.apache.servicemix.bean.beans.ListenerBean"/>
>>>>>>>>
>>>>>>>> This means that you have to place this bean class in your bean SU
>>>>>>>>                 
>> in
>>     
>>>> a
>>>>
>>>>         
>>>>>>>> package called:
>>>>>>>>   org.apache.servicemix.bean.beans
>>>>>>>> and with the name:
>>>>>>>>   ListenerBean
>>>>>>>>
>>>>>>>> So if you use eclipse for developing the path should be this:
>>>>>>>>   <your project path>/src/org/apache/servicemix/bean/beans/
>>>>>>>>
>>>>>>>> Hopefully this will help you,
>>>>>>>> Lars
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I am trying an easy example with the bean component (the same that
>>>>>>>>>
>>>>>>>>>                   
>>>> can
>>>>
>>>>         
>>>>>>>> be
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> find in http://servicemix.apache.org/servicemix-bean.html) but I
>>>>>>>>>                   
>> do
>>     
>>>>>>>>>                   
>>>>>> not
>>>>>>
>>>>>>
>>>>>>             
>>>>>>>> know
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> where to put the bean class (in the example:
>>>>>>>>> org.apache.servicemix.bean.beans.ListenerBean).
>>>>>>>>> I have tried to put it directly in the classpath and in the
>>>>>>>>>                   
>> service
>>     
>>>>>>>>>                   
>>>>>> unit
>>>>>>
>>>>>>
>>>>>>             
>>>>>>>> but
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> I get:
>>>>>>>>> ...
>>>>>>>>> Configuration problem: Bean class [
>>>>>>>>> org.apache.servicemix.bean.beans.ListenerBean] not found
>>>>>>>>> ...
>>>>>>>>>
>>>>>>>>> I am developing using Eclipse, and I am launchin servicemix using
>>>>>>>>> org.codehaus.classworlds.Launcher.
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>       
>
>   

Re: Problem with Bean Component

Posted by Javier Valdes <ja...@gmail.com>.
Lars,

You were right that was my problem.

Thank you very much for all your help.

2008/1/23, Lars Heinemann <la...@compart.net>:
>
> Javier,
>
> these annotations are from the geronimo-annotation_1.0_spec-1.0.jar.
>
> This is a dependency of the servicemix-bean's pom.
>
> So make sure you have the:
>
> <dependency>
>       <groupId>org.apache.servicemix</groupId>
>       <artifactId>servicemix-bean</artifactId>
>       <version>${servicemix-version}</version>
>     </dependency>
>
> in your bean SU's pom file.
>
> Regards,
> Lars
>
>
>
> Javier Valdes schrieb:
> > Lars,
> >
> > My problem with Java 5 (I am using jdk1.5.0_14) is that "
> > javax.annotation.Resource" cannot be found, but when I use Java 6 (
> > jdk1.6.0_04) the problem disappear. Do I need some specific jar when I
> am
> > using Java 5 that I do not need when using Java 6?
> >
> > Thanks
> >
> > 2008/1/23, Lars Heinemann <la...@compart.net>:
> >
> >> Javier,
> >>
> >> no problem.
> >> Anyway what you described sounds really strange to me.
> >> Normally it should work with Java 5 like a charm, at least it does it
> >> for me.
> >>
> >> Regards,
> >> Lars
> >>
> >>
> >>
> >> Javier Valdes schrieb:
> >>
> >>> Lars,
> >>>
> >>> I have corrected the problem: it was that I need to compile with Java
> >>> 1.6and I was using Java
> >>> 1.5.
> >>>
> >>> Thanks a lot for your answers (and speed)
> >>>
> >>> 2008/1/23, Lars Heinemann <la...@compart.net>:
> >>>
> >>>
> >>>> Javier,
> >>>>
> >>>> please make sure your bean implements the MessageExchangeListener
> >>>> interface.
> >>>> "public class MyBean implements MessageExchangeListener" for example.
> >>>>
> >>>> Then make sure you define this in your bean class as well:
> >>>>
> >>>> @Resource
> >>>> private DeliveryChannel channel;
> >>>>
> >>>> @Resource
> >>>> private ComponentContext context; // if you need the component
> context
> >>>>
> >>>> I all of this is done without getting it to work then I am a little
> >>>> curious about that.
> >>>> Maybe it helps when you post both xbean.xml and your class (throw
> your
> >>>> private things out of the bean before doing this).
> >>>>
> >>>> Regards,
> >>>> Lars
> >>>>
> >>>>
> >>>>
> >>>> Javier Valdes schrieb:
> >>>>
> >>>>
> >>>>> Thanks for answering so fast!
> >>>>>
> >>>>> I believed that I was doing what you have said but I had a problem
> >>>>>
> >> with
> >>
> >>>> my
> >>>>
> >>>>
> >>>>> project configuration.
> >>>>>
> >>>>> The problem that I have now is with:
> >>>>>
> >>>>> @Resource
> >>>>>     private DeliveryChannel channel;
> >>>>>
> >>>>>     public void onMessageExchange(MessageExchange exchange) throws
> >>>>> MessagingException {
> >>>>>         System.out.println("Received exchange: " + exchange);
> >>>>>         exchange.setStatus(ExchangeStatus.DONE);
> >>>>>         channel.send(exchange);
> >>>>>     }
> >>>>>
> >>>>>
> >>>>> Now I get a NullPointerException, when "channel.send(exchange)" is
> >>>>>
> >>>>>
> >>>> executed.
> >>>>
> >>>>
> >>>>> My problem is that the DeliveryChannel "channel" is not initialized.
> >>>>>
> >> Am
> >>
> >>>> I
> >>>>
> >>>>
> >>>>> forgetting something (like something as "@Resource")?
> >>>>>
> >>>>> Thanks again.
> >>>>>
> >>>>>
> >>>>> 2008/1/22, Lars Heinemann <la...@compart.net>:
> >>>>>
> >>>>>
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> where to put the bean class is clearly defined.
> >>>>>> In your SU you can configure via xbean.xml:
> >>>>>>
> >>>>>> <bean id="listenerBean"
> >>>>>> class="org.apache.servicemix.bean.beans.ListenerBean"/>
> >>>>>>
> >>>>>> This means that you have to place this bean class in your bean SU
> in
> >>>>>>
> >> a
> >>
> >>>>>> package called:
> >>>>>>   org.apache.servicemix.bean.beans
> >>>>>> and with the name:
> >>>>>>   ListenerBean
> >>>>>>
> >>>>>> So if you use eclipse for developing the path should be this:
> >>>>>>   <your project path>/src/org/apache/servicemix/bean/beans/
> >>>>>>
> >>>>>> Hopefully this will help you,
> >>>>>> Lars
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> Hi,
> >>>>>>>
> >>>>>>> I am trying an easy example with the bean component (the same that
> >>>>>>>
> >> can
> >>
> >>>>>>>
> >>>>>> be
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> find in http://servicemix.apache.org/servicemix-bean.html) but I
> do
> >>>>>>>
> >>>>>>>
> >>>> not
> >>>>
> >>>>
> >>>>>> know
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> where to put the bean class (in the example:
> >>>>>>> org.apache.servicemix.bean.beans.ListenerBean).
> >>>>>>> I have tried to put it directly in the classpath and in the
> service
> >>>>>>>
> >>>>>>>
> >>>> unit
> >>>>
> >>>>
> >>>>>> but
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> I get:
> >>>>>>> ...
> >>>>>>> Configuration problem: Bean class [
> >>>>>>> org.apache.servicemix.bean.beans.ListenerBean] not found
> >>>>>>> ...
> >>>>>>>
> >>>>>>> I am developing using Eclipse, and I am launchin servicemix using
> >>>>>>> org.codehaus.classworlds.Launcher.
> >>>>>>>
> >>>>>>> Thanks
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>
> >
> >
>

Re: Problem with Bean Component

Posted by Lars Heinemann <la...@compart.net>.
Javier,

these annotations are from the geronimo-annotation_1.0_spec-1.0.jar.

This is a dependency of the servicemix-bean's pom.

So make sure you have the:

 <dependency>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>servicemix-bean</artifactId>
      <version>${servicemix-version}</version>
    </dependency>

in your bean SU's pom file.

Regards,
Lars



Javier Valdes schrieb:
> Lars,
>
> My problem with Java 5 (I am using jdk1.5.0_14) is that "
> javax.annotation.Resource" cannot be found, but when I use Java 6 (
> jdk1.6.0_04) the problem disappear. Do I need some specific jar when I am
> using Java 5 that I do not need when using Java 6?
>
> Thanks
>
> 2008/1/23, Lars Heinemann <la...@compart.net>:
>   
>> Javier,
>>
>> no problem.
>> Anyway what you described sounds really strange to me.
>> Normally it should work with Java 5 like a charm, at least it does it
>> for me.
>>
>> Regards,
>> Lars
>>
>>
>>
>> Javier Valdes schrieb:
>>     
>>> Lars,
>>>
>>> I have corrected the problem: it was that I need to compile with Java
>>> 1.6and I was using Java
>>> 1.5.
>>>
>>> Thanks a lot for your answers (and speed)
>>>
>>> 2008/1/23, Lars Heinemann <la...@compart.net>:
>>>
>>>       
>>>> Javier,
>>>>
>>>> please make sure your bean implements the MessageExchangeListener
>>>> interface.
>>>> "public class MyBean implements MessageExchangeListener" for example.
>>>>
>>>> Then make sure you define this in your bean class as well:
>>>>
>>>> @Resource
>>>> private DeliveryChannel channel;
>>>>
>>>> @Resource
>>>> private ComponentContext context; // if you need the component context
>>>>
>>>> I all of this is done without getting it to work then I am a little
>>>> curious about that.
>>>> Maybe it helps when you post both xbean.xml and your class (throw your
>>>> private things out of the bean before doing this).
>>>>
>>>> Regards,
>>>> Lars
>>>>
>>>>
>>>>
>>>> Javier Valdes schrieb:
>>>>
>>>>         
>>>>> Thanks for answering so fast!
>>>>>
>>>>> I believed that I was doing what you have said but I had a problem
>>>>>           
>> with
>>     
>>>> my
>>>>
>>>>         
>>>>> project configuration.
>>>>>
>>>>> The problem that I have now is with:
>>>>>
>>>>> @Resource
>>>>>     private DeliveryChannel channel;
>>>>>
>>>>>     public void onMessageExchange(MessageExchange exchange) throws
>>>>> MessagingException {
>>>>>         System.out.println("Received exchange: " + exchange);
>>>>>         exchange.setStatus(ExchangeStatus.DONE);
>>>>>         channel.send(exchange);
>>>>>     }
>>>>>
>>>>>
>>>>> Now I get a NullPointerException, when "channel.send(exchange)" is
>>>>>
>>>>>           
>>>> executed.
>>>>
>>>>         
>>>>> My problem is that the DeliveryChannel "channel" is not initialized.
>>>>>           
>> Am
>>     
>>>> I
>>>>
>>>>         
>>>>> forgetting something (like something as "@Resource")?
>>>>>
>>>>> Thanks again.
>>>>>
>>>>>
>>>>> 2008/1/22, Lars Heinemann <la...@compart.net>:
>>>>>
>>>>>
>>>>>           
>>>>>> Hi,
>>>>>>
>>>>>> where to put the bean class is clearly defined.
>>>>>> In your SU you can configure via xbean.xml:
>>>>>>
>>>>>> <bean id="listenerBean"
>>>>>> class="org.apache.servicemix.bean.beans.ListenerBean"/>
>>>>>>
>>>>>> This means that you have to place this bean class in your bean SU in
>>>>>>             
>> a
>>     
>>>>>> package called:
>>>>>>   org.apache.servicemix.bean.beans
>>>>>> and with the name:
>>>>>>   ListenerBean
>>>>>>
>>>>>> So if you use eclipse for developing the path should be this:
>>>>>>   <your project path>/src/org/apache/servicemix/bean/beans/
>>>>>>
>>>>>> Hopefully this will help you,
>>>>>> Lars
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am trying an easy example with the bean component (the same that
>>>>>>>               
>> can
>>     
>>>>>>>               
>>>>>> be
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> find in http://servicemix.apache.org/servicemix-bean.html) but I do
>>>>>>>
>>>>>>>               
>>>> not
>>>>
>>>>         
>>>>>> know
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> where to put the bean class (in the example:
>>>>>>> org.apache.servicemix.bean.beans.ListenerBean).
>>>>>>> I have tried to put it directly in the classpath and in the service
>>>>>>>
>>>>>>>               
>>>> unit
>>>>
>>>>         
>>>>>> but
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> I get:
>>>>>>> ...
>>>>>>> Configuration problem: Bean class [
>>>>>>> org.apache.servicemix.bean.beans.ListenerBean] not found
>>>>>>> ...
>>>>>>>
>>>>>>> I am developing using Eclipse, and I am launchin servicemix using
>>>>>>> org.codehaus.classworlds.Launcher.
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>       
>
>   

Re: Problem with Bean Component

Posted by Javier Valdes <ja...@gmail.com>.
Lars,

My problem with Java 5 (I am using jdk1.5.0_14) is that "
javax.annotation.Resource" cannot be found, but when I use Java 6 (
jdk1.6.0_04) the problem disappear. Do I need some specific jar when I am
using Java 5 that I do not need when using Java 6?

Thanks

2008/1/23, Lars Heinemann <la...@compart.net>:
>
> Javier,
>
> no problem.
> Anyway what you described sounds really strange to me.
> Normally it should work with Java 5 like a charm, at least it does it
> for me.
>
> Regards,
> Lars
>
>
>
> Javier Valdes schrieb:
> > Lars,
> >
> > I have corrected the problem: it was that I need to compile with Java
> > 1.6and I was using Java
> > 1.5.
> >
> > Thanks a lot for your answers (and speed)
> >
> > 2008/1/23, Lars Heinemann <la...@compart.net>:
> >
> >> Javier,
> >>
> >> please make sure your bean implements the MessageExchangeListener
> >> interface.
> >> "public class MyBean implements MessageExchangeListener" for example.
> >>
> >> Then make sure you define this in your bean class as well:
> >>
> >> @Resource
> >> private DeliveryChannel channel;
> >>
> >> @Resource
> >> private ComponentContext context; // if you need the component context
> >>
> >> I all of this is done without getting it to work then I am a little
> >> curious about that.
> >> Maybe it helps when you post both xbean.xml and your class (throw your
> >> private things out of the bean before doing this).
> >>
> >> Regards,
> >> Lars
> >>
> >>
> >>
> >> Javier Valdes schrieb:
> >>
> >>> Thanks for answering so fast!
> >>>
> >>> I believed that I was doing what you have said but I had a problem
> with
> >>>
> >> my
> >>
> >>> project configuration.
> >>>
> >>> The problem that I have now is with:
> >>>
> >>> @Resource
> >>>     private DeliveryChannel channel;
> >>>
> >>>     public void onMessageExchange(MessageExchange exchange) throws
> >>> MessagingException {
> >>>         System.out.println("Received exchange: " + exchange);
> >>>         exchange.setStatus(ExchangeStatus.DONE);
> >>>         channel.send(exchange);
> >>>     }
> >>>
> >>>
> >>> Now I get a NullPointerException, when "channel.send(exchange)" is
> >>>
> >> executed.
> >>
> >>> My problem is that the DeliveryChannel "channel" is not initialized.
> Am
> >>>
> >> I
> >>
> >>> forgetting something (like something as "@Resource")?
> >>>
> >>> Thanks again.
> >>>
> >>>
> >>> 2008/1/22, Lars Heinemann <la...@compart.net>:
> >>>
> >>>
> >>>> Hi,
> >>>>
> >>>> where to put the bean class is clearly defined.
> >>>> In your SU you can configure via xbean.xml:
> >>>>
> >>>> <bean id="listenerBean"
> >>>> class="org.apache.servicemix.bean.beans.ListenerBean"/>
> >>>>
> >>>> This means that you have to place this bean class in your bean SU in
> a
> >>>> package called:
> >>>>   org.apache.servicemix.bean.beans
> >>>> and with the name:
> >>>>   ListenerBean
> >>>>
> >>>> So if you use eclipse for developing the path should be this:
> >>>>   <your project path>/src/org/apache/servicemix/bean/beans/
> >>>>
> >>>> Hopefully this will help you,
> >>>> Lars
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> I am trying an easy example with the bean component (the same that
> can
> >>>>>
> >>>>>
> >>>> be
> >>>>
> >>>>
> >>>>> find in http://servicemix.apache.org/servicemix-bean.html) but I do
> >>>>>
> >> not
> >>
> >>>> know
> >>>>
> >>>>
> >>>>> where to put the bean class (in the example:
> >>>>> org.apache.servicemix.bean.beans.ListenerBean).
> >>>>> I have tried to put it directly in the classpath and in the service
> >>>>>
> >> unit
> >>
> >>>> but
> >>>>
> >>>>
> >>>>> I get:
> >>>>> ...
> >>>>> Configuration problem: Bean class [
> >>>>> org.apache.servicemix.bean.beans.ListenerBean] not found
> >>>>> ...
> >>>>>
> >>>>> I am developing using Eclipse, and I am launchin servicemix using
> >>>>> org.codehaus.classworlds.Launcher.
> >>>>>
> >>>>> Thanks
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>
> >
> >
>

Re: Problem with Bean Component

Posted by Lars Heinemann <la...@compart.net>.
Javier,

no problem.
Anyway what you described sounds really strange to me.
Normally it should work with Java 5 like a charm, at least it does it 
for me.

Regards,
Lars



Javier Valdes schrieb:
> Lars,
>
> I have corrected the problem: it was that I need to compile with Java
> 1.6and I was using Java
> 1.5.
>
> Thanks a lot for your answers (and speed)
>
> 2008/1/23, Lars Heinemann <la...@compart.net>:
>   
>> Javier,
>>
>> please make sure your bean implements the MessageExchangeListener
>> interface.
>> "public class MyBean implements MessageExchangeListener" for example.
>>
>> Then make sure you define this in your bean class as well:
>>
>> @Resource
>> private DeliveryChannel channel;
>>
>> @Resource
>> private ComponentContext context; // if you need the component context
>>
>> I all of this is done without getting it to work then I am a little
>> curious about that.
>> Maybe it helps when you post both xbean.xml and your class (throw your
>> private things out of the bean before doing this).
>>
>> Regards,
>> Lars
>>
>>
>>
>> Javier Valdes schrieb:
>>     
>>> Thanks for answering so fast!
>>>
>>> I believed that I was doing what you have said but I had a problem with
>>>       
>> my
>>     
>>> project configuration.
>>>
>>> The problem that I have now is with:
>>>
>>> @Resource
>>>     private DeliveryChannel channel;
>>>
>>>     public void onMessageExchange(MessageExchange exchange) throws
>>> MessagingException {
>>>         System.out.println("Received exchange: " + exchange);
>>>         exchange.setStatus(ExchangeStatus.DONE);
>>>         channel.send(exchange);
>>>     }
>>>
>>>
>>> Now I get a NullPointerException, when "channel.send(exchange)" is
>>>       
>> executed.
>>     
>>> My problem is that the DeliveryChannel "channel" is not initialized. Am
>>>       
>> I
>>     
>>> forgetting something (like something as "@Resource")?
>>>
>>> Thanks again.
>>>
>>>
>>> 2008/1/22, Lars Heinemann <la...@compart.net>:
>>>
>>>       
>>>> Hi,
>>>>
>>>> where to put the bean class is clearly defined.
>>>> In your SU you can configure via xbean.xml:
>>>>
>>>> <bean id="listenerBean"
>>>> class="org.apache.servicemix.bean.beans.ListenerBean"/>
>>>>
>>>> This means that you have to place this bean class in your bean SU in a
>>>> package called:
>>>>   org.apache.servicemix.bean.beans
>>>> and with the name:
>>>>   ListenerBean
>>>>
>>>> So if you use eclipse for developing the path should be this:
>>>>   <your project path>/src/org/apache/servicemix/bean/beans/
>>>>
>>>> Hopefully this will help you,
>>>> Lars
>>>>
>>>>
>>>>
>>>>         
>>>>> Hi,
>>>>>
>>>>> I am trying an easy example with the bean component (the same that can
>>>>>
>>>>>           
>>>> be
>>>>
>>>>         
>>>>> find in http://servicemix.apache.org/servicemix-bean.html) but I do
>>>>>           
>> not
>>     
>>>> know
>>>>
>>>>         
>>>>> where to put the bean class (in the example:
>>>>> org.apache.servicemix.bean.beans.ListenerBean).
>>>>> I have tried to put it directly in the classpath and in the service
>>>>>           
>> unit
>>     
>>>> but
>>>>
>>>>         
>>>>> I get:
>>>>> ...
>>>>> Configuration problem: Bean class [
>>>>> org.apache.servicemix.bean.beans.ListenerBean] not found
>>>>> ...
>>>>>
>>>>> I am developing using Eclipse, and I am launchin servicemix using
>>>>> org.codehaus.classworlds.Launcher.
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>>>           
>>>       
>
>   

Re: Problem with Bean Component

Posted by Javier Valdes <ja...@gmail.com>.
Lars,

I have corrected the problem: it was that I need to compile with Java
1.6and I was using Java
1.5.

Thanks a lot for your answers (and speed)

2008/1/23, Lars Heinemann <la...@compart.net>:
>
> Javier,
>
> please make sure your bean implements the MessageExchangeListener
> interface.
> "public class MyBean implements MessageExchangeListener" for example.
>
> Then make sure you define this in your bean class as well:
>
> @Resource
> private DeliveryChannel channel;
>
> @Resource
> private ComponentContext context; // if you need the component context
>
> I all of this is done without getting it to work then I am a little
> curious about that.
> Maybe it helps when you post both xbean.xml and your class (throw your
> private things out of the bean before doing this).
>
> Regards,
> Lars
>
>
>
> Javier Valdes schrieb:
> > Thanks for answering so fast!
> >
> > I believed that I was doing what you have said but I had a problem with
> my
> > project configuration.
> >
> > The problem that I have now is with:
> >
> > @Resource
> >     private DeliveryChannel channel;
> >
> >     public void onMessageExchange(MessageExchange exchange) throws
> > MessagingException {
> >         System.out.println("Received exchange: " + exchange);
> >         exchange.setStatus(ExchangeStatus.DONE);
> >         channel.send(exchange);
> >     }
> >
> >
> > Now I get a NullPointerException, when "channel.send(exchange)" is
> executed.
> > My problem is that the DeliveryChannel "channel" is not initialized. Am
> I
> > forgetting something (like something as "@Resource")?
> >
> > Thanks again.
> >
> >
> > 2008/1/22, Lars Heinemann <la...@compart.net>:
> >
> >> Hi,
> >>
> >> where to put the bean class is clearly defined.
> >> In your SU you can configure via xbean.xml:
> >>
> >> <bean id="listenerBean"
> >> class="org.apache.servicemix.bean.beans.ListenerBean"/>
> >>
> >> This means that you have to place this bean class in your bean SU in a
> >> package called:
> >>   org.apache.servicemix.bean.beans
> >> and with the name:
> >>   ListenerBean
> >>
> >> So if you use eclipse for developing the path should be this:
> >>   <your project path>/src/org/apache/servicemix/bean/beans/
> >>
> >> Hopefully this will help you,
> >> Lars
> >>
> >>
> >>
> >>> Hi,
> >>>
> >>> I am trying an easy example with the bean component (the same that can
> >>>
> >> be
> >>
> >>> find in http://servicemix.apache.org/servicemix-bean.html) but I do
> not
> >>>
> >> know
> >>
> >>> where to put the bean class (in the example:
> >>> org.apache.servicemix.bean.beans.ListenerBean).
> >>> I have tried to put it directly in the classpath and in the service
> unit
> >>>
> >> but
> >>
> >>> I get:
> >>> ...
> >>> Configuration problem: Bean class [
> >>> org.apache.servicemix.bean.beans.ListenerBean] not found
> >>> ...
> >>>
> >>> I am developing using Eclipse, and I am launchin servicemix using
> >>> org.codehaus.classworlds.Launcher.
> >>>
> >>> Thanks
> >>>
> >>>
> >>>
> >
> >
>

Re: Problem with Bean Component

Posted by Lars Heinemann <la...@compart.net>.
Javier,

please make sure your bean implements the MessageExchangeListener interface.
"public class MyBean implements MessageExchangeListener" for example.

Then make sure you define this in your bean class as well:

@Resource
private DeliveryChannel channel;
   
@Resource
private ComponentContext context; // if you need the component context

I all of this is done without getting it to work then I am a little 
curious about that.
Maybe it helps when you post both xbean.xml and your class (throw your 
private things out of the bean before doing this).

Regards,
Lars



Javier Valdes schrieb:
> Thanks for answering so fast!
>
> I believed that I was doing what you have said but I had a problem with my
> project configuration.
>
> The problem that I have now is with:
>
> @Resource
>     private DeliveryChannel channel;
>
>     public void onMessageExchange(MessageExchange exchange) throws
> MessagingException {
>         System.out.println("Received exchange: " + exchange);
>         exchange.setStatus(ExchangeStatus.DONE);
>         channel.send(exchange);
>     }
>
>
> Now I get a NullPointerException, when "channel.send(exchange)" is executed.
> My problem is that the DeliveryChannel "channel" is not initialized. Am I
> forgetting something (like something as "@Resource")?
>
> Thanks again.
>
>
> 2008/1/22, Lars Heinemann <la...@compart.net>:
>   
>> Hi,
>>
>> where to put the bean class is clearly defined.
>> In your SU you can configure via xbean.xml:
>>
>> <bean id="listenerBean"
>> class="org.apache.servicemix.bean.beans.ListenerBean"/>
>>
>> This means that you have to place this bean class in your bean SU in a
>> package called:
>>   org.apache.servicemix.bean.beans
>> and with the name:
>>   ListenerBean
>>
>> So if you use eclipse for developing the path should be this:
>>   <your project path>/src/org/apache/servicemix/bean/beans/
>>
>> Hopefully this will help you,
>> Lars
>>
>>
>>     
>>> Hi,
>>>
>>> I am trying an easy example with the bean component (the same that can
>>>       
>> be
>>     
>>> find in http://servicemix.apache.org/servicemix-bean.html) but I do not
>>>       
>> know
>>     
>>> where to put the bean class (in the example:
>>> org.apache.servicemix.bean.beans.ListenerBean).
>>> I have tried to put it directly in the classpath and in the service unit
>>>       
>> but
>>     
>>> I get:
>>> ...
>>> Configuration problem: Bean class [
>>> org.apache.servicemix.bean.beans.ListenerBean] not found
>>> ...
>>>
>>> I am developing using Eclipse, and I am launchin servicemix using
>>> org.codehaus.classworlds.Launcher.
>>>
>>> Thanks
>>>
>>>
>>>       
>
>   

Re: Problem with Bean Component

Posted by Javier Valdes <ja...@gmail.com>.
Thanks for answering so fast!

I believed that I was doing what you have said but I had a problem with my
project configuration.

The problem that I have now is with:

@Resource
    private DeliveryChannel channel;

    public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
        System.out.println("Received exchange: " + exchange);
        exchange.setStatus(ExchangeStatus.DONE);
        channel.send(exchange);
    }


Now I get a NullPointerException, when "channel.send(exchange)" is executed.
My problem is that the DeliveryChannel "channel" is not initialized. Am I
forgetting something (like something as "@Resource")?

Thanks again.


2008/1/22, Lars Heinemann <la...@compart.net>:
>
> Hi,
>
> where to put the bean class is clearly defined.
> In your SU you can configure via xbean.xml:
>
> <bean id="listenerBean"
> class="org.apache.servicemix.bean.beans.ListenerBean"/>
>
> This means that you have to place this bean class in your bean SU in a
> package called:
>   org.apache.servicemix.bean.beans
> and with the name:
>   ListenerBean
>
> So if you use eclipse for developing the path should be this:
>   <your project path>/src/org/apache/servicemix/bean/beans/
>
> Hopefully this will help you,
> Lars
>
>
> > Hi,
> >
> > I am trying an easy example with the bean component (the same that can
> be
> > find in http://servicemix.apache.org/servicemix-bean.html) but I do not
> know
> > where to put the bean class (in the example:
> > org.apache.servicemix.bean.beans.ListenerBean).
> > I have tried to put it directly in the classpath and in the service unit
> but
> > I get:
> > ...
> > Configuration problem: Bean class [
> > org.apache.servicemix.bean.beans.ListenerBean] not found
> > ...
> >
> > I am developing using Eclipse, and I am launchin servicemix using
> > org.codehaus.classworlds.Launcher.
> >
> > Thanks
> >
> >
>

Re: Problem with Bean Component

Posted by Lars Heinemann <la...@compart.net>.
Hi,

where to put the bean class is clearly defined.
In your SU you can configure via xbean.xml:

<bean id="listenerBean" 
class="org.apache.servicemix.bean.beans.ListenerBean"/>

This means that you have to place this bean class in your bean SU in a 
package called:
  org.apache.servicemix.bean.beans
and with the name:
  ListenerBean

So if you use eclipse for developing the path should be this:
  <your project path>/src/org/apache/servicemix/bean/beans/

Hopefully this will help you,
Lars


> Hi,
>
> I am trying an easy example with the bean component (the same that can be
> find in http://servicemix.apache.org/servicemix-bean.html) but I do not know
> where to put the bean class (in the example:
> org.apache.servicemix.bean.beans.ListenerBean).
> I have tried to put it directly in the classpath and in the service unit but
> I get:
> ...
> Configuration problem: Bean class [
> org.apache.servicemix.bean.beans.ListenerBean] not found
> ...
>
> I am developing using Eclipse, and I am launchin servicemix using
> org.codehaus.classworlds.Launcher.
>
> Thanks
>
>