The settup you want is the normal way for stateful session beans to work. A
reference to the stateful session remote interface for each client will resolve
to the original instance. thus, statefull session beans serve a single client
as opposed to stateless session beans which are served up by the container from
a pool on each request.
If you set the scope to session rather than application you should be fine and
it will only call the constructor to create the bean once for each thread.
Regards
Steve
Quoting karim <[EMAIL PROTECTED]>:
> Hi axis users,
> I'm new to Axis and I've got a problem using it.
> I would like to know if someone had already experimented it :
> In a nutshell, I've created and deployed a service S1 that acts like a
> mediator.
> This service creates and use a stateful session EJB E1.
>
> When my client C1 invoke one method of the service, everything works
> well and data added by C1 are saved during the session.
> To do so, I had to add in my wsdl file the line
> <parameter name="scope" value="Application"/>
> in order to let my service acting like a singleton(if not, it calls
> always the default constructor).
>
> So, with only one client, my app works well.
>
> I wanted to test it with two client so I ran 2 threads corresponding to
> 2 different clients and I got the following error :
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: javax.ejb.EJBException: Second thread call to stateful
> session bean
> faultActor:
> faultNode:
> faultDetail:
> {http://xml.apache.org/axis/}stackTrace:AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: javax.ejb.EJBException: Second thread call to stateful
> session bean
> faultActor:
> faultNode:
> faultDetail:
> javax.ejb.EJBException: Second thread call to stateful session bean
> at
> org.apache.axis.message.SOAPFaultBuilder.createFault
(SOAPFaultBuilder.java:262)
> at
> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
> at
> org.apache.axis.encoding.DeserializationContextImpl.endElement
(DeserializationContextImpl.java:1092)
> ...
>
> It seems that there'is only one session for all the users.
> I think that the fact that my service is declared like a Singleton may
> be the cause of this error but I'm not sure.
>
> It seems that my app acts like this :
>
> C1 ----- |
> |---|----S1----E1
> C2 ----- |
> local | Server
>
> But I would rather that it acts like that :
>
> C1 --------|----S1-----E1
> |
> C2 --------|----S2-----E2
> local | Server
>
> And S1 and S2 acts like Singleton but only in there Session.
>
> If someone already experiments this problem,
> I would be glad to know how he solved it...
>
> Cheers,
> Karim
>
>