tableau / rest-api-samples

Samples for the Tableau REST API
MIT License
394 stars 273 forks source link

'ant run' failed for java sample code - requires JAXB 2.2 #41

Open caiopavanelli opened 5 years ago

caiopavanelli commented 5 years ago

Hi,

When running the Java sample 'ant run', it throws an exception telling it is loading JAXB 2.1, but requires JAXB 2.2.


C:\>java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

C:\>ant -version
Apache Ant(TM) version 1.10.5 compiled on July 10 2018

image

jtsai01-bsc commented 5 years ago

I have the same issue on JAXB 2.2 API jar. do you have the fix for this?

C:\Program Files\Tableau\REST API\java>ant -version Apache Ant(TM) version 1.10.7 compiled on September 1 2019

See my ant run output below. C:\Program Files\Tableau\REST API\java>ant run Buildfile: C:\Program Files\Tableau\REST API\java\build.xml

compile: [javac] C:\Program Files\Tableau\REST API\java\build.xml:32: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

jar:

run: [java] Exception in thread "main" java.lang.LinkageError: JAXB 2.1 API jar is being loaded (from jar:file:/C:/Program%20Files/Tableau/REST%20API/java/lib/default/javaee-api.jar!/javax/xml/bind/annotation/XmlSchema.class), but this RI (from jar:file:/C:/Program%20Files/Tableau/REST%20API/java/lib/default/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) requires JAXB 2.2 API jar. [java] at com.sun.xml.bind.v2.model.impl.ModelBuilder.(ModelBuilder.java:177) [java] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:473) [java] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:319) [java] at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1170) [java] at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145) [java] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [java] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [java] at java.base/java.lang.reflect.Method.invoke(Method.java:567) [java] at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210) [java] at javax.xml.bind.ContextFinder.find(ContextFinder.java:366) [java] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) [java] at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522) [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.(Unknown Source) [java] Java Result: 1

BUILD SUCCESSFUL Total time: 1 second

jtsai01-bsc commented 5 years ago

For this [java] Exception in thread "main" java.lang.LinkageError: JAXB 2.1 API jar is being loaded (from jar:file:/C:/Program%20Files/Tableau/REST%20API/java/lib/default/javaee-api.jar!/javax/xml/bind/annotation/XmlSchema.class), but this RI (from jar:file:/C:/Program%20Files/Tableau/REST%20API/java/lib/default/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) requires JAXB 2.2 API jar issue, I fix it by a. download javaee-api-8.0.jar from https://jar-download.com/artifacts/javax/javaee-api/8.0/source-code b. Copy javaee-api-8.0.jar into C:\Program Files\Tableau\REST API\java\lib\default\javaee-api.jar

Regards, Jin-Chong