Menelaos
Menelaos

Reputation: 25755

How do I debug: javax.xml.bind.JAXBException: - not a valid property on class after changing wsdl/xsd

Introduction

Hi, I had a project that was working perfectly.

I am using apache cxf and the generated client code was working perfectly.

However, since yesterday I downloaded new versions of the WSDL and XSD and it seems to be failing.

Configuration

My plugin pom.xml entry is the following:

<plugin>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-codegen-plugin</artifactId>
                <version>2.7.3</version>
                <executions>
                    <execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sourceRoot>${basedir}/src/main/java</sourceRoot>
                            <wsdlOptions>
                                <wsdlOption>
                                    <wsdl>
                                        ${basedir}/src/interface.wsdl
                                    </wsdl>
                                </wsdlOption>
                            </wsdlOptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Stacktrace

And the error I am getting is the following:

javax.xml.bind.JAXBException: trans is not a valid property on class org.test.GetCons
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:934) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessor(JAXBRIContextWrapper.java:106) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.sei.BodyBuilder$DocLit.<init>(BodyBuilder.java:227) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.sei.StubHandler.<init>(StubHandler.java:117) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.db.DatabindingImpl.initStubHandlers(DatabindingImpl.java:145) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:90) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:875) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:892) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:855) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:435) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404) ~[na:1.8.0_60]
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386) ~[na:1.8.0_60]
    at javax.xml.ws.Service.getPort(Service.java:119) ~[na:1.8.0_60]

Questions

  1. How do I debug this?
  2. Is it due to some inconsistency in the new wsdl and xml files?
  3. The code was working fine previously.

I cannot upload the wsdl and xsd files as they are confidential.

Update

I noticed that one change has been the following:

The working definition created a java comment like:

*         &lt;element name="trans" type="{http://server/}trans" minOccurs="0"/>

And now the broken one does the following:

*         &lt;element name="trans" type="{http://server/}trans" minOccurs="0" form="qualified"/>

Upvotes: 0

Views: 1723

Answers (1)

martidis
martidis

Reputation: 2975

Check your GetCons class and specifically its 'trans' field.

Is it annotated with @XmlTransient maybe? Or an issue of similar nature, the xml to be unmarshaled does not match the generated classes (I am guessing xml contains a <trans>...</trans> element)

Your case seems similar to this one.

Update based on the question update:

I think then that your xml for field trans does not have namespace or the proper namespace.

"qualified" indicates that attributes from the target namespace must be qualified with the namespace prefix

Upvotes: 1

Related Questions