users@glassfish.java.net

cannot access the output of ServiceTracker.getServices when services are exposed with EXPORT-EJB

From: Lena Svetlov <svetloe_at_hotmail.com>
Date: Wed, 29 Jun 2011 13:45:14 +0000

Hi

(Environment details: I use Glassfish 3.1, GA build)

I use EXPORT-EJB: ALL to export 3 beans. In another bundle I get these services using ServiceTracker.getServices API.
The problem is that many times I get an exception if I invoke a method on the object returned from getService():

[#|2011-06-29T15:55:47.105+0300|WARNING|glassfish3.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=149;_ThreadName=Thread-1;|A system exception occurred during an invocation on EJB DemoService method public java.lang.String com.demo.bl.DemoService.getID()
javax.ejb.TransactionRolledbackLocalException: Client's transaction aborted
    at com.sun.ejb.containers.BaseContainer.useClientTx(BaseContainer.java:4700)
    at com.sun.ejb.containers.BaseContainer.preInvokeTx(BaseContainer.java:4578)
    at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1910)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:212)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
    at $Proxy319.getID(Unknown Source)


Looks like a service tracker contains a reference to EJB that was already destroyed.
If instead of exposing EJB I register OSGI service, I don't get this exception
It it a known bug?

thank you