5 Replies Latest reply on Jan 13, 2009 8:27 AM by null null

    Problem parsing jboss-beans.xml

    null null Newbie

      Hi

      I'm getting parser errors when trying to read jboss-beans.xml

      DEBUG [main] (KernelFactory.java:86) - Starting JBoss Kernel construction...
      DEBUG [main] (KernelFactory.java:112) - Completed JBoss Kernel construction. Duration: 671 milliseconds
      WARN [main] (SaxJBossXBParser.java:316) - Valid documents must have a <!DOCTYPE declaration. @ jar:file:/C:/jboss-4.0.5.GA/server/xxx/deploy/MyApp.war/xxx/MyApp.jar!/jboss-beans.xml[3,-1]
      org.jboss.xb.binding.JBossXBException: Failed to parse source: null@-1,-1
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:128)
      at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:134)
      at org.jboss.kernel.plugins.deployment.xml.BasicXMLDeployer.deploy(BasicXMLDeployer.java:147)
      at com.mgt.microcontainer.EmbeddedBootstrap.deploy(EmbeddedBootstrap.java:36)
      at com.mgt.gui.AgentApplication.run(AgentApplication.java:272)
      at com.mgt.gui.AgentApplication.main(AgentApplication.java:837)
      Caused by: org.xml.sax.SAXException: Element type "deployment" is not declared. @ jar:file:/C:/jboss-4.0.5.GA/server/xxx/deploy/MyApp.war/xxx/MyApp.jar!/jboss-beans.xml[3,-1]
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$MetaDataErrorHandler.error(SaxJBossXBParser.java:322)
      at org.apache.crimson.parser.Parser2.error(Parser2.java:3165)
      at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1322)
      at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:500)
      at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
      at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
      at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:396)
      at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:124)
      ... 5 more


      I've tried using the jboss-beans..xml supplied with the examples but still get the smae errror

      jboss-beans.xml is

      <?xml version="1.0" encoding="UTF-8"?>
      
      <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
       xmlns="urn:jboss:bean-deployer:2.0">
      
       <bean name="URL" class="java.net.URL">
       <constructor>
       <parameter>file:C:\examples\User_Guide\gettingStarted\commandLineClient\target/client-cl.dir/otherLib/humanResourcesService-1.0.0.jar</parameter>
       </constructor>
       </bean>
      
       <bean name="customCL" class="java.net.URLClassLoader">
       <constructor>
       <parameter>
       <array>
       <inject bean="URL"/>
       </array>
       </parameter>
       </constructor>
       </bean>
      
       <bean name="HRService" class="org.jboss.example.service.HRManager">
       <classloader><inject bean="customCL"/></classloader>
       <!-- <property name="hiringFreeze">true</property>
       <property name="salaryStrategy"><inject bean="AgeBasedSalary"/></property> -->
       </bean>
      
       <!-- <bean name="AgeBasedSalary" class="org.jboss.example.service.util.AgeBasedSalaryStrategy">
       <property name="minSalary">1000</property>
       <property name="maxSalary">80000</property>
       </bean>
      
       <bean name="LocationBasedSalary" class="org.jboss.example.service.util.LocationBasedSalaryStrategy">
       <property name="minSalary">2000</property>
       <property name="maxSalary">90000</property>
       </bean> -->
      
      </deployment>
      


      Any help would be greatly appreciated.

      Alan

        • 1. Re: Problem parsing jboss-beans.xml
          null null Newbie

          My jboss-beans.xml is

          <?xml version="1.0" encoding="UTF-8"?>
          
          <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
           xmlns="urn:jboss:bean-deployer:2.0">
          
           <bean name="URL" class="java.net.URL">
           <constructor>
           <parameter>file:C:\examples\User_Guide\gettingStarted\commandLineClient\target/client-cl.dir/otherLib/humanResourcesService-1.0.0.jar</parameter>
           </constructor>
           </bean>
          
           <bean name="customCL" class="java.net.URLClassLoader">
           <constructor>
           <parameter>
           <array>
           <inject bean="URL"/>
           </array>
           </parameter>
           </constructor>
           </bean>
          
           <bean name="HRService" class="org.jboss.example.service.HRManager">
           <classloader><inject bean="customCL"/></classloader>
           <!-- <property name="hiringFreeze">true</property>
           <property name="salaryStrategy"><inject bean="AgeBasedSalary"/></property> -->
           </bean>
          
           <!-- <bean name="AgeBasedSalary" class="org.jboss.example.service.util.AgeBasedSalaryStrategy">
           <property name="minSalary">1000</property>
           <property name="maxSalary">80000</property>
           </bean>
          
           <bean name="LocationBasedSalary" class="org.jboss.example.service.util.LocationBasedSalaryStrategy">
           <property name="minSalary">2000</property>
           <property name="maxSalary">90000</property>
           </bean> -->
          
          </deployment>
          


          • 2. Re: Problem parsing jboss-beans.xml
            Ales Justin Master

            Old JBossAS (pre 5) has MC 1.0 in it,
            where you're trying to use MC 2.0 xml schema.

            • 3. Re: Problem parsing jboss-beans.xml
              null null Newbie

              Hi

              This makes sense as the application is running in a JBoss 4.0.5GA environment. Do I just have to the MC2 jars to the apps own classpath?

              Alan

              • 4. Re: Problem parsing jboss-beans.xml
                Ales Justin Master

                 

                "ahalley" wrote:
                Do I just have to the MC2 jars to the apps own classpath?

                No.
                The changes are not that minor, unfortunately.
                But if you use JBoss5, it's all already there. ;-)

                As I see you're doing some embedded version of it,
                perhaps have a look at my MC demos project:
                - http://anonsvn.jboss.org/repos/jbossas/projects/demos/microcontainer/trunk/

                • 5. Re: Problem parsing jboss-beans.xml
                  null null Newbie

                  Hi

                  Thanks for the help.

                  Alan