Results 1 to 6 of 6

Thread: BundleException when bundle stops

  1. #1
    Join Date
    Jun 2007
    Location
    Nantes, France
    Posts
    44

    Default BundleException when bundle stops

    Hi,

    I get a BundleException when one of my bundle stops. This bundle contains the following beans definitions :
    Code:
    	<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
    		<property name="corePoolSize" value="5" />
    		<property name="maxPoolSize" value="10" />
    		<property name="queueCapacity" value="25" />
    	</bean>
    
    	<bean id="EventPublisherServiceBean" class="org.escapek.core.internal.event.EventPublisherService"
    		init-method="init" destroy-method="destroy">
    		<property name="taskExecutor" ref="taskExecutor"></property>
    		<property name="listeners" ref="EventListeners"></property>
    	</bean>
    	<bean id="EventLoggingListenerBean" 
    		class="org.escapek.core.internal.event.EventLoggingListener" />
    and
    Code:
    	<list id="EventListeners" cardinality="0..N" 
    			interface="org.escapek.core.event.IEventListener">
    	</list>
    
    	<service ref="EventPublisherServiceBean"
    		interface="org.escapek.core.event.IEventPublisher" />
    	<service ref="EventLoggingListenerBean" 
    		interface="org.escapek.core.event.IEventListener" />
    The EventPublisherServiceBean depends on a service reference lists and registers itself as an exorted service. The definition shows that init-method and destroy-method are called on when the bean is created/destroyed. Inside the method, I create a thread which does some stuffs. Inside the destroy method the thread stops.
    now it happens that when this bundles is stopped, I get a BundleException. The full stack trace is attached to this post. It shows that the exception is thrown when EventPublicherServiceBean service references list is destroyed.
    Attached Files Attached Files
    EscapeK - http://www.escapek.org - Open source project for IT ecosystem management

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    By the looks of it, it seems that during destruction, the collection cleanup method triggers some class loading on the bundle that is destroyed which, under Equinox, complains about it (as it's getting started again).
    I'm not sure why the class loading is triggered since Spring-DM itself doesn't execute any class loading itself - it just tried to get a ServiceReference which should be loaded (since it's part of the OSGi framework).
    What version of Equinox are you using?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    I've raised an issue at: http://jira.springframework.org/browse/OSGI-602. Please add any details about your configuration (Spring-DM, Equinox, VM version used) in there.
    At first glance, the exception is really puzzling since it seems that calling a method causes class loading which shouldn't happen since the object is already loaded and in use.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  4. #4
    Join Date
    Jun 2007
    Location
    Nantes, France
    Posts
    44

    Default

    I've updated the issue.
    I don't know if you've that, but my bundle export one service of interface type org.escapek.core.event.IEventListener for the bean EventLoggingListenerBean. This means that this bean will be part of the service collection EventListeners. May be the problem comes from here : destruction of a collection element from the bundle which is being destroyed.
    I remember a previous thread where I was trying to get a service reference on a service exported in the same bundle. You told me that was not supported. May be that's the same kind of problem : one of the service in the list is exported in the same bundle.
    EscapeK - http://www.escapek.org - Open source project for IT ecosystem management

  5. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Exporting a service (object instance) and importing it in the same bundle is not supported. However, in this case, my understanding is that we are talking about types, which need to be resolved before the bundle starts.
    Do you export and the import the service inside the same bundle?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  6. #6
    Join Date
    Jun 2007
    Location
    Nantes, France
    Posts
    44

    Default

    I'm not sure to understand what you're asking.
    If you look back the xml definitions I've posted, you'll that EventLoggingListenerBean is exported as a service implementing org.escapek.core.event.IEventListener . In the same bundle , EventListeners imports all the service implementing org.escapek.core.event.IEventListener.
    Concerning types org.escapek.core.event.IEventListener is defined in the same bundle and is part of Export-Package.
    EscapeK - http://www.escapek.org - Open source project for IT ecosystem management

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •