I'm creating a WSDL first webservice with JAXB and CXF. I do not own the WSDL, so I cannot make changes to it. I'm using ftp://ftp.ihe.net/TF_Implementation_Material/ITI/wsdl/PIXManager.wsdl as my WSDL. I used CXF 2.3.0 to generate Java classes.
Java class generation went fine, but when I'm trying to run this in a web application, I get an error
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 17 counts of IllegalAnnotationExceptions
The 17 counts are of the format
There's no ObjectFactory with an @XmlElementDecl for the element {urn:hl7-org:v3}assignedDevice.
this problem is related to the following location:
at protected javax.xml.bind.JAXBElement org.hl7.v3.QUQIMT021001UV01AuthorOrPerformer.assignedDevice
When I go to the class mentioned, i.e. QUQIMT021001UV01AuthorOrPerformer and look at the field assignedDevice, I see this
@XmlElementRef(name = "assignedDevice", namespace = "urn:hl7-org:v3", type = JAXBElement.class)
protected JAXBElement<COCTMT090300UV01AssignedDevice> assignedDevice;
When I look at the ObjectFactory of the package, I see this
private final static QName _COCTMT090303UV01AssignedDeviceAssignedDevice_QNAME = new QName("urn:hl7-org:v3", "assignedDevice");
All my 17 errors are similar. What can I do during my codegen or runtime in order to get my service work?
What Java version are you using at run-time? I had a similar issue with OTA schema when running with Java 6. I eliminated the problem by making the following changes to the Maven configuration:
provided
scope, to match JAXB version included in Java 6.frontEnd
to the Maven cxf-codegen-plugin
plug-in and set it to jaxws21
(or if using wsdl2java
on command line, use "-fe jaxws21
" option).When you generate the classes, you also generate a file called jaxb.properties. Make sure this file is accessible to the application at runtime. I had the same problem and it was due to maven packaging: maven will not include in the package resource files (like jaxb.properties) that are below the src/main/java tree unless specifically instructed to do so. I did this using the org.codehaus.mojo:build-helper-maven-plugin with the add-resource goal. Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With