开发者

JAXB problem with "com.xyz.ReadSomething nor any of its super class is known to this context."

I get this exception (written in the title) when trying to call a webservice.

The road so far was, I generated a bunch of classes for the objects, service and service methods via wsimport and if I only use the generated objects calling the service works.

The problem is that wsimport also generates classes w开发者_开发问答hich already exist as my domain objects and obviously I can't cast between these two so I only want to use my domain objects. Therefore I deleted the generated duplicate objects and added the required JAXB annotations to my domain objects. I also copied the generated package-info.java and ObjectFactory.java into the according packages.

But now, when I try to call the service I get this exception that the proxy object representing the method is unknown to the context.

Has anybody an idea what might be the reason for this problem? Any tip much appreciated.

Thanks, Simon


On your JAXB annotated class try adding @XmlSeeAlso({ReadSomething.class}). This is how I resolved the exception in my code.

But it's hard to say if it will fix your problem or not without seeing your code.


I had a very similar problem which was resovled by re-constituting my XJC generated files.

The web objects used by my target web service were defined across several XSD files and when I ran XJC on each one, the ObjectFactory was overwritten each time so the one that I ended up with only had some of the classes defined. I ran XJC again and manaully concatonated all of the object definitions into a single ObjectFactory and made sure that I was referring to that factory each time that I needed a client object. This ultimately fixed my problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜