Java error with JAXB and Java 1.6

I am trying to run the Octopus Arm Benchmark (benchmark gain test). I downloaded octopus-code-distribution.zip and started octopus-environment.jar with

java -jar octopus-environment.jar internal settings.xml 

and I got the following exception:

 Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.bind.annotation.XmlAccessorType.value()Ljavax/xml/bind/annotation/AccessType; at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getAccessType(ClassInfoImpl.java:339) at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:228) at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:87) at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:127) at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49) at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41) at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189) at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:327) at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:198) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76) at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:202) at javax.xml.bind.ContextFinder.find(ContextFinder.java:363) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522) at Main.main(Main.java:41) 

I already sent an error message to google and there seems to be a problem with my version of Java. I use Java 1.6, which for some reason causes conflicts with the JAXB library. I think this will work with Java 1.5. But I haven't figured out any workaround yet.

Hope you can help me here. Some background information: I am using Ubuntu 11.04 and my version of Java is 1.6.0_26.

+6
source share
1 answer

In JAXB 2.0, AccessType renamed to XmlAccessType ( AccessorType also renamed to XmlAccessorType ). Thus, users of early JAXB snapshots are exposed to this problem. So you have two options:

  • Update your source code so that you can use the JAXB that ships with Java 6.

  • Override the JAXB implementation with the one used in your environment. The MANIFEST file of the octopus-environment.jar file shows that the necessary files are stored in the / lib folder, so you can run

java -Djava.endorsed.dirs=./lib -jar octopus-environment.jar internal settings.xml

This uses the Java Endorsed Standards Override Mechanism so that you can override the default JAXB provided in Java 6.

+6
source

Source: https://habr.com/ru/post/906056/


All Articles