1 Reply Latest reply on Jul 18, 2002 3:04 AM by TRK

    web.xml give error

    navneet Newbie

      Hi,

      I am using jboss 3.0.1 and I am tring to connect to a queue from my servlet.

      My web.xml is as follows

      -------------------------
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
      <ejb-local-ref>
      <ejb-ref-name>local/UserHome</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>mobile.entity.LocalUserHome</local-home>
      mobile.entity.LocalUser
      <ejb-link>User</ejb-link>
      </ejb-local-ref>
      <resource-ref>
      The message queue
      <res-ref-name>queue/mobileQueue</res-ref-name>
      <res-type>javax.jms.Queue</res-type>
      <res-auth>Container</res-auth>

      </resource-ref>
      <resource-ref>
      The connection factory
      <res-ref-name>jms/defaultConnectionFactory</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>



      </web-app>
      ---------------------------------

      but when i try to deply it it gives me following error

      ---------------------------------
      org.jboss.deployment.DeploymentException: Parse error on jar:file:/C:/Jboss/jbos
      s-3.0.1RC1/server/default/tmp/deploy/server/default/deploy/myapp.ear/70.myapp.ea
      r-contents/myproject.war!/: org.xml.sax.SAXParseException: Element "web-app" doe
      s not allow "resource-ref" here.; - nested throwable: (java.io.IOException: Pars
      e error on jar:file:/C:/Jboss/jboss-3.0.1RC1/server/default/tmp/deploy/server/de
      fault/deploy/myapp.ear/70.myapp.ear-contents/myproject.war!/: org.xml.sax.SAXPar
      seException: Element "web-app" does not allow "resource-ref" here.)
      at org.jboss.jetty.Jetty.deploy(Jetty.java:424)
      at org.jboss.jetty.JettyService.performDeploy(JettyService.java:247)
      at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:30
      0)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:786)

      -----------------------------------

      i also tried rosource-env-ref but that also give me an error. It do now alloy me to have resource-ref or resource-env-ref inside web-app

      also which one should i use resource-env-ref or resource-ref and what should i put in jboss-web.xml to map the resource name to jndi name.

      please help.

        • 1. Re: web.xml give error
          TRK Newbie

          Hi,

          Check the order of entries in the web.dtd,
          the ejb-local-ref must be present after the resource-ref...and it will work fine...
          Check the dtd file for more info.


          > also which one should i use resource-env-ref or
          > resource-ref and what should i put in jboss-web.xml
          > to map the resource name to jndi name.
          >
          resource-env-ref is for the environmental references of the resource and the resource-ref is directly for the resource as such

          Thx