What is the URL the client is trying to connect to? If you are running the sample exactly as shown at http://www.onjava.com/pub/a/onjava/2002/02/27/tomcat.html?page=3, Tomcat must be running on the same machine on port 8080.
Scott Nichol ----- Original Message ----- From: "Emma Johansson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 11, 2002 10:07 AM Subject: Re: soap, tomcat & directories > Ok, thanx!! > I didn't know that I needed a classpath to the directory of the client. I > thougt I could compile and execute it as any other java program. > > Now another problem arises.... > When I run the client with > > java onjava.CalcClient 78 8 > > (two parameters) > This error appears. > > Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Client; > msg=Error opening socket: java.net.ConnectException: Connection refused; > targetException=java.lang.IllegalArgumentException: Error opening socket: > java.net.ConnectException: Connection refused] > at > org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnectio n.java:354) > > at org.apache.soap.rpc.Call.invoke(Call.java:248) > at onjava.CalcClient.main(CalcClient.java:29) > > > > Have I missed something out? > Tomcat is running fine. I have my server CalcService.class, my deployment > descriptor service.xml and my client CalcClient.class. > > / Emma Johansson > > > > > Scott Nichol wrote: > > > If your CLASSPATH is as shown below, CalcClient.class would have to be > > in /usr/local/j2sdk1.4.0/lib/onjava. Of course, you really don't want > > to put your classes in the JDK's directories! On my development > > machines, I usually have "." as the first component of my CLASSPATH, > > e.g. > > > > CLASSPATH=.:/jakarta-tomcat-4.0.5/common/lib/mail.jar:\ > > /jakarta-tomcat-4.0.5/common/lib/activation.jar:\ > > /jakarta-tomcat-4.0.5/common/lib/xerces.jar:\ > > /soap_2_3_1/lib/soap.jar:\ > > /soap_2_3_1 > > > > I have my .class files put into subdirectories of the current one > > according to their packages, so that CalcClient.class would be in the > > onjava subdirectory. Then I just run > > > > java onjava.CalcClient [parameters] > > > > Scott Nichol > > > > ----- Original Message ----- > > From: "Emma Johansson" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, October 11, 2002 3:10 AM > > Subject: Re: soap, tomcat & directories > > > > > Hi Scott! > > > > > > Thank you so much for helping me! > > > > > > Yes, I have the line > > > package onjava; > > > both in my CalcService.java and CalcClient.java > > > > > > I am still wondering about the client.class file. You said that I need > > to > > > reach it from the JVM classpath. > > > Is that some of these which I've set or have I missed some? > > > > > > CLASSPATH= > > > /usr/local/j2sdk1.4.0/lib > > > /jakarta-tomcat-4.1.12/common/lib/servlet.jar > > > /jakarta-tomcat-4.1.12/common/lib/mail.jar > > > /jakarta-tomcat-4.1.12/common/lib/activation.jar > > > /soap-2_3_1/lib/soap.jar > > > /jakarta-tomcat-4.1.12/common/lib/xerces.jar > > > > > > / Emma > > > > > > > > > Scott Nichol wrote: > > > > > > > If the CalcService.java has the line > > > > > > > > package onjava; > > > > > > > > then you have put the .class file in the right place (you don't need > > the > > > > .java file there) and specified the right class in the deployment > > > > descriptor. I believe you will have to restart Tomcat to get it to > > > > recognize that the new class file is there. You then deploy the > > service > > > > with the command (all on one line) > > > > > > > > java org.apache.soap.server.ServiceManagerClient > > > > http://localhost:8080/soap/servlet/rpcrouter deploy dd.xml > > > > > > > > If Tomcat is not at localhost:8080, adjust the URL, and substitute > > the > > > > file name of your deployment descriptor for dd.xml. > > > > > > > > You need to reach the client .class file from the JVM classpath when > > you > > > > invoke it. I presume it also is in the onjava package. In that > > case, > > > > create a directory named onjava and place the class file in it. > > From > > > > the parent directory of onjava, run > > > > > > > > java -classpath .;%CLASSPATH% onjava.CalcClient > > > > http://localhost:8080/soap/servlet/rpcrouter ... > > > > > > > > The "." in the classpath will allow the JVM to find the .class file > > in > > > > the onjava subdirectory. You must substitute the correct name of > > the > > > > class, the correct URL and any parameters required by the client. > > > > > > > > Scott Nichol > > > > > > > > ----- Original Message ----- > > > > From: "Emma Johansson" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Thursday, October 10, 2002 10:50 AM > > > > Subject: soap, tomcat & directories > > > > > > > > > Hi! > > > > > > > > > > I have created a SOAP Service and compiled it, but am not sure of > > in > > > > > which directory to place it. > > > > > Right now both the .java and .class files are placed in > > > > > /jakarta-tomcat-4.1.12/webapps/soap/WEB-INF/classes/onjava/ > > > > > > > > > > > > > > > I'm also wondering about the deployment descriptor. Mine looks > > like > > > > > this: > > > > > <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" > > > > > id="urn:onjavaserver"> > > > > > <isd:provider type="java" scope="Application" methods="add > > > > > subtract"> > > > > > <isd:java class="onjava.CalcService"/> > > > > > </isd:provider> > > > > > > > > > > > > > > > > <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultLis > > > > tener> > > > > > > > > > > </isd:service> > > > > > > > > > > As what should I save it and in which directory? > > > > > Do I have to compile this code? If so, how? > > > > > > > > > > The same problem appears with the client, where should I save it? > > > > > > > > > > regards, > > > > > Emma > > > > > > > > > > > > > > > -- > > > > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > > > > > > > > > -- > > > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > > > > -- > > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > > > > > > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>