1 Reply Latest reply on Sep 25, 2016 11:06 PM by Murray9654

    problem in building a client for restful web service

    Murray9654

      Hi i have successfully deployed a restful web service and i am trying to access it. The following is my code and it gives error . help me to resolve this.  Underlying implementation is CXF.

      thanks in advance.

       

      My code:-

       

      Client client = ClientBuilder.newClient();

        //UriBuilder.fromPath("");

        Response res = client.target(new URI("http://localhost:8080/weath/api/v1/cities/cities"))

              .request( "application/json" ) // Expected response mime type

              .header( authorizationHeaderName, authorizationHeaderValue ) // The basic authentication header goes here

              .post( Entity.form( formParameters ) );

       

      The error it gives is :-

       

      Exception in thread "main" java.lang.VerifyError: Cannot inherit from final class

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:760)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)

        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:367)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:360)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

        at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.initTargetClientIfNeeded(ClientImpl.java:325)

        at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.request(ClientImpl.java:248)

        at org.apache.cxf.jaxrs.client.spec.ClientImpl$WebTargetImpl.request(ClientImpl.java:340)