Unmarshalling Error: unexpected element (uri:url, local:“objectname”). Expected elements are <{}objectname>

后端 未结 5 1437
梦谈多话
梦谈多话 2021-02-14 19:33

I\'m using jaxb2-marshaller to generate classes to communicate with a webservice. Java-classes are generated with use of some wsdl files.

Everything is okay now, but whe

5条回答
  •  遇见更好的自我
    2021-02-14 19:55

    If you have more than 1 module in your project check for duplicate Class names or directory names.

    I was getting the same error and I was able to resolve it by changing the package names in my project.

    I had two modules in my project with identical directory structures module/src/main/java/com/example/directory/path

    We had two different endpoints and 2 different WSDLs, but both were from the same client. When we auto-generated the POJO classes from the WSDLs it created the file structure for us. I noticed that the namespace generated in the XML was using the same namespace for XML generated in both modules, when they were supposed to be different (hence the stacktrace).

    All I did to solve the problem was change the directory names to be more specific for each module.

提交回复
热议问题