开发者

calling WS from ant

开发者 https://www.devze.com 2023-02-16 20:56 出处:网络
I have written a java WS and hosted it @WebService public class DBConnectionCheck{ @WebMethod public synchronized boolean dbServerState(final String SERVERNAME,final String USER_ID,final String USE

I have written a java WS and hosted it

@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(......)
         {
..............
          }

I had generated the stubs and wrote the client also....

      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.DBConne开发者_运维问答ctionCheck dbConnectionCheckProxy = service.getDBConnectionCheckPort();

This works perfect when called from Eclipse or Netbeans

But when I wrote an ant code to invoke it

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

It is throwing the following error

  [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)


Are you using JDK 1.6?

This class com/sun/xml/internal/ws/spi/ProviderImpl is found in JDK 1.6 rt.jar by default. You most likely have set Eclipse with the correct JDK, but have not set Ant to use JDK 1.6.

0

精彩评论

暂无评论...
验证码 换一张
取 消