Hi,

 I'm new to CXF and have what appears to be a concurrency issue using a CXF
web service in a web application. When load testing the application using
JMeter I sometimes end up getting incomplete results returned from the cxf
framework (i.e. objects with uninstantiated/null variables). Even though I
can verify using a LoggingInInterceptor on the client, that the web service
always returns the correct result.

I've included example code that reproduces the problem.

 The client is created and calls a service from within in a struts2 action:

*JaxWsProxyFactoryBean proxyFactoryBean = new JaxWsProxyFactoryBean();
proxyFactoryBean.setServiceClass(MyTestService.class);
String serviceURL = "http://"; + request.getServerName() + ":" +
request.getServerPort() + SERVICE_NAME;
proxyFactoryBean.setAddress(serviceURL);
serviceProxy = (MyTestService) proxyFactoryBean.create();
PojoMap pojoMap = serviceProxy.getPojoList(someString0, someString1);*

//occasionally under load pojoMap.getPojoMap() will return null

Service interface:

@WebService
public interface MyTestService {
    public PojoMap getPojoList(
        @WebParam(name = "arg0") String arg0,
        @WebParam(name = "arg1") String arg1) throws Exception;
}

Service implementation:
@WebService(name = "MyTestServicePreLoaded", serviceName =
"MyTestServiceName")
public class MyTestServiceImpl implements MyTestService {
    public MyTestServiceImpl() {
        super();
    }
    @Override
    public PojoMap getPojoList(String arg0, String arg1) throws Exception {
        PojoMap pojoMap = performWork(arg0, arg1);
        return pojoMap;
    }

    private PojoMap performWork(String arg0, String arg1) {
        Map<String, PojoMapList> pml = new HashMap<String, PojoMapList>();
        PojoMapList pojoMapList = new PojoMapList();
        List<String> list = new ArrayList<String>();
        list.add(arg1);
        pojoMapList.setPojoMapList(list);
        pml.put(arg0, pojoMapList);
        PojoMap pojoMap = PojoMapFactory.createPojoMap(pml);
        return pojoMap;
    }
}

The objects being returned from the service:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class PojoMap {
    private Map<String, PojoMapList> pojoMap;
    public Map<String, PojoMapList> getPojoMap() {
        return pojoMap;

    }
    public void setPojoMap(Map<String, PojoMapList> pojoMap) {
        this.pojoMap = pojoMap;
    }
}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class PojoMapList {

    private List<String> pojoMapList;
    public List<String> getPojoMapList() {
        return pojoMapList;
    }
    public void setPojoMapList(List<String> pojoMapList) {
        this.pojoMapList = pojoMapList;
    }
}

For testing purposes both client and service are deployed in the same
tomcat instance (tomcat 6). I'm using the latest (2.5.0) CXF release. Using
the same created JaxWsProxyFactoryBean as a singleton for all web service
calls makes no difference.

Any suggestions on what the problem might be or how to further debug the
problem?

Regards

Daniel

Reply via email to