12 Replies Latest reply on Mar 16, 2012 10:40 AM by vatsanm

    Error when use classes generated from a xsd file Jboss As7

    quynhbt

      Hello,

       

      I have an application which use Seam and Webservice. In my src folder, there are :

       

      src

           + helloService.java

           + helloServiceRemote.java

           + xml

                + Chgfmlreq.java

                + Tlts.java

                + QuotationItem.java

                ....

       

      The classes in xml folder are generated from a xsd file (use xjc of jaxb-xjc.jar). In my helloService.java, if I don't call the classes in xml folder, it works well. But If I call/refer to these classes, I get these errors:

       

      12:46:51,346 GRAVE [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-4) Schema element {http://hello.example.atlas.datasystem.fr/}Chgfmlreq references undefined type Chgfmlreq for service {http://hello.example.atlas.datasystem.fr/}helloService.

      12:46:51,347 GRAVE [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-4) Schema element {http://hello.example.atlas.datasystem.fr/}Ttls references undefined type Ttls for service {http://hello.example.atlas.datasystem.fr/}helloService.

      12:46:51,347 GRAVE [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-4) Schema element {http://hello.example.atlas.datasystem.fr/}QuotationItem references undefined type QuotationItem for service {http://hello.example.atlas.datasystem.fr/}helloService.

       

      What can I do with these errors ?

       

      Any idea would be appreciated

       

      Thanks

      TBQ

        • 1. Re: Error when use classes generated from a xsd file Jboss As7
          jaikiran

          What does the final deployment packaging look like?

          • 2. Re: Error when use classes generated from a xsd file Jboss As7
            quynhbt

            The deployment packaging is a EAR :

             

            hello.ear

                + META-INF

                      + application.xml

                      + jboss-deployment-structure.xml

                + lib

                + hello.jar

                      + META-INF

                      + ejb-jar.xml

                      +  standard-jaxws-endpoint-config.xml

                      + fr.datasystem.atlas.example.hello

                          + helloService.class

                          + helloServiceRemote.class

                          + xml

                                + Chgfmlreq.class 

                                + Ttls.class   

                                + QuotationItem.class

                                ....... 

                      + seam.properties

                + hello.war

                + jboss-seam.jar

            • 3. Re: Error when use classes generated from a xsd file Jboss As7
              sfcoy

              The package name you have here does not match that in your src directory above...

              • 4. Re: Error when use classes generated from a xsd file Jboss As7
                quynhbt

                Sorry, I don't tape the package name in the src but it match that in the deployment packaging. That mean :

                 

                src

                     + fr.datasystem.atlas.example.hello

                          + helloService.java

                          + helloServiceRemote.java

                          + xml

                               + Chgfmlreq.java

                               + Tlts.java

                               + QuotationItem.java

                               ....

                 

                TBQ

                • 5. Re: Error when use classes generated from a xsd file Jboss As7
                  quynhbt

                  I deployed this example in Jboss 4 and it runs well

                  In Jboss 7, it has these errors, and I found that the WSDL files gererated by Jboss 4 and Jboss 7 are different

                   

                   

                  I attach here these 2 wsdl files

                  • 6. Re: Error when use classes generated from a xsd file Jboss As7
                    quynhbt

                    I'd like to attach the application here but it is larger than 15 Mo (18 Mo),

                    • 7. Re: Error when use classes generated from a xsd file Jboss As7
                      quynhbt

                      I found where is the problem.

                       

                      In the file xsd, when I define a complex element directly by naming the element like this:

                       

                      <xsd:element name="personne">
                            <xsd:complexType>
                              <xsd:sequence>
                                <xsd:element name="nom" type="xsd:string" />
                                <xsd:element name="prenom" type="xsd:string" />
                                <xsd:element name="date_naissance" type="xsd:date" />
                                <xsd:element name="etablissement" type="xsd:string" />
                                <xsd:element name="num_tel" type="xsd:string" />
                              </xsd:sequence>
                            </xsd:complexType>
                      </xsd:element>

                       

                      It works very well

                       

                      But when I define the "personne" element which have a type attribute that refers to the name of the complex type, like this :

                       

                      <xsd:element name="personne" type="Personne"/>
                            <xsd:complexType name="Personne">
                              <xsd:sequence>
                                <xsd:element name="nom" type="xsd:string" />
                                <xsd:element name="prenom" type="xsd:string" />
                                <xsd:element name="date_naissance" type="xsd:date" />
                                <xsd:element name="etablissement" type="xsd:string" />
                                <xsd:element name="num_tel" type="xsd:string" />
                              </xsd:sequence>
                         </xsd:complexType>

                       

                      I get the error in the beginning of this thread:

                       

                       

                       

                      10:48:46,352 GRAVE [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-14) Schema element {http://hello.example.atlas.datasystem.fr/}personne references undefined type Personne for service {http://hello.example.atlas.datasystem.fr/}helloService.

                      Jboss as7 does not support the second definition of complexType ?

                      What can I do to resolve it ?

                      Thanks

                      Best regards

                      TQB

                      • 8. Re: Error when use classes generated from a xsd file Jboss As7
                        sfcoy

                        I think you need to do:

                        <xsd:complexType name="Personne">
                             <xsd:sequence>
                                  <xsd:element name="nom" type="xsd:string" />
                                  <xsd:element name="prenom" type="xsd:string" />
                                  <xsd:element name="date_naissance" type="xsd:date" />
                                  <xsd:element name="etablissement" type="xsd:string" />
                                  <xsd:element name="num_tel" type="xsd:string" />
                             </xsd:sequence>
                        </xsd:complexType>

                         

                        <xsd:element name="personne" type="Personne"/>
                        • 9. Re: Error when use classes generated from a xsd file Jboss As7
                          quynhbt

                          Thanks Stephen Coy, but it does not work at all.

                           

                          I have to use the second definition.

                           

                          Best regards

                           

                          TQB

                          • 10. Re: Error when use classes generated from a xsd file Jboss As7
                            vatsanm

                            TQB,

                               How did you resolve the issue.  I am hvig the same issue and tryign to track down the attributes like you have. The WSDL is generated bu JB and it works perfectly in Jboss 4.2.2 but not in 7.x

                            • 11. Re: Error when use classes generated from a xsd file Jboss As7
                              quynhbt

                              Hi Vatsan,

                               

                              I resolved by using the definition like this :

                               

                                    <xsd:complexType name="Personne">

                                      <xsd:sequence>

                                        <xsd:element name="nom" type="xsd:string" />

                                        <xsd:element name="prenom" type="xsd:string" />

                                        <xsd:element name="date_naissance" type="xsd:date" />

                                        <xsd:element name="etablissement" type="xsd:string" />

                                        <xsd:element name="num_tel" type="xsd:string" />

                                      </xsd:sequence>

                                    </xsd:complexType>

                              </xsd:element>

                               

                              don't use this définition :

                               

                              <xsd:element name="personne" type="Personne"/>

                                    <xsd:complexType name="Personne">

                                      <xsd:sequence>

                                        <xsd:element name="nom" type="xsd:string" />

                                        <xsd:element name="prenom" type="xsd:string" />

                                        <xsd:element name="date_naissance" type="xsd:date" />

                                        <xsd:element name="etablissement" type="xsd:string" />

                                        <xsd:element name="num_tel" type="xsd:string" />

                                      </xsd:sequence>

                                 </xsd:complexType>

                              • 12. Re: Error when use classes generated from a xsd file Jboss As7
                                vatsanm

                                Thx TQB.  I did it simialr to above andit worked.