Hello Sergey, Here is the situation simplified:
Let's say I have the following Java types as entities/business objects: - abstract Shape - Triangle extends Shape - Rectangle extends Shape And let's say I have the following interface & implementation to expose via DOSGI-CXF public interface MyInterface { int countSomething(Shape s); } public MyInterfaceImpl { int countSomething(Shape s){ return s.doShapeSpecificThing(); } } So in this simple example I have only one method in the interface, which expects an object which IS-A Shape. If I use "simple" CXF (= no DOSGI, no OSGI, but wsdl2java generated artifacts) (for example, in a JBossAS) from the consumer side, I can pass a Rectangle or a Triangle object to this webservice operation and on the provider side, JAXB (or some XML->Java engine :)) will create Rectangle or Triangle objects, and the invoked doShapeSpecificThing() will be the overriden ones in the concrete shape classes. This works fine, polimorphism is good. But, if I would like to do the same thing with CXF-DOSGI, which is having an abstract class (Shape) in a method's signature as parameter or return value, the provider side fails with the following error: org.apache.cxf.interceptor.Fault: Couldn't instantiate class. null. Nested exception is java.lang.InstantiationException: null Maybe it doesnt even puts the subclassed parameter object on the consumer side into the request soap envelope (I havent checked), thats why it says null. Removing the abstract keyword from Shape makes it working seemingly, but in fact, if I pass a subclass on the consumer side, only the base one's parts are passed (basically a Shape class, since without abstract, it can be initialised) and I say goodbye polimorphism. I hope I described my scenario understandable. // I have to migrate a project from J2EE to OSGI... here came the CXF - inheritance issue. I wonder if anyone has bumped into this situation. Best regards, András Liter On Wed, Sep 28, 2011 at 10:14 PM, Sergey Beryozkin <sberyoz...@gmail.com>wrote: > Can you provide more info please, where do abstract classes come into the > picture ? > > Sergey > > > On 28/09/11 19:12, András Liter wrote: > >> Thanks for the tip, it brought some hope, but it just didnt worked. >> The sad thing is that polimorphism doesnt work this way via CXF-DOSGI (as >> it >> does in simple CXF). >> >> 2011/9/27 Daniel Kulp<dk...@apache.org> >> >> On Tuesday, September 27, 2011 2:45:08 PM András Liter wrote: >>> >>>> Hey, >>>> >>>> I bumped into the following error during a DOSGI consumer-provider call: >>>> org.apache.cxf.interceptor.**Fault: Couldn't instantiate class. null. >>>> >>> Nested >>> >>>> exception is java.lang.**InstantiationException: null >>>> >>>> As it turned out, I got this exception, because I use abstract Java >>>> >>> classes >>> >>>> and inheritance in my Java business objects. >>>> Is there a workaround for this issue, or the only solution is not using >>>> >>> the >>> >>>> abstract keyword? >>>> >>> >>> You MAY be able to do it if you add @XmlSeeAlso annotations in various >>> places >>> (like on the abstract base classes) that point to the various subclasses >>> so >>> that JAXB and such can find the base classes. Not really sure if/how >>> that >>> would work with DOSGi though.. >>> >>> >>>> Thanks in advance, >>>> András Liter >>>> >>> -- >>> Daniel Kulp >>> dk...@apache.org >>> http://dankulp.com/blog >>> Talend - http://www.talend.com >>> >>> >> >