1 Reply Latest reply on Jun 2, 2014 2:04 AM by Android Galaxyman

    Problem while deploying web service in jBoss EAP 6.1 regarding XML schema complexType

    Android Galaxyman Newbie

      Dear all,

       

      we are migrating our web service application which compatible to jBoss EAP 6.1. This application perfectly deploying and working well in all other application servers and remaining lower versions of jBoss. The web services are created from schema we defined below , i mean which consist of element name which is having the type of complexType in the schema definition. we are having the JAXB / XJC compiler, which compiles the this schema and generates the java sources and class files . The files are packed up for deployment of web services component in Application server.

       

      schema1.jpg

      Issue at jboss EAP 6.1 Final :

      ***********************************

                      at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:333)

                      ... 13 more

      Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions

      The element name {}row has more than one mapping.

                      this problem is related to the following location:

                                      at public javax.xml.bind.JAXBElement com.XXXXX.tws.pojo.PERSON.ObjectFactory.createRow(com.XXXXX.tws.pojo.SECTOR.PERSONType)

                                      at com.XXXXX.tws.pojo.PERSON.ObjectFactory

       

      ObjectFactory of Generated JAXB classes:

      ****************************************************

      @XmlElementDecl(namespace = "", name = "row")
          public JAXBElement<PERSONType> createRow(PERSONType value) {
              return new JAXBElement<PERSONType>(_Row_QNAME,PERSONType.class, null, value);
          }
      
      

      This deployment works well in jboss 4.2.3 GA/ jboss 5.1.0 GA / jboss 6.1.0 Final , except EAP 6.1/ 6.2.

       

      So that we made following approaches to resolve .

       

      Approach One:


      1.  we understood the from the exception "row" doesn't seems unique and qualifying name , hence we are having multiple schema and  multiple schema generated classes .Then we re named the element in the sense of unique and generated our web service classes. (<xsd:element name="row1" type="PERSONType"> -> schema 1 , <xsd:element name="row2" type="PERSONFTType">  -> schema 2) . Once created our service, again we deployed ,we faced one more issue .



      ObjectFactory of Generated JAXB classes:

      ************************************************

      @XmlElementDecl(namespace = "", name = "row1")
          public JAXBElement<PERSONType> createRow1(PERSONType value) {
              return new JAXBElement<PERSONType>(_Row1_QNAME,PERSONType.class, null, value);
          }
      
      
      @XmlElementDecl(namespace = "", name = "row2")
          public JAXBElement<PERSONFTType> createRow2(PERSONFTType value) {
              return new JAXBElement<PERSONFTType>(_Row2_QNAME,PERSONFTType.class, null, value);
          }
      
      


      Approach One Results

      ***************************

      Deployment Exception with schema element references undefined type for service


      Server.log:

      ************

      09:47:01,707 SEVERE [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-2) Schema element {http://xxx.com/OwnTest}row1 references undefined type PERSONType for service {http://xxx.com/OwnTest}XXXWebServicesImplService.

      09:47:01,708 SEVERE [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-2) Schema element {http://xxx.com/OwnTest}row2 references undefined type PERSONFTType for service {http://xxx.com/OwnTest}XXXWebServicesImplService.

      09:47:01,790 INFO  [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-2) Setting the server's publish address to be http://maad21206238:8080/OwnTest/XXXWebServicesImpl

      09:47:01,957 INFO  [org.jboss.ws.cxf.deployment] (MSC service thread 1-2) JBWS024074: WSDL published to: file:/D:/ApplicationServers/jboss-eap-6.2.GA/standalone/data/wsdl/OwnTest.war/XXXWebServicesImplService.wsdl

       

      Approach Two: (Work Around given in jboss forums)


      To resolve the issue reported above one, we made some changes again as said in (Error when use classes generated from a xsd file Jboss As7)


      As per the thread suggestion , we have completely removed the completely

      <xsd:element name="row" type="PERSONType">

      ,only we kept complexType

      <xsd:complexType name="PERSONType">


      schema2.jpg

      ObjectFactory of Generated JAXB classes:

      ************************************************

      @XmlRegistry
      public class ObjectFactory {
          public ObjectFactory() {
          }
          public PERSONFTType createPERSONFTType() {
              return new PERSONFTType();
          }
      }
      
      

       

      @XmlRegistry
      public class ObjectFactory {
          public ObjectFactory() {
          }
          public PERSONType createPERSONType() {
              return new PERSONType();
          }
      
      

       

      }

      Approach Two Results :

      Web service get deployed without any issue.


      The web service getting deployed without any issue. My Question Pops up here regarding jBoss EAP 6.1 Web service deployment.



      1.What would be difference when deploying same web service (element name keeps as "row") in different app server and also whats exact problem in EAP 6.1 deploying web service?

      2. After that we have change the element name "row" , the web service get deployed , but with ERROR in  Schema element {http://xxx.com/OwnTest}row1 references undefined type PERSONType for service reported, what would be the reason ?

      3. Whats behind with the removal of element name "row"  and keeping complexType alone ? why jboss EAP 6.1 doesn't accept Named complex type of XSD Schema ?


      <xsd:complexType name="PERSONType">
        <xsd:sequence>
        <xsd:element name="NAME" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="row" type="PERSONType"/>
      
      


      As per the thread suggestion , we have completely removed the completely

      <xsd:element name="row" type="PERSONType">

      <xsd:element name="row" type="PERSONType">,only we kept complexType

      <xsd:complexType name="PERSONType">


      Please guide me !