0

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"/>
1
  • Post the code of the GetCons class. Commented Feb 22, 2018 at 16:01

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

No this is not the case unfortunately. Thanks... I am updating with further information.
It seems that the problem was fixed by the solution mentioned @ stackoverflow.com/a/19010261/1688441 but I still don't know how to debug this.
what about taking the xml, put it in a file, make a small main method to unmarshal into the POJOs and put a debug point on getElementPropertyAccessor method of JAXBContextImpl class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.