2011-03-14 188 views
0

調用WS我寫了一個java的WS和託管它從螞蟻

@WebService 
public class DBConnectionCheck{ 

    @WebMethod 
    public synchronized boolean dbServerState(final String SERVERNAME,final String USER_ID,final String USER_PASSWORD 
      ,final String VENDOR,final String PORT,final String CONNECTOR_TYPE) 
    { 
      .............} 
    @WebMethod 
     @WebMethod 
    public synchronized boolean oracleDBState(......) 
     { 
.............. 
      } 

我已經生成的存根和寫的客戶端也....

 public class CheckRegressionStatus { 



public static void main(String args[]) throws PreRequisticException 
{ 

    Properties resourceMangerProps = new Properties(); 

    /** 
    * Instantiate the generated Service 
    */ 
    com.cordys.autopilot.InfraStructure.servercheck.stub.ReadInfraResourceAvaliabiltyService service1 = new com.cordys.autopilot.InfraStructure.servercheck.stub.ReadInfraResourceAvaliabiltyService(); 

    com.cordys.autopilot.InfraStructure.servercheck.stub.ReadInfraResourceAvaliabilty res = service1.getReadInfraResourceAvaliabiltyPort(); 

    /** 
    * Instantiate the generated Service 
    */ 
    com.cordys.autopilot.InfraStructure.dbstate.stub.DBConnectionCheckService        service = new com.cordys.autopilot.InfraStructure.dbstate.stub.DBConnectionCheckService(); 


    com.cordys.autopilot.InfraStructure.dbstate.stub.DBConnectionCheck dbConnectionCheckProxy = service.getDBConnectionCheckPort(); 

從調用時這工作完美Eclipse或Netbeans的

但是,當我寫了螞蟻代碼來調用它

<java classname="....InfraStructure.CheckRegressionStatus">     
        <classpath> 
         <pathelement path="XYZ.jar"/>   
        </classpath> 
</java> 

它拋出以下錯誤

[java] javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.ProviderImpl not f 
    [java]  at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194) 
    [java]  at org.apache.tools.ant.taskdefs.Java.run(Java.java:747) 
    [java]  at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:201) 
    [java]  at org.apache.tools.ant.taskdefs.Java.execute(Java.java:104) 
    [java]  at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) 
    [java]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    [java]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    [java]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
    [java]  at java.lang.reflect.Method.invoke(Method.java:597) 
    [java]  at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) 
    [java]  at org.apache.tools.ant.Task.perform(Task.java:348) 
    [java]  at org.apache.tools.ant.Target.execute(Target.java:357) 
    [java]  at org.apache.tools.ant.Target.performTasks(Target.java:385) 
    [java]  at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) 
    [java]  at org.apache.tools.ant.Project.executeTarget(Project.java:1298) 
    [java]  at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41 
    [java]  at org.apache.tools.ant.Project.executeTargets(Project.java:1181) 
    [java]  at org.apache.tools.ant.Main.runBuild(Main.java:698) 
    [java]  at org.apache.tools.ant.Main.startAnt(Main.java:199) 
    [java]  at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) 
    [java]  at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) 
    [java] Caused by: javax.xml.ws.WebServiceException: Provider com.sun.xml.internal.ws.spi.Provide 
    [java]  at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:33) 
    [java]  at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:128) 
    [java]  at javax.xml.ws.spi.Provider.provider(Provider.java:83) 
    [java]  at javax.xml.ws.Service.<init>(Service.java:56) 

回答

1

是否使用JDK 1.6?

默認情況下,此類com/sun/xml/internal/ws/spi/ProviderImpl位於JDK 1.6 rt.jar中。您很可能已經使用正確的JDK設置了Eclipse,但未將Ant設置爲使用JDK 1.6。