Mantis - Resin
Viewing Issue Advanced Details
3543 major always 06-01-09 22:01 06-04-09 15:30
closed 4.0.0  
none 4.0.1  
0003543: Hessian @ApplicationScoped Servelet-Mapping Class created multiple times.
Creating an @ApplicationScoped class and adding a mapping to expose it via hessian (like below).
    <servlet-mapping url-pattern="/api/Echo" servlet-class="test.EchoService">
        <protocol uri="hessian:"/>

Causes multiple instances to be created of the class.

Here is a test project that exemplifies the problem: [^]
Here is the original email sent on May 15th:

ScottH and I have spent some time (fortunately, well-spent time in a
pub with wifi and a deep reserve of Magners) trying to figure out why
one of our @ApplicationScoped objects seems to have several instances
in the container. The problem seems to be when you declare the
<servlet-mapping> in resin-web.xml.

We have a test with two beans, EchoService (@Stateless) and
DeeperService (@ApplicationScoped). EchoService calls DeeperService,
which logs the object id.

When DeeperService has no <servlet-mapping>, calls to EchoService
always return the same DeeperService instance. When DeeperService also has
a <servlet-mapping>, calls to EchoService return different
DeeperService instance.

Code to demonstrate this is here: [^]

This is a bug, right?


06-04-09 15:30