ception,....,Place,the,resource,correctly,in,the,classpath.?" /> How do I resolve this error "javax.xml.ws.WebServiceException .... Place the resource correctly in the classpath.? - Problems and solutions to issues related to Microsoft : OS, Applications, Development, Hardware, Server, Internet Protocols, Database, Exchange .

Question : How do I resolve this error "javax.xml.ws.WebServiceException .... Place the resource correctly in the classpath.?

Hi,

My experience is that I'm a seasoned programmer in other languages, however  in Java I've only done basic batch file processing and have never used it in anger for Web Developing.

I'm developing a Java Desktop App which contains Web Services clients that consumes/interacts with an API provided by www.betfair.com.  I'm following a tutorial that is mentioned on that website, the tutorial links are in the order that I have followed:

1) http://forum.bdp.betfair.com/blog.php?b=4 ( Getting started )
2) http://forum.bdp.betfair.com/blog.php?b=6 ( Logging into Betfair using NetBeans part A)
3) http://forum.bdp.betfair.com/blog.php?b=7 ( Logging into Betfair using NetBeans part B)
4) http://forum.bdp.betfair.com/blog.php?b=8 ( Logging into Betfair using NetBeans part C)

I downloaded the latest NetBeans 6.8 ( The full and complete NetBeans package) and followed the instructions provided in the tutorals:

1) to create the Web Service clients using the WDSL urls

When creating the Web clients as part of the Getting Started tutorial, I got an error in the automated generation part, which required me to use the "xendorsed="true" to get that part to compile. As far as I know, this part is okay, but maybe related to the error which is tthe basis for me writing this question.

and 2)create a basic Login GUI.

When I try to run the basic GUI login screen I've created using the tutorials, I get the following error message:

1) javax.xml.ws.WebServiceException: Cannot find 'https://api.betfair.com/global/v3/BFGlobalService.wsdl' wsdl. Place the resource correctly in the classpath.
at com.betfair.publicapi.v3.bfglobalservice.BFGlobalS ervice_Service.<clinit>(BFGlobalService_Service.ja va:32)
at me.wsop.betfair.exchange.bfLogin.doLogin(bfLogin.j ava:35)
at me.wsop.betfair.exchange.bfLogin.<init>(bfLogin.ja va:24)
at betfair.BetfairView.btnLoginActionPerformed(Betfai rView.java:272)


and the automated Java code that provides this error is:

"/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2-hudson-752-
* Generated source version: 2.2
*
*/
@WebServiceClient(name = "BFGlobalService", targetNamespace = "http://www.betfair.com/publicapi/v3/BFGlobalService/", wsdlLocation = "https://api.betfair.com/global/v3/BFGlobalService.wsdl")
public class BFGlobalService_Service
extends Service
{

private final static URL BFGLOBALSERVICE_WSDL_LOCATION;
private final static WebServiceException BFGLOBALSERVICE_EXCEPTION;
private final static QName BFGLOBALSERVICE_QNAME = new QName("http://www.betfair.com/publicapi/v3/BFGlobalService/", "BFGlobalService");

static {
BFGLOBALSERVICE_WSDL_LOCATION = com.betfair.publicapi.v3.bfglobalservice.BFGlobalS ervice_Service.class.getResource("https://api.betfair.com/global/v3/BFGlobalService.wsdl");
WebServiceException e = null;
if (BFGLOBALSERVICE_WSDL_LOCATION == null) {
e = new WebServiceException("Cannot find 'https://api.betfair.com/global/v3/BFGlobalService.wsdl' wsdl. Place the resource correctly in the classpath.");
}
BFGLOBALSERVICE_EXCEPTION = e;
}

"

I've read other forums for an answer for my situation and now I'm confused as to what the actual solution is, whether I need to amend Java code, roll back to an early version of Jar files, add Environmental Variables to the OS system paths or whether to install missing Jar files in certain locations.

It seems to be a common problem, but I'm at a loss on how to resolve it.  So I'm in your capable hands for the solution to my problem.

So for those who reply, let me know what extra information you may require and I'll provide it the best I can.

Thank you in advance.










Answer : How do I resolve this error "javax.xml.ws.WebServiceException .... Place the resource correctly in the classpath.?

I am still not sure why u have this static block

    static {
        BFGLOBALSERVICE_WSDL_LOCATION = com.betfair.publicapi.v3.bfglobalservice.BFGlobalService_Service.class.getResource("https://api.betfair.com/global/v3/BFGlobalService.wsdl");
        WebServiceException e = null;
        if (BFGLOBALSERVICE_WSDL_LOCATION == null) {
            e = new WebServiceException("Cannot find 'https://api.betfair.com/global/v3/BFGlobalService.wsdl' wsdl. Place the resource correctly in the classpath.");
        }
        BFGLOBALSERVICE_EXCEPTION = e;
    }

The simplest thinking I can suggest you is to remove this static block in BFGlobalService-Service.java

and try if it still doesn't work! then do this below change in bfLogin.java

change this code from

com.betfair.publicapi.v3.bfglobalservice.BFGlobalService_Service service = new com.betfair.publicapi.v3.bfglobalservice.BFGlobalService_Service();

to the code below
1:
com.betfair.publicapi.v3.bfglobalservice.BFGlobalService_Service service = new com.betfair.publicapi.v3.bfglobalservice.BFGlobalService_Service("https://api.betfair.com/global/v3/BFGlobalService.wsdl");
Random Solutions  
 
programming4us programming4us