3 Replies Latest reply on Apr 16, 2010 2:55 AM by christy

    ERROR: nor any of its super class is known to this context

    christy

      Hi to everybody!

      I have a problem. I have a simple web-service that takes Object type on entrance. But on the client side I need to pass an Array. And I can not do it, I have the error:

      javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException
      - with linked exception:
      [javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.]
          at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:317)
          at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:142)
          at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)
          at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:265)
          at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:144)
          at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:88)
          at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
          at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
          at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
          at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
          at com.sun.xml.ws.client.Stub.process(Stub.java:248)
          at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:134)
          at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:244)
          at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:224)
          at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:117)
          at $Proxy29.getFirstID(Unknown Source)
          at bus.client.TestWSBus.main(TestWSBus.java:48)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
      Caused by: javax.xml.bind.MarshalException
      - with linked exception:
      [javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.]
          at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:282)
          at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:100)
          at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:141)
          at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:310)
          ... 21 more
      Caused by: javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.
          at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:242)
          at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:257)
          at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:649)
          at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:150)
          at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
          at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
          at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:277)
          ... 24 more
      Caused by: javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.
          at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:556)
          at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:644)
          ... 28 more

      Here is a simple web-service code:

      @WebService
      @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
      public class TestService {
           @WebMethod
          public String getFirstID(Object o){
               String res = "";
               List l = new ArrayList();
               l = (List)o;
               System.out.println("o = " + l.size());
               System.out.println("res = " + res);
               return res;
           }
      }

      And this is a simple web-service client:

      TestServiceService testServiceService = new TestServiceService();
              TestService service = testServiceService.getTestServicePort();
              List l = new ArrayList();
              l.add(33);
              service.getFirstID(l);

      Are there any solutions of this problem? Or I can not pass types that are not declared in web-service method interface?

       

      Thank you!

        • 1. Re: ERROR: nor any of its super class is known to this context
          ropalka


          You can pass only JAXB supported types web method parameters.

          java.lang.Object cannot be passed as web method parameter.

          • 2. Re: ERROR: nor any of its super class is known to this context
            christy

            Richard, thank you for your reply. But my problem is not in java.lang.Object transmition. If I pass the "pure" simple  java.lang.Object everything works fine. But if under this Object is some complex or custom type in reality than I have this exception.

            Maybe there are some solutions of this problem? Maybe it is possible to create some XML-schemas for example but I do not know what exactly.

            • 3. Re: ERROR: nor any of its super class is known to this context
              christy

              Hi again!

              Realy there ar no ways to solve my problem?

              This is simple web-service:

              @WebService()

              public class SimpleWS{

              @WebMethod()
                   public String testObj (Object o){
                     // o processing..
                     return res;

              }

               

              I have custom type A. I generated client artifacts for SimpleWS web-service and when I call the testObj method, I want to transmit object of type A. And I have the error on the client side:

              javax.xml.bind.JAXBException: class esimo.ws.buoys.BuoysDetails nor any of its super class is known to this context.]

              Are there really no ways to solve this? Please, help!!