1 2 Previous Next 15 Replies Latest reply on Aug 26, 2010 9:50 AM by rasa

    Failed to parse source: Element type "messaging-type" must be declared.

    rasa

      Hi,

       

      I am getting following error when i deploy my application in jboss 5.1.0.

      org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfszip:/D:/jboss-5.1.0.GA/server/default/deploy/MyApp/MyApp-2.5.ear/MyAppMessageQueueListener-1.0.jar/
          at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
          at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:362)
          at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:322)
          at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:294)
          at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:234)
          at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
          at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
          at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
          at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
          at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
          at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
          at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:361)
          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
          at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
          at org.jboss.system.server.profileservice.repository.AbstractProfileService.activateProfile(AbstractProfileService.java:306)
          at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:271)
          at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
          at org.jboss.Main.boot(Main.java:221)
          at org.jboss.Main$1.run(Main.java:556)
          at java.lang.Thread.run(Thread.java:619)
      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Element type "messaging-type" must be declared. @ vfszip:/D:/jboss-5.1.0.GA/server/default/deploy/MyApp/MyApp-2.5.ear/MyAppMessageQueueListener-2.0.jar/META-INF/ejb-jar.xml[8,20]
          at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:203)
          at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:168)
          at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:189)
          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)
          ... 34 more

      there is no class path entry available in my Manifest.mf file.

       

      Below  is my ejb-jar.xml file

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar id="ejb-jar_ID">
          <enterprise-beans>
              <message-driven>
                  <ejb-name>TestApplicationListener1</ejb-name>
                  <ejb-class>com.java.adv.test.mrf.transport.jms.MessageReceiverMDB</ejb-class>
                  <messaging-type>javax.jms.MessageListener</messaging-type>
                  <transaction-type>Container</transaction-type>
                  <env-entry>
                      <!-- The JNDI name of the connection factory used -->
                      <!-- to send the response. -->
                      <env-entry-name>connectionFactory</env-entry-name>
                      <env-entry-type>java.lang.String</env-entry-type>
                      <env-entry-value>${env.connectionFactJNDI}</env-entry-value>
                  </env-entry>
                  <env-entry>
                      <!-- The JNDI location of the queue used -->
                      <!-- to send the response. -->
                      <env-entry-name>queueJndi</env-entry-name>
                      <env-entry-type>java.lang.String</env-entry-type>
                      <env-entry-value>${env.queueInstallationJNDI}</env-entry-value>
                  </env-entry>
                  <activation-config>
                      <activation-config-property>
                          <activation-config-property-name>destination</activation-config-property-name>
                          <activation-config-property-value>java:queue/request/QUEUENAME</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>destinationType</activation-config-property-name>
                          <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>useJNDI</activation-config-property-name>
                          <activation-config-property-value>true</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>hostName</activation-config-property-name>
                          <activation-config-property-value>${jms.hostName}</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>queueManager</activation-config-property-name>
                          <activation-config-property-value>${jms.queueManager}</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>transportType</activation-config-property-name>
                          <activation-config-property-value>${jms.transportType}</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>port</activation-config-property-name>
                          <activation-config-property-value>${jms.port}</activation-config-property-value>
                      </activation-config-property>
                      <activation-config-property>
                          <activation-config-property-name>channel</activation-config-property-name>
                          <activation-config-property-value>${jms.channel}</activation-config-property-value>
                      </activation-config-property>
                  </activation-config>
              </message-driven>

      In that message type node is available

      <messaging-type>javax.jms.MessageListener</messaging-type>

      but still why it is giving the error???

        • 1. Re: Failed to parse source: Element type "messaging-type" must be declared.
          rasa

          Is it an issue of ejb jar version. Please guide me to resolve this

          • 2. Re: Failed to parse source: Element type "messaging-type" must be declared.
            jaikiran

            As the error message says, you are using the "messaging-type" element which is not allowed by the ejb-jar_2_0.dtd (the one you are using). You'll have to fix the xml or use the correct dtd/xsd declaration, depending on your application.

            • 3. Re: Failed to parse source: Element type "messaging-type" must be declared.
              rasa

              Thanks jai, but the same xml is perfectly working in jboss 4.0.5. So what changes i have to make in my xml ? or what is the correct dtd/xsd ?. From where i will get those information ????

              • 4. Re: Failed to parse source: Element type "messaging-type" must be declared.
                jaikiran

                Rasa Here wrote:

                 

                but the same xml is perfectly working in jboss 4.0.5.

                I kind of expected that you would say that

                 

                Rasa Here wrote:

                 

                So what changes i have to make in my xml ?

                Use an xml editor which can validate against the dtd/xsd you are using and fix the errors. One of the errors is that you are using messaging-type element which is not allowed in ejb-jar_2_0.dtd. So remove that messaging-type element from your xml.

                 

                 

                Rasa Here wrote:

                 

                or what is the correct dtd/xsd ?

                It depends on your application. If you are using EJB2.0, then you need to use ejb-jar_2_0.dtd. If you are using EJB2.1, then use ejb-jar_2_1.dtd. If EJB3 then use ejb-jar_3.0.xsd.

                 

                 

                Rasa Here wrote:

                 

                From where i will get those information ????

                The information about what the dtd/xsd allows? For this specific example, you can find the dtd/xsds in the JBOSS_HOME/docs/schema folder or you can even find them online (for ex: http://java.sun.com/dtd/ejb-jar_2_0.dtd)

                1 of 1 people found this helpful
                • 5. Re: Failed to parse source: Element type "messaging-type" must be declared.
                  rasa

                  Yes i checked the site and i got the sample ejb-jar.xml file also. But may i know how it worked in 4.0.5 GA JBOSS AS.

                   

                  If i am removing the node <message-type> will it cause any other issue, like any configuration??

                   

                  Your help would be appreciated!!!

                  • 6. Re: Failed to parse source: Element type "messaging-type" must be declared.
                    jaikiran

                    Rasa Here wrote:

                     

                    But may i know how it worked in 4.0.5 GA JBOSS AS.

                     


                    AS-5 and later versions are stricter in xml validations. AS-4 was lenient with such errors.

                     

                     

                    Rasa Here wrote:

                     

                    If i am removing the node <message-type> will it cause any other issue, like any configuration??

                     

                     

                    The question is, does your application which is using EJB2.0 dtd need it? Which EJB version does your  application want? EJB2.0 or EJB2.1 or EJB3? You can remove that element from the xml and then see for yourself if there are any other issues.

                    1 of 1 people found this helpful
                    • 7. Re: Failed to parse source: Element type "messaging-type" must be declared.
                      rasa

                      The question is, does your application which is using EJB2.0 dtd need it? Which EJB version does your  application want? EJB2.0 or EJB2.1 or EJB3? You can remove that element from the xml and then see for yourself if there are any other issues.

                      The dtd/xsd is used by is 2.0 but the xml format and the contents looks like 2.1.

                       

                      Based on the below information i changed doctype to 2.1 version but it didnot worked.

                       

                      http://www.chariotsolutions.com/geronimo/geronimo-1.1/ejb.html

                      • 8. Re: Failed to parse source: Element type "messaging-type" must be declared.
                        jaikiran

                        Rasa Here wrote:

                         


                         

                        Based on the below information i changed doctype to 2.1 version but it didnot worked.

                         


                        Hmmm, what can I say? You have been here in the forums long enough to know that if you don't provide the relevant details, then no one will be able to help you. What does "did not work" mean? What exactly did you change? What does the file look like now? What is the exact exception stacktrace and the log after that change?

                        • 9. Re: Failed to parse source: Element type "messaging-type" must be declared.
                          rasa

                          Sorry Jai, I was looking in to that issue. The changed files looks like this

                          <?xml version="1.0" encoding="UTF-8"?>
                          <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
                                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                                       http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
                                   version="2.1">
                            ...
                          </ejb-jar>
                              <enterprise-beans>

                          When i tried to validate the xml file, i am getting following error

                           

                           

                          File ejb-jar.xml is not valid.
                               Character 'e' is grammatically unexpected
                                   Reason: one of the following is expected (see below)
                                       '!'
                                       '?'
                                   Details
                                       XML production: Production 'Misc' not satisfied

                          • 10. Re: Failed to parse source: Element type "messaging-type" must be declared.
                            rasa

                            Sorry it is my mistake. I fixed that. Now another error

                             

                             

                             

                            File ejb-jar.xml is not valid.
                                Element <activation-config> is not allowed at this location under element <message-driven>.
                                    Reason: The following elements are expected at this location (see below)
                                        <j2ee:env-entry>
                                        <j2ee:ejb-local-ref>
                                        <j2ee:ejb-ref>
                                        <j2ee:service-ref>
                                        <j2ee:message-destination-ref>
                                        <j2ee:security-identity>
                                        <j2ee:resource-env-ref>
                                        <j2ee:resource-ref>

                                    Annotations of type 'j2ee:message-driven-beanType' (see below)
                                        The message-driven element declares a message-driven
                            bean. The declaration consists of:
                            - an optional description
                            - an optional display name
                            - an optional icon element that contains a small and a large
                            icon file name.
                            - a name assigned to the enterprise bean in
                            the deployment descriptor
                            - the message-driven bean's implementation class
                            - an optional declaration of the bean's messaging
                            type
                            - the message-driven bean's transaction management type
                            - an optional declaration of the bean's
                            message-destination-type
                            - an optional declaration of the bean's
                            message-destination-link
                            - an optional declaration of the message-driven bean's
                            activation configuration properties
                            - an optional declaration of the bean's environment
                            entries
                            - an optional declaration of the bean's EJB references
                            - an optional declaration of the bean's local EJB
                            references
                            - an optional declaration of the bean's web service
                            references
                            - an optional declaration of the security
                            identity to be used for the execution of the bean's
                            methods
                            - an optional declaration of the bean's
                            resource manager connection factory
                            references
                            - an optional declaration of the bean's resource
                            environment references.
                            - an optional declaration of the bean's message
                            destination references
                                    Error location: ejb-jar / enterprise-beans / message-driven / activation-config
                                    Details
                                        cvc-model-group: Element <activation-config> unexpected by type 'j2ee:message-driven-beanType' of element <message-driven>.
                                        cvc-elt.5.2.1: The element <message-driven> is not valid with respect to the actual type definition 'j2ee:message-driven-beanType'.

                            • 11. Re: Failed to parse source: Element type "messaging-type" must be declared.
                              wolfgangknauf

                              Hi,

                               

                              to quote Jaikiran: "What does the file look like now?" is still the question.

                               

                              It seems you need some basic knowledge of EJB 2.x/3.0, because I have the impression that you are doing "things" without knowing what you are doing ;-). What EJB version do you really need? "activation-config" is a feature of EJB 3.0, so if your ejb-jar.xml is version 2.1, it will not work.

                               

                              I might post a ejb-jar.xml with a valid EJB3 message bean configuration, but I refuse to do so as long as you don't tell us which EJB version you require and why ;-)

                               

                              Best regards

                               

                              Wolfgang

                              • 12. Re: Failed to parse source: Element type "messaging-type" must be declared.
                                rasa

                                I am really sorry. i dnt know which version of ejb they are using. But in the ejb-jar.xml it shows that it is using 2.0. But the xml entries as showing it is ejb 3.0. So i guess they are using 3.0. Please provide some valid ejb-jar.xml file for 3.0 ejb.

                                • 13. Re: Failed to parse source: Element type "messaging-type" must be declared.
                                  rasa

                                  I tried 3.0 version also and i am getting the same sort of error. The xml file is the same which i gave inmy first post. Only change i made is i added following code in that.

                                   

                                   

                                  <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">

                                   

                                  Here is the error.

                                   

                                  File ejb-jar.xml is not valid.
                                      Element <activation-config> is not allowed at this location under element <message-driven>.
                                          Reason: The following elements are expected at this location (see below)
                                              <javaee:pre-destroy>
                                              <javaee:env-entry>
                                              <javaee:ejb-local-ref>
                                              <javaee:persistence-context-ref>
                                              <javaee:ejb-ref>
                                              <javaee:service-ref>
                                              <javaee:message-destination-ref>
                                              <javaee:security-identity>
                                              <javaee:resource-env-ref>
                                              <javaee:persistence-unit-ref>
                                              <javaee:post-construct>
                                              <javaee:resource-ref>
                                          Annotations of type 'javaee:message-driven-beanType' (see below)
                                              The message-driven element declares a message-driven
                                  bean. The declaration consists of:
                                  - an optional description
                                  - an optional display name
                                  - an optional icon element that contains a small and a large
                                  icon file name.
                                  - a name assigned to the enterprise bean in
                                  the deployment descriptor
                                  - an optional mapped-name element that can be used to provide
                                  vendor-specific deployment information such as the physical
                                  jndi-name of destination from which this message-driven bean
                                  should consume. This element is not required to be supported
                                  by all implementations. Any use of this element is non-portable.
                                  - the message-driven bean's implementation class
                                  - an optional declaration of the bean's messaging
                                  type
                                  - an optional declaration of the bean's timeout method.
                                  - the optional message-driven bean's transaction management
                                  type. If it is not defined, it is defaulted to Container.
                                  - an optional declaration of the bean's
                                  message-destination-type
                                  - an optional declaration of the bean's
                                  message-destination-link
                                  - an optional declaration of the message-driven bean's
                                  activation configuration properties
                                  - an optional list of the message-driven bean class and/or
                                  superclass around-invoke methods.
                                  - an optional declaration of the bean's environment
                                  entries
                                  - an optional declaration of the bean's EJB references
                                  - an optional declaration of the bean's local EJB
                                  references
                                  - an optional declaration of the bean's web service
                                  references
                                  - an optional declaration of the security
                                  identity to be used for the execution of the bean's
                                  methods
                                  - an optional declaration of the bean's
                                  resource manager connection factory
                                  references
                                  - an optional declaration of the bean's resource
                                  environment references.
                                  - an optional declaration of the bean's message
                                  destination references
                                          Error location: ejb-jar / enterprise-beans / message-driven / activation-config
                                          Details
                                              cvc-model-group: Element <activation-config> unexpected by type 'javaee:message-driven-beanType' of element <message-driven>.
                                              cvc-elt.5.2.1: The element <message-driven> is not valid with respect to the actual type definition 'javaee:message-driven-beanType'.

                                  It is proved that none of the versions are perfect for my project :-)

                                   

                                  What to do guys ??? Any thoughts ????

                                  • 14. Re: Failed to parse source: Element type "messaging-type" must be declared.
                                    jaikiran

                                    Rasa Here wrote:

                                     

                                    What to do guys ??? Any thoughts ????

                                    Hint: Pay special attention to the order of those elements in the xml. What does the xsd say about the env-entry and activation-config - which one comes before the other?

                                    1 2 Previous Next