2 Replies Latest reply on Jan 20, 2016 9:40 AM by Jeff Krieg

    REST API sample run time errors

    Rakesh Gupta

      Hi,

       

      I am start with REST API sample . i was able to build the sample jar file using Ant . but when i run it i get following errors :

       

      Any clues what this error is due to .

       

      thanks

      Rakesh

       

       

       

      compile:
          [javac] D:\tab_rest\rest-api-java-sample\build.xml:27: warning: 'includeantr
      untime' was not set, defaulting to build.sysclasspath=last; set to false for rep
      eatable builds

      jar:

      run:
           [java] java.lang.ExceptionInInitializerError
           [java] Caused by: java.lang.IllegalStateException: Failed to initialize the
      REST API
           [java]     at com.tableausoftware.documentation.api.rest.util.RestApiUtils.
      initialize(Unknown Source)
           [java]     at com.tableausoftware.documentation.api.rest.util.RestApiUtils.
      getInstance(Unknown Source)
           [java]     at com.tableausoftware.documentation.api.rest.Demo.<clinit>(Unkn
      own Source)
           [java] Exception in thread "main"
           [java] Java Result: 1

      BUILD SUCCESSFUL
      Total time: 1 second

        • 1. Re: REST API sample run time errors
          Adam Ratkewicz

          I too am getting this error and am interested in the resolution.

           

          Buildfile: C:\Users\username\workspace\Tableau API\build.xml

          Trying to override old definition of task javac

          compile:

          jar:

              [mkdir] Created dir: C:\Users\username\workspace\Tableau API\build\jar

                [jar] Building jar: C:\Users\username\workspace\Tableau API\build\jar\tab-documentation-api.jar

          run:

               [java] java.lang.ExceptionInInitializerError

               [java] Caused by: java.lang.IllegalStateException: Failed to initialize the REST API

               [java]     at com.tableausoftware.documentation.api.rest.util.RestApiUtils.initialize(Unknown Source)

               [java]     at com.tableausoftware.documentation.api.rest.util.RestApiUtils.getInstance(Unknown Source)

               [java]     at com.tableausoftware.documentation.api.rest.Demo.<clinit>(Unknown Source)

               [java] Exception in thread "main"

               [java] Java Result: 1

          BUILD SUCCESSFUL

          Total time: 999 milliseconds

           

          Thanks!

          • 2. Re: REST API sample run time errors
            Jeff Krieg

            Hello Adam and Rakesh,

             

            Rakesh and I figured out the cause of this issue. We went through the setup and noticed a couple small configuration details that might cause this error.

             

            1. double check the extension of the schema file, we downloaded this through IE and it saved with the extension .xml. The subtle difference in the extension made it difficult to decipher.

             

            The file should be like ts-api_2_0_1.xsd or ts-api_2_0.xsd, if it is .xml it'll need to be changed.

             

            2. Verify the file used in step 1 is also referenced in the config.properties file. This will change depending on version

             

            For example:

            server.schema.location=res/ts-api_2_0_1.xsd

            or

            server.schema.location=res/ts-api_2_0.xsd

             

            3. Verify the config.properties file exists in the "res" folder. This message will occur if the config file is missing or under a different extension

             

            4. Make sure security on files in the folder are set to read/write, this may not work correctly if set only to read.

             

            Hope this helps!