5 Replies Latest reply on Feb 18, 2010 11:45 AM by wolfgangknauf

    XML schema validation

      Is there a way to turn off the schema validation?

      E.g.: I want to leave the elemet type "enterprise-beans" in the /server/default/deploy/default.ear/default-ejb.jar/META-INF/ejb-jar.xml as blank.

       

      App Server : JBoss 5.1.0 GA

        • 1. Re: XML schema validation
          wolfgangknauf

          Hi,

           

          this is no good idea, because you would break the validaty your XML documents.

           

          What is your use case which forces you to do such things?

           

          Best regards

           

          Wolfgang

          • 2. Re: XML schema validation

            Hi Wolfgang,

             

            I agree with you on the thought that it is always better to have a schema validation in place.

             

            Here is some more info on what I am trying to do:

             

            The app I am working on is basically a web app. We might add EJBs in the future.

             

            I had previously tried with JBoss 4.2.x, and had deployed an exploded form of a standard EAR directory structure inside the 'default' deployment. Inside the EAR directory(default.ear), along with a WAR directory (default.war), I had created a 'default-ejb.jar' directory and related meta data file which I left blank. This would deploy without complaining in JBoss 4.2.x

             

            This same approach does not work for JBoss 5.1.0, since now, it complains about an EJB not being defined in the metadata file (for the EJB).

             

            I could see two possible paths:

            1) Try to switch off a validation flag (if there is such a thing) and continue using the default deployment configuration.

            2) Use the 'Web' deployment configuration.

             

            And hence, put my question as to whether there is a switch for validation within some JBoss configuration file.

             

            On the other hand, I was also trying to find some information on the merits/limitations of using a 'web' deployment configuration.

             

            Any/all suggestions welcome.

             

            Thanks.

            • 3. Re: XML schema validation
              wolfgangknauf

              Hi,

               

              I think the JavaEE standard forbids ejb jars without any EJBs ;-).

               

              Assume an EJB jar without deployment descriptor, which only uses annotations. Now assume that this one contains no classes. So, JBoss cannot identify it as an EJB jar. So, it is consistent that an ejb-jar.xml must contain at least one bean and cannot be "empty".

               

              So, if your deployment does not require an EJB jar, do not include one ;-). IDEs like Eclipse allow adding of an EJB jar to an existing EAR project.

               

              Best regards

               

              Wolfgang

              • 4. Re: XML schema validation
                jaikiran

                Actually the xsd allows you to have an empty ejb-jar element:

                 

                <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
                      version="3.0">
                
                </ejb-jar>
                

                 

                 

                so that you can set the ejb-jar "version" and other attributes of the ejb-jar deployment.

                • 5. Re: XML schema validation
                  wolfgangknauf
                  Ooops... my bad...