axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Venkat Dokiparthi <venkat.dokipar...@peregrine.com>
Subject RE: java.lang.reflect.InvocationTargetException
Date Tue, 05 Feb 2002 17:44:44 GMT
Have you restarted your web server/application server?  If it already has
the class loaded, it uses the one before your second method is added.
 
Venkat

-----Original Message-----
From: Ghenadie Dumanov [mailto:gdumanov@nexui.md]
Sent: Tuesday, February 05, 2002 12:57 AM
To: axis-user@xml.apache.org
Subject: java.lang.reflect.InvocationTargetException


'llo,
I have a webservice on Axis, which has two methods. I' ve added a method to
samples/userguide/example3.
One of them has calling the database; second - just returns the string.
When I call first method - it throws
java.lang.reflect.InvocationTargetException.
The second one works.
Does anybody meet this problem before?
 
Thanks,
Ghena.
 
this is the webservice:
 
import java.sql.*;
public class WebService
{
    public String serviceMethod(String arg)
    {
        return "WebService: you typed - " + arg;
    }
    public String findAccountby(String fieldValue)
    {
      try
      {
        DriverManager.registerDriver(new com.inet.tds.TdsDriver());
        Connection conn =
DriverManager.getConnection("jdbc:inetdae:sigma:?database=air_database","vba
nk_user","vbank_passwd");
        String aQuery = "select id from account where firstname = ?";
        System.out.println("query=" + aQuery);
        PreparedStatement state = conn.prepareStatement(aQuery);
        state.setObject(1, fieldValue);
        ResultSet rs = state.executeQuery();
        if (rs.next())
        {
          String s = rs.getString("id");
          return ("id = " + s);
        }
        else
        {
           return ("The query is empty!");
        }
      }
      catch (Exception nExcep)
      { 
          return nExcep.toString();
      }
    }
 
 
 
this is the client:
 
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
 
public class TestClient
{
    public static void main(String [] args)
    {
        try {
            Options options = new Options(args);
            
            String endpointURL = options.getURL();
            String textToSend;
            
            args = options.getRemainingArgs();
            if ((args == null) || (args.length < 1)) {
                textToSend = "<nothing>";
            } else {
                textToSend = args[0];
            }
            
            Service  service = new Service();
            Call     call    = (Call) service.createCall();
 
            call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
            call.setOperationName("findAccountby");//"serviceMethod" );
            call.setProperty( Call.NAMESPACE, "WebService" );
            call.addParameter( "arg1", XMLType.XSD_STRING,
Call.PARAM_MODE_IN);
 
            String result = (String) call.invoke( new Object[] { textToSend
} );
            
            System.out.println(result);
        } catch (Exception e) {
            System.err.println(e.toString());
        }
    }
}



Mime
View raw message