7 Replies Latest reply on Jun 19, 2009 2:03 PM by jaikiran pai

    jboss.xml validation problem

    Guy Coleman Newbie

      I'm having trouble getting an existing application to deploy on 5.1.0.GA. It deploys fine on 4.2.x.

      I'm using ignore-dependency elements in jboss.xml to handle circular references and it's causing problems with descriptor validation (I can't use the annotation because the code has to be portable between app servers).

      jboss.xml snippet looks like this:

      <?xml version="1.0" encoding="ISO-8859-1"?>
      
      <jboss>
      
       <security-domain>java:/jaas/server-login</security-domain>
       <enterprise-beans>
       <session>
       <ejb-name>Bingo</ejb-name>
       <local-jndi-name>ejb/local/Bingo</local-jndi-name>
       <resource-ref>
       <res-ref-name>jdbc/DataSource</res-ref-name>
       <jndi-name>java:/MainDS</jndi-name>
       </resource-ref>
       <!--
       Avoid circular dependency:
       -->
       <ignore-dependency>
       <injection-target>
       <injection-target-class>com.bingo.game.bingo.BingoBean</injection-target-class>
       <injection-target-name>gameFactory</injection-target-name>
       </injection-target>
       </ignore-dependency>
       </session>
       ...
      


      And this error turns up on deployment:

      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: ignore-dependency cannot appear in this position. Expected content of session is unordered_se
      quence: port-component? call-by-value? configuration-name? security-proxy? clustered? home-jndi-name? method-attributes? cluster-config? security-iden
      tity? local-jndi-name? ejb-name? local-home-jndi-name? timer-persistence? security-domain? ior-security-config? exception-on-rollback? jndi-name? ejb-
      timeout-identity? depends* invoker-bindings? {all descriptionGroup}? {unordered_sequence jndiEnvironmentRefsGroup}?
      


      Ok, so I thought I'd add the schema bits as documented in docs\schema\jboss_5_1.xsd:

      <jboss xmlns="http://www.jboss.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
       http://www.jboss.org/j2ee/schema/jboss_5_1.xsd"
       version="5.1">
       ...
       </jboss>
      


      And now this error turns up:

      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {http://www.jboss.com/xml/ns/javaee}resource-ref cannot appear in this position. Expected content of {http://www.jboss.com/xml/ns/javaee}session is sequence: {sequence {http://www.jboss.com/xml/ns/javaee}descriptionGroup} {http://www.jboss.com/xml/ns/javaee}ejb-name {http://www.jboss.com/xml/ns/javaee}mapped-name? {sequence {http://www.jboss.com/xml/ns/javaee}jndiEnvironmentRefsGroup} {http://www.jboss.com/xml/ns/javaee}security-identity? {http://www.jboss.com/xml/ns/javaee}local-binding* {http://www.jboss.com/xml/ns/javaee}remote-binding* {http://www.jboss.com/xml/ns/javaee}business-local* {http://www.jboss.com/xml/ns/javaee}business-remote* {http://www.jboss.com/xml/ns/javaee}jndi-name? {http://www.jboss.com/xml/ns/javaee}home-jndi-name? {http://www.jboss.com/xml/ns/javaee}local-jndi-name? {http://www.jboss.com/xml/ns/javaee}local-home-jndi-name? {http://www.jboss.com/xml/ns/javaee}jndi-binding-policy? {http://www.jboss.com/xml/ns/javaee}clustered? {http://www.jboss.com/xml/ns/javaee}cluster-config? {http://www.jboss.com/xml/ns/javaee}security-domain? {http://www.jboss.com/xml/ns/javaee}method-attributes? {http://www.jboss.com/xml/ns/javaee}depends* {http://www.jboss.com/xml/ns/javaee}annotation* {http://www.jboss.com/xml/ns/javaee}ignore-dependency? {http://www.jboss.com/xml/ns/javaee}aop-domain-name? {http://www.jboss.com/xml/ns/javaee}cache-config? {http://www.jboss.com/xml/ns/javaee}pool-config? {http://www.jboss.com/xml/ns/javaee}concurrent? {http://www.jboss.com/xml/ns/javaee}jndi-ref* {http://www.jboss.com/xml/ns/javaee}port-component? {http://www.jboss.com/xml/ns/javaee}ejb-timeout-identity?
      


      Any idea what's wrong with the deployment descriptor? Any clues how I get this application to deploy?

        • 1. Re: jboss.xml validation problem
          Wolfgang Knauf Master

          Hi,

          I think the order is wrong (the local-jndi-name must be after the resource-ref element):


          <session>
           <ejb-name>Bingo</ejb-name>
           <resource-ref>
           <res-ref-name>jdbc/DataSource</res-ref-name>
           <jndi-name>java:/MainDS</jndi-name>
           </resource-ref>
           <local-jndi-name>ejb/local/Bingo</local-jndi-name>
           <ignore-dependency>
           <injection-target>
           <injection-target-class>com.bingo.game.bingo.BingoBean</injection-target-class>
           <injection-target-name>gameFactory</injection-target-name>
           </injection-target>
           </ignore-dependency>
           </session>
          


          Hope this helps

          Wolfgang

          • 2. Re: jboss.xml validation problem
            Wolfgang Knauf Master

            I should note that 5.1.0 is more strict about sequence ordering:
            https://jira.jboss.org/jira/browse/JBAS-6743

            According to this JIRA issue, the startup parameter "-Dxb.builder.useUnorderedSequence=true" should be set by default, thus it should not happen for you. How do you start JBoss?

            Best regards

            Wolfgang

            • 3. Re: jboss.xml validation problem
              Guy Coleman Newbie

              Thanks. Moving the local-jndi-name and jndi-name elements makes the xml at least in validate from within IDEA.

              The deployment is still failing and it's less clear where the problem is now:

              Caused by: java.lang.Exception: The xml deployfile.ear/bingo-ejbs.jar/META-INF/jboss.xml is not well formed!
               at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:191)
               at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:166)
               at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:137)
               at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(SchemaResolverDeployer.java:121)
               at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parseAndInit(AbstractVFSParsingDeployer.java:256)
               at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse(AbstractVFSParsingDeployer.java:188)
               at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:348)
               ... 35 more
              


              I'll keep looking, maybe there's a typo somewhere.

              Regarding the strictness, I'm using run.bat on Vista. I can't find mention of xb.builder.useUnorderedSequence in the run.bat or any of the startup scripts.

              • 4. Re: jboss.xml validation problem
                Wolfgang Knauf Master

                Hi,

                my link was probably confusing: the parameter is automatically set in startup code in 5.1.0GA: https://jira.jboss.org/jira/browse/JBAS-6931

                The only case this automatic setting would not be performed is if you set it to "false" or any other value yourself, but I don't assume this happens for you.

                Best regards

                Wolfgang

                • 5. Re: jboss.xml validation problem
                  Guy Coleman Newbie

                  I'm still getting the "jboss.xml is not well formed!" exception, even with an empty jboss.xml:

                  <jboss xmlns="http://www.jboss.com/xml/ns/javaee"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
                   http://www.jboss.org/j2ee/schema/jboss_5_1.xsd"
                   version="5.1">
                  </jboss>
                  


                  I've seen this https://jira.jboss.org/jira/browse/JBMETA-204 which suggests there's something broken with schema bindings in my installation. Do you have any idea where I can start tracking this down?[/url]

                  • 6. Re: jboss.xml validation problem
                    Guy Coleman Newbie

                    Should deployers/metadata-deployer-jboss-beans.xml contain some stuff about the 5_1 deployment descriptors?

                    • 7. Re: jboss.xml validation problem
                      jaikiran pai Master

                       

                      "gcoleman" wrote:
                      Should deployers/metadata-deployer-jboss-beans.xml contain some stuff about the 5_1 deployment descriptors?


                      Good point!

                      Add this to the deployers/metadata-deployer-jboss-beans.xml (under the JBossMetaData section)
                      <!-- JBossMetaData -->:
                      
                      <entry>
                       <key>jboss_5_1.xsd</key>
                       <value>org.jboss.metadata.ejb.jboss.JBoss50MetaData</value>
                       </entry>


                      And please do open a new thread in JBoss AS5 forum http://www.jboss.org/index.html?module=bb&op=viewforum&f=287 with reference to this thread, so that it comes to the notice of the dev team.