This may be a problem in the log system rather than a problem in
servicemix-bean.
If only one stack trace is displayed, this certainly means the method
is only called once.
On Mon, Oct 6, 2008 at 10:29 AM, steff aka sid
<[EMAIL PROTECTED]> wrote:
>
> Ok, here is the output:
> INFO - ClusteringBean -
> [EMAIL PROTECTED]
> INFO - ClusteringBean -
> [EMAIL PROTECTED]
> INFO - ClusteringBean - ClusteringBean initialized!
> INFO - ClusteringBean - ClusteringBean initialized!
> java.lang.Throwable
> at
> de.brockhaus-gruppe.beans.ClusteringBean.init(ClusteringBean.java:143)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.apache.servicemix.bean.support.ReflectionUtils$1.doWith(ReflectionUtils.java:32)
> at
> org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:226)
> at
> org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:203)
> at
> org.apache.servicemix.bean.support.ReflectionUtils.callLifecycleMethod(ReflectionUtils.java:28)
> at
> org.apache.servicemix.bean.BeanEndpoint.start(BeanEndpoint.java:111)
> at
> org.apache.servicemix.common.endpoints.SimpleEndpoint.activate(SimpleEndpoint.java:55)
> at
> org.apache.servicemix.common.ServiceUnit.start(ServiceUnit.java:53)
> at
> org.apache.servicemix.common.BaseServiceUnitManager.start(BaseServiceUnitManager.java:151)
> at
> org.apache.servicemix.jbi.framework.ServiceUnitLifeCycle.start(ServiceUnitLifeCycle.java:103)
> at
> org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.start(ServiceAssemblyLifeCycle.java:132)
> at
> org.apache.servicemix.jbi.framework.DeploymentService.start(DeploymentService.java:378)
> at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateServiceAssembly(AutoDeploymentService.java:355)
> at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:256)
> at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:664)
> at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
> at
> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:628)
> at java.util.TimerThread.mainLoop(Timer.java:512)
> at java.util.TimerThread.run(Timer.java:462)
>
> for me this looks a little bit strange here is what I added:
> log.info(this);
> log.info("ClusteringBean initialized!");
> new Throwable().printStackTrace();
>
> But why do we get only one stacktrace? (BeanID looks like one object but all
> what I have is processed twice.
>
> Regards
> /Steffen
>
>
> gnodet wrote:
>>
>> Looks like a bug. Could you try adding a
>> new Throwable().printStackTrace();
>>
>> statement just below your log.info() statement to determine when the
>> method is called ?
>>
>> On Mon, Oct 6, 2008 at 10:11 AM, steff aka sid
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> Hm ok, but do you have an example for that? I currently configure my bean
>>> using xbean configuration file like the following:
>>>
>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>> xmlns:bean="http://servicemix.apache.org/bean/1.0"
>>> xmlns:brockhaus="http://brockhaus-gruppe.de/services/category"
>>> xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://servicemix.apache.org/bean/1.0
>>> http://servicemix.apache.org/schema/servicemix-bean-3.2.2.xsd
>>> http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>>>
>>> <bean:endpoint service="brockhaus:categoryClusteringBean"
>>> endpoint="endpoint" bean="#ClusteringBean"/>
>>>
>>> <bean id="ClusteringBean"
>>> class="de.brockhaus-gruppe.beans.ClusteringBean"/>
>>>
>>> </beans>
>>>
>>> Regards
>>> /Steffen
>>>
>>> gnodet wrote:
>>>>
>>>> Using servicemix-bean, you can either configure a bean or the bean
>>>> class.
>>>> If you configure the bean directly, only that instance will be used to
>>>> service all requests, whereas if you use the bean class, a new bean
>>>> will be created for each request.
>>>>
>>>> On Mon, Oct 6, 2008 at 9:55 AM, steff aka sid
>>>> <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>> Hi is it possible to have only one instance of an bean component (like
>>>>> a
>>>>> singleton)? I've created serveral beans but all seem to have two
>>>>> instances.
>>>>> In example I've got a init()-Method like:
>>>>>
>>>>> @PostConstruct
>>>>> public void init() throws IOException, MessagingException {
>>>>> if (null == this.context || null == this.channel) {
>>>>> throw new IllegalStateException("ClusteringBean
>>>>> not initialized!");
>>>>> }
>>>>>
>>>>> log.info("ClusteringBean initialized!");
>>>>> }
>>>>>
>>>>> When I deploy this component I get:
>>>>>
>>>>> INFO - ClusteringBean - ClusteringBean initialized!
>>>>> INFO - ClusteringBean - ClusteringBean initialized!
>>>>>
>>>>> And even each logging output I create in bean will be printed twice.
>>>>> But
>>>>> I
>>>>> only need one instance. The beans are MessageExchangeListeners. Maybe
>>>>> there
>>>>> is a better way to create such beans? I've thought about
>>>>> servicemix-jsr181
>>>>> component but not sure for that.
>>>>>
>>>>> Regards
>>>>> /steffen
>>>>>
>>>>> -----
>>>>> Brockhaus GmbH
>>>>> COMPETITIVE THROUGH KNOWLEDGE
>>>>>
>>>>> Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
>>>>> http://www.brockhaus-group.com www.brockhaus-group.com
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/servicemix-bean-singleton-tp19833428p19833428.html
>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> Guillaume Nodet
>>>> ------------------------
>>>> Blog: http://gnodet.blogspot.com/
>>>> ------------------------
>>>> Open Source SOA
>>>> http://open.iona.com
>>>>
>>>>
>>>
>>>
>>> -----
>>> Brockhaus GmbH
>>> COMPETITIVE THROUGH KNOWLEDGE
>>>
>>> Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
>>> http://www.brockhaus-group.com www.brockhaus-group.com
>>> --
>>> View this message in context:
>>> http://www.nabble.com/servicemix-bean-singleton-tp19833428p19833614.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> ------------------------
>> Open Source SOA
>> http://open.iona.com
>>
>>
>
>
> -----
> Brockhaus GmbH
> COMPETITIVE THROUGH KNOWLEDGE
>
> Web: http://www.brockhaus-gruppe.de www.brockhaus-gruppe.de /
> http://www.brockhaus-group.com www.brockhaus-group.com
> --
> View this message in context:
> http://www.nabble.com/servicemix-bean-singleton-tp19833428p19833838.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://open.iona.com