Hi All,
I have problem with the sync client code generated using wsdl2java for
a JAX-WS service. I see the following exception in logs:
"TP-Processor2070" daemon prio=10 tid=0x00002aaac4cf0800 nid=0x161c
waiting for monitor entry [0x00000000456de000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.util.Collections$SynchronizedMap.put(Collections.java:1979)
- waiting to lock <0x00000007957feee8> (a
java.util.Collections$SynchronizedMap)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:312)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
at $Proxy107.echo(Unknown Source)
We are using a singleton instance of the EServiceClient across our App:
class EServiceClient {
private static EServiceClient client = new EServiceClient();
public static MyServiceClient getInstance() {
return client;
}
private RecommendationsServiceClient() {
initClient();
}
private void initClient() {
try {
URL wsdlURL = EService.WSDL_LOCATION;
EService ss = new EService(wsdlURL, SERVICE_NAME);
port = ss.getEServicePort();
RECIEVE_TIMEOUT = new Long(timeout);
CONNECTION_TIMEOUT = new Long(conTimeOUt);
final Client cl = ClientProxy.getClient(port);
final HTTPConduit http = (HTTPConduit) cl.getConduit();
final HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setReceiveTimeout(RECIEVE_TIMEOUT);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setConnectionTimeout(CONNECTION_TIMEOUT);
http.setClient(httpClientPolicy);
} catch (Exception e) {
e.printStackTrace();
}
}
Is it that the 'port' is not thread safe that I am seeing this
exception? How can I fix it?
The other problem is that connection timeout values are not honored.
Please help.
Nishant