Cannot find service
Cannot find service
- Subject: Cannot find service
- From: Corin Lawson <email@hidden>
- Date: Wed, 31 May 2006 16:52:25 +1000
Hi,
I believe that this is a bug or a design flaw. Any comments or
suggestions?
I am using WO 5.2.4 on Mac OS X Server.
Under certain conditions I receive the following exception when
trying to invoke an operation of a web service that has more than one
instance running.
com.webobjects.foundation.NSForwardException
[javax.xml.rpc.ServiceException] Error processing WSDL document:
javax.xml.rpc.ServiceException: Cannot find service: {http://
127.0.0.1/cgi-bin/WebObjects/Calculator.woa/2/ws/Calculator}
Calculator: Unable to create axis service with url http://localhost/
cgi-bin/WebObjects/Calculator.woa/ws/Calculator?wsdl and QName
{http://127.0.0.1/cgi-bin/WebObjects/Calculator.woa/2/ws/Calculator}
Calculator: Exception trying to invoke operation: add
com.webobjects.webservices.client.WOWebServiceClient.invoke
(WOWebServiceClient.java:493)
CalculatorClient.invoke(CalculatorClient.java:51)
Test$CalculatorClientThread.run(Test.java:62)
To illustrate this I have used the Calculator/Calculator_Client
projects contained in the WebObjects Web Services Programming Guide
(http://developer.apple.com/documentation/WebObjects/Web_Services/
index.html). I add these projects as apps in JavaMonitor and make one
small change to the CalculatorClient class; ie, I change line 21 of
CalculatorClient.java to read:
private String _service_address = "http://localhost/cgi-bin/
WebObjects/Calculator.woa/ws/Calculator?wsdl";
Also I add a new component to Calculator_Client called Test.wo.
Test.wo begins ten threads that each continuously invoke operations
on the Calculator web service. Here are some snippets from Test.java.
public class Test extends WOComponent {
protected List clientList;
protected int clientListSize;
protected boolean isRunning;
public class CalculatorClientThread extends Thread {
private Test owner;
private Exception exception;
public CalculatorClientThread(Test owner) {<--snip-->}
public boolean hasException() {<--snip-->}
public String getExceptionString() {<--snip-->}
public void run() {
CalculatorClient calculator_client = new CalculatorClient();
exception = null;
try {
while(owner.isRunning)
calculator_client.invoke("add", new Object[] {new Double(2.0),
new Double(2.0)});
} catch(Exception e) {
exception = e;
}
}
}
public Test(WOContext context) {<--snip-->}
public void stop() {
isRunning = false;
}
public void start() {
isRunning = true;
CalculatorClientThread[] threads = new CalculatorClientThread
[clientListSize];
for(int i = 0; i < clientListSize; i++)
threads[i] = new CalculatorClientThread(this);
for(int i = 0; i < clientListSize; i++)
threads[i].start();
clientList = new Vector(Arrays.asList(threads));
}
}
The Test component allows the user to invoke the start and stop
actions and displays any exceptions.
For example, I have two fresh instances of Calculator running and I
start and stop the Test component. Five of the ten threads
immediately throw the exception above and the other five successfully
send a total of 142 add operations to the Calculator. JavaMonitor
shows that instance 1 of Calculator processed 147 transactions (five
requests for the WSDL doc and 142 add operations) and instance 2
processed five requests.
The only explanation that I can think of is that those that fail
receive the WSDL doc for instance 2 and then fail because instance 1
receives the add request. The problem being that the instances have
different namespaces. This explanation doesn't satisfy me however
because I would expect that some of them succeed and successful one
fail at some point, and I have not observed this. Also the only work-
arounds I can think of is to have only a single instance running
(which defeats the purpose of having a load balancer and I lose the
benefits of multiple instances) or to fix the wsdl location to a
specific instance (where the same exception is thrown if the instance
is ever unavailable). Or is it possible to remove any reference to an
instance number in the wsdl doc?
Please help.
Corin.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden