Error while creating multiple instance of same service on same thread.
----------------------------------------------------------------------

                 Key: AXIS2-1115
                 URL: http://issues.apache.org/jira/browse/AXIS2-1115
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: jaxws
            Reporter: Nikhil Thaker


I receive the "An error occurred while creating the ServiceClient" exception 
when running junit test
cases. This appears to happen when there are multiple instances of the same 
Service within the same
thread. In this case, the previously configured servise should be picked up 
instead of reconfiguring
a new one.

Here's the JUnit Sample code:

DocLitWrappedService service1 = new DocLitWrappedService();
service1.getDocLitWrappedPort();
DocLitWrappedProxy port1 = service2.getDocLitWrappedPort();
port1.twoWayTest("some test string"); // this is ok

DocLitWrappedService service2 = new DocLitWrappedService();
DocLitWrappedProxy port2 = service2.getDocLitWrappedPort();
port2.twoWayTest("some test string"); // throws the exception

Here's the stack trace:

javax.xml.ws.WebServiceException: An error occurred while creating the 
ServiceClient.
        at 
org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:217)
        at 
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:81)
        at 
org.apache.axis2.jaxws.spi.ServiceDelegate.getServiceClient(ServiceDelegate.java:354)
        at 
org.apache.axis2.jaxws.client.proxy.BaseProxyHandler.InvokeSEIMethod(BaseProxyHandler.java:143)
        at 
org.apache.axis2.jaxws.client.proxy.BaseProxyHandler.invoke(BaseProxyHandler.java:121)
        at $Proxy6.twoWay(Unknown Source)
        at 
jaxws.proxy.wsfvt.test.DocLitWrappedTest.testTwoWay(DocLitWrappedTest.java:134)
Caused by: org.apache.axis2.AxisFault: Two services can not have same name, a 
service with ProxyDocLitWrappedService already exists in the system
        at 
org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:111)
        at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:95)
        at 
org.apache.axis2.jaxws.spi.ServiceDelegate.getServiceClient(ServiceDelegate.java:351)
        ... 22 more

I will be attaching fix for this issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to