1

I'm having a Problem with a Java program that I am developing that is using a jar file that was created by the Mathworks JA builder. In this Matlab program, it is using JAK to create a KML file for Google Earth. I have had no problem on the development computer with the full Matlab ide. However when taken over to another machine that only has the MCR I get the following error:

javax.xml.bind.PropertyException: name: com.sun.xml.bind.namespacePrefixMapper value: de.micromata.opengis.kml.V_2_2_0.kml$NameSpaceBeautyfier@15cb235

at javax.xml.helpers.AbstractMarshallerImpl.setProperty(Unkown Source) at com.sun.xml.internal.bind.V2.runtime.MarshallerImpl.setProperty(Unkown Source) at de.micromata.opengis.kml.V_2_2_0.kml.createMarshaller(kml.java:642) at de.micromata.opengis.kml.V_2_2_0.kml.marshal(kml.java:682)

Is this something that is related to the Classpath?

Thanks for any help.

intelman
  • 49
  • 1
  • 9

2 Answers2

1

Do you have the same version of the JAXB libraries on both systems? Looks like it might be a versioning conflict. Searching on your error I came across this page: http://timepassguys.blogspot.com/2011/12/jaxb-exception-javaxxmlbindpropertyexce.html

Maybe that solution is something you can try?

Petter
  • 4,053
  • 27
  • 33
  • Yes both have the same version of the libaries. My first attempt had the libaries package into the JAR so that it would be more portiable and a problem of versioning would not come up. I then transfered my Eclipse project wich also had the libaries and that as well failed. Thanks for pointing me to that website. – intelman Mar 05 '12 at 14:25
  • Unfortunately, you can't package external libraries within a jar file (they will not be seen on the classpath) without tools such as One-JAR (http://one-jar.sourceforge.net). You can however create a directory called "lib" in the same directory as your jar file, and any libraries you put there should be on the classpath. – Petter Mar 05 '12 at 14:28
1

You are using the JAXB implementation that is included in the JDK (com.sun.xml.internal.bind), but are specifying the property for the Metro JAXB implementation (com.sun.xml.bind). Note that Metro JAXB undergoes a package rename when it is included in the JDK.

Options

  1. You could use the com.sun.xml.internal.bind.namespacePrefixMapper property.
  2. You could use a jaxb.properties file to specify the use of the Metro JAXB implementation.

For More Information

bdoughan
  • 147,609
  • 23
  • 300
  • 400