[jboss-user] [JBossWS] - return type polymorphism issue, please help

beligum do-not-reply at jboss.com
Thu Dec 13 22:59:29 EST 2007


Hi all, I guess this should be easy for some of you experts, so I hope to get an answer here, after searching for this bug for a couple of hours now.

Here's the situation:


  | @XmlJavaTypeAdapter(AbstractInodeImpl.Adapter.class)
  | public interface Inode extends Serializable, Comparable<Inode>, Cloneable
  | {
  |     //definition of getters,setters,...
  | }
  | 


  | @Entity
  | @Table(name="inode")
  | @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
  | @DiscriminatorColumn(
  |                      name="type",
  |                      discriminatorType=DiscriminatorType.STRING
  | )
  | 
  | @XmlSeeAlso({FileInode.class, DirectoryInode.class})
  | public abstract class AbstractInodeImpl implements Inode
  | {
  |     //implementation of getters,setters,...
  | 
  |     static public class Adapter extends XmlAdapter<AbstractInodeImpl, Inode>
  |     {
  | 	public Inode unmarshal(AbstractInodeImpl v)
  | 	{
  | 	    return v;
  | 	}
  | 	public AbstractInodeImpl marshal(Inode v)
  | 	{
  | 	    return (AbstractInodeImpl)v;
  | 	}
  |     }
  | }
  | 


  | @Entity
  | @Name("directoryInode")
  | @DiscriminatorValue("directory")
  | public class DirectoryInode extends AbstractInodeImpl implements Serializable
  | {
  |     // more implementation
  | }
  | 


  | @Entity
  | @Name("fileInode")
  | @DiscriminatorValue("file")
  | public class FileInode extends AbstractInodeImpl implements Serializable
  | {
  |     // even more...
  | }
  | 


  | @Stateless
  | @WebService(name = "FileSystemService", serviceName = "FileSystemService")
  | @Name("fileSystemService")
  | @WebContext(contextRoot="/tumbolia/services", urlPattern="/FileSystemService")
  | public class FileSystemServiceImpl implements FileSystemService, Serializable
  | {
  |     @WebMethod
  |     public List<Inode> getAllChildren(String inodePath)
  |     {
  | 	List<Inode> children = ((FileSystemManager)Component.getInstance("fileSystemManager", true)).getInodePathChildren(inodePath);
  | 	
  | 	return children;
  |     }
  | }
  | 

I generate my JAXB beans with wsconsume or wsimport (have tried both) from the wsdl that was automatically generated.

When I call the webservice in the last bean, I get this exception:


  | [javax.xml.bind.UnmarshalException: Unable to create an instance of com.acepostproduction.tumbolia.webservice.AbstractInodeImpl
  |  - with linked exception:
  | [java.lang.InstantiationException]]
  | com.acepostproduction.virtuolia.exceptions.WsException: [TumboliaFileSystemCommunicator] Error while calling getAllChildren(): javax.xml.bind.UnmarshalException
  |  - with linked exception:
  | [javax.xml.bind.UnmarshalException: Unable to create an instance of com.acepostproduction.tumbolia.webservice.AbstractInodeImpl
  |  - with linked exception:
  | [java.lang.InstantiationException]]
  |         at com.acepostproduction.virtuolia.communicator.TumboliaFileSystemCommunicator.getAllChildren(TumboliaFileSystemCommunicator.java:87)
  |         at com.acepostproduction.virtuolia.VirtuoliaDiskDriver.startSearch(VirtuoliaDiskDriver.java:340)
  |         ...
  | 

Any ideas why the polymorphism on the return value is failing?
It would be great if someone could give me a hint here.

bram


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4112791#4112791

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4112791



More information about the jboss-user mailing list