1 Reply Latest reply on Mar 29, 2011 12:04 PM by Arturo M

    org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider and XJC

    Arturo M Newbie



      I have a simple REST service:






      public TradingAccount getTradingAccount(@QueryParam("request")String request)

         throws TradingAccountException {

         . . .

        TradingAccount _result = new TradingAccount();
         . . .
        return _result;


      When this method is executed I receive this error:

      The method createclass com.ame.types.TradingAccount() was not found in the object Factory!

      I found that the message is thrown by org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider, whose documentation says:

      "A JAXB entity provider that handles classes without XmlRootElement annotation. Classes which have been generated by XJC will most likely not contain this annotation... "

      Which is my case, I created that class with XJC, however the documentation also says

      "This provider simplifies this task by attempting to locate the XmlRegistry for the target class. By default, a JAXB implementation will create a class called ObjectFactory and is located in the same package as the target class. When this class is located, it will contain a "create" method that takes the object instance as a parameter. For example, of the target type is called "Contact", then the ObjectFactory class will have a method:

      public JAXBElement createContact(Contact value);"

      But the ObjectFactory class created by XJC only has this method:

          public TradingAccount createTradingAccount() {return new TradingAccount();}


      And that's why I am getting this error.

      What am I missing?

      Thanks a lot