I have a converter class
public class Convert {
private JAXBContext context;
private final GeometryFactory geometryFactory = new GeometryFactory();
private JTSToGML321GeometryConverter converter;
public Convert() throws JAXBException {
context = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName());
converter = new JTSToGML321GeometryConverter();
}
public String marshal(Geometry geometry) throws JAXBException {
final StringWriter stringWriter = new StringWriter();
final Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(geometry, new StreamResult(stringWriter));
return stringWriter.toString();
}
}
When I try to run test :
public class aaaTest {
private final GeometryFactory geometryFactory = new GeometryFactory();
private static final Logger logger = LoggerFactory.getLogger(SendJtsTest.class);
@Test
public void testSendPoint1() throws Exception {
final Point point = geometryFactory.createPoint(new Coordinate(10, 20));
point.setSRID(4326);
Convert convert = new Convert();
logger.info(convert.marshal(point));
}
I have this error :
javax.xml.bind.JAXBException: Class *** nor any of its super class is known to this context
It seems like I can't use Point to my marshal function ?
Aucun commentaire:
Enregistrer un commentaire