string arg[] causing java.lang.NoClassDefFoundError
<p>So I have a script file we are using in house for testing. I want to use the script for testing over the internet but when I give it a url instead of a ip address it throws a java.lang.NoClassDefFoundError, </p>

<p>Why is this and what can I do to fix it </p>

<p>this is the script file:</p>

<pre><code>import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection; 

public class SOAPClient4XG
{
  public static void main(String[] paramArrayOfString)
    throws Exception
  {
    if (paramArrayOfString.length &lt; 2) {
      System.err.println("Usage:  java SOAPClient4XG http://soapURL soapEnvelopefile.xml [SOAPAction]");


      System.err.println("SOAPAction is optional.");
      System.exit(1);
    } 

    String str1 = paramArrayOfString[0];
    String str2 = paramArrayOfString[1];

    String str3 = "";
    if (paramArrayOfString.length &gt; 2) {
      str3 = paramArrayOfString[2];
    } 

    URL localURL = new URL(str1);
    URLConnection localURLConnection = localURL.openConnection();
    HttpURLConnection localHttpURLConnection = (HttpURLConnection)localURLConnection;


    FileInputStream localFileInputStream = new FileInputStream(str2);

    ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();


    copy(localFileInputStream, localByteArrayOutputStream);
    localFileInputStream.close();

    byte[] arrayOfByte = localByteArrayOutputStream.toByteArray();


    localHttpURLConnection.setRequestProperty("Content-Length", String.valueOf(arrayOfByte.length));

    localHttpURLConnection.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
    localHttpURLConnection.setRequestProperty("SOAPAction", str3);
    localHttpURLConnection.setRequestMethod("POST");
    localHttpURLConnection.setDoOutput(true);
    localHttpURLConnection.setDoInput(true);


    OutputStream localOutputStream = localHttpURLConnection.getOutputStream();
    localOutputStream.write(arrayOfByte);
    localOutputStream.close();



    InputStreamReader localInputStreamReader = new InputStreamReader(localHttpURLConnection.getInputStream());

    BufferedReader localBufferedReader = new BufferedReader(localInputStreamReader);

    String str4;

    while ((str4 = localBufferedReader.readLine()) != null) {
      System.out.println(str4);
    } 
    localBufferedReader.close();
  } 


  public static void copy(InputStream paramInputStream, OutputStream paramOutputStream)
    throws IOException
  {
    synchronized ()
    {
      synchronized (paramOutputStream)
      {
        byte[] arrayOfByte = new byte['Ā'];
        for (;;) {
          int i = paramInputStream.read(arrayOfByte);
          if (i == -1) break; 
          paramOutputStream.write(arrayOfByte, 0, i);
        } 
      } 
    } 
  } 
} 
</code></pre>

<p>and the bat file used  to run it is this:</p>

<pre><code>echo Check in inquiry sending:
java -cp .SOAPClient4XG http://foobar/gotdns/com:8080/axis2/services/HTNGListener checkininquiry.sms http://htng.org/1.1/Listener.Wsdl#ReceiveMessageAsync
</code></pre>

<p>here is the stack trace: </p>

<pre><code>C:\Documents and Settings\accounting\Desktop\springer_miller_docs&gt;java -cp .SOAP
Client4XG http://foobar.gotdns.com:8080/axis2/services/HTNGListener checkinin
quiry.sms http://htng.org/1.1/Listener.Wsdl#ReceiveMessageAsync
Exception in thread "main" java.lang.NoClassDefFoundError: http://foobar/gotd
ns/com:8080/axis2/services/HTNGListener
</code></pre>
