users@glassfish.java.net

RE: Bundle warning messages: MDBContainer/Current thread done cleanup message, Bundle already deployed

From: Robert Weeks <RWeeks_at_ext-inc.com>
Date: Thu, 26 May 2011 04:27:08 -0700

Hi Sahoo -

> First of all I don't understand the need to export an MDB as a service.
> Who calls this service? Isn't it supposed to be automatically invoked by
> the messaging system when there is a message? So, you should really use
> NONE as the value for Export-EJB unless you have other EJBs.

Thanks - yes - I don't need to export as a service. This was just me trying to see about the MDB error honestly - I have it setup to None:

Export-EJB: None

If I have others, I list them directly.

> The "Current thread done cleanup()" message can be ignored. It comes
> from mdb container - just filed
> http://java.net/jira/browse/GLASSFISH-16724 - it appears to me that the
> developer there either forgot to fix the TODO or change the log level.
> It happens for normal mdb jar as well - nothing OSGi specific here.

That's good to know - I will mark that in our notes.

> I am actually concerned about the message:
>
> Bundle com.ext_inc.systemmanager.SystemManager [265] is already deployed at
>
> How are you deploying your bundle? Which GF build are you using?

This was my bigger concern as well - I am using 3.1 release.

We deploy in the autodeploy/bundles directory (we have many other bundles running as well in this manner).

Our "SystemManager" bundle is using Declarative Services to register servlets and other resources.
The SystemManager is registered as a Service, and using DS one of the servlets is trying to bind to it - which does work fine - but when restarting the server - the message above is coming about (only on this bundle).

This seems to only happen when using this (with the @Component annotation - using bnd to build the bundle) - example (we derive the alias dynamically, which is why that property is not a part of the @Component annotation on this one):

@Component(provide = HttpServlet.class)
public class SystemManagerProxy extends SystemManagerServletSupport {
    private SystemManagerService systemManager;
    private HttpService http;
    ...

    protected void setHttp(HttpService http) {
        this.http = http;
        registerHttpResources();
    }

    protected void unsetHttp(HttpService http) {
        unregisterHttpResources();
        this.http = null;
    }

    protected void setSystemManager(SystemManagerService systemManager) {
        this.systemManager = systemManager;
    }

    protected void unsetSystemManager(SystemManagerService systemManager) {
        this.systemManager = null;
    }
}



bnd file before compilation:

Service-Component: com.ext_inc.systemmanager.servlets.SystemManagerProxy;\
  http=org.osgi.service.http.HttpService;\
  systemManager=com.ext_inc.systemmanager.service.SystemManagerService


which creates the xml file like:

OSGI-INF/com.ext_inc.systemmanager.servlets.SystemManagerProxy.xml

Which has:

<?xml version='1.0' encoding='utf-8'?>
<component name='com.ext_inc.systemmanager.servlets.SystemManagerProxy'>
  <implementation class='com.ext_inc.systemmanager.servlets.SystemManagerProxy'/>
  <service>
    <provide interface='javax.servlet.http.HttpServlet'/>
  </service>
  <reference name='systemManager' interface='com.ext_inc.systemmanager.service.SystemManagerService' bind='setSystemManager' unbind='unsetSystemManager'/>
  <reference name='http' interface='org.osgi.service.http.HttpService' bind='setHttp' unbind='unsetHttp'/>
</component>


I am not sure if I am not doing something correctly here or just missing something.

I am registering the service in my activator start|stop:

  start:
    props.put(Constants.SERVICE_PID, "com.ext_inc.systemmanager.SystemManagerService");
    context.registerService(SystemManager.ServiceReference, sysMgr, props);

  stop:
    context.ungetService(context.getServiceReference(SystemManager.ServiceReference));


Thanks for any insight.


Robert Weeks
Senior Software Developer
EXTENSION, INC.
Email: rweeks_at_ext-inc.com
Office: 260-797-0200 x4228
General: 877-207-3753
www.OpenTheRedBox.com

Download the FREE EXTENSION Mobile App for iPhone and iPod Touch
http://www.opentheredbox.com/iPhone_appDemo.php