5 Replies Latest reply on Jul 16, 2009 7:12 AM by Wolfgang Knauf

    mapped-name is required for jdbc

    Neelesh Parulkar Newbie

      Hi,
      I am trying to deploy a webwar on Jboss 5.0.1 GA. I am using Struts2 and mysql as the DB. I get following exception while deploying the war:
      I have my resource ref entires defined in web.xml and data source entry in the ds file:

      *******************************************************************************
      java.lang.RuntimeException: mapped-name is required for jdbc/LOYALTY of deployment Loyalty.war
      at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXmlResourceRefs(WebResourceHandler.java:178)
      at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXml(WebResourceHandler.java:327)
      at org.jboss.web.tomcat.service.TomcatInjectionContainer.processMetadata(TomcatInjectionContainer.java:564)
      at org.jboss.web.tomcat.service.WebCtxLoader.start(WebCtxLoader.java:158)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4272)
      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:312)
      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144)
      at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
      at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
      at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
      at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
      at $Proxy36.start(Unknown Source)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      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.ServiceController.doChange(ServiceController.java:688)
      at org.jboss.system.ServiceController.start(ServiceController.java:460)
      at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
      at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
      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:1178)
      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:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      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:698)
      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.loadProfile(ProfileServiceBootstrap.java:304)
      at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:205)
      at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:405)
      at org.jboss.Main.boot(Main.java:209)
      at org.jboss.Main$1.run(Main.java:547)
      at java.lang.Thread.run(Thread.java:619)
      18:56:25,656 ERROR [StandardContext] Context [/Loyalty] startup failed due to previous errors
      18:56:25,671 ERROR [AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/Loyalty state=Create mode=Manual requiredState=Installed
      org.jboss.deployers.spi.DeploymentException: URL file:/D:/jboss-5.0.1.GA/server/all/tmp/5c4o11d-fhwfxg-fx3878ar-1-fx389vsl-af/Loyalty.war/ deployment failed
      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:333)
      at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:144)
      at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
      at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
      at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
      at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
      at $Proxy36.start(Unknown Source)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
      at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      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.ServiceController.doChange(ServiceController.java:688)
      at org.jboss.system.ServiceController.start(ServiceController.java:460)
      at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
      at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
      at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
      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:1178)
      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:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      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)
      ******************************************************************************

        • 1. Re: mapped-name is required for jdbc
          Wolfgang Knauf Master

          Hi,

          please post the relevant snippet of "web.xml".

          And maybe you should follow the error message and add the "mapped-name" element in "resource-ref" ;-).

          Hope this helps

          Wolfgang

          • 2. Re: mapped-name is required for jdbc
            Neelesh Parulkar Newbie

            Here is snippet from web.xml and -ds.xml respectively:


            web.xml:

            <resource-ref>
            DB Connection
            <res-ref-name>jdbc/LOYALTY</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            </resource-ref>



            hsqldb-ds.xml:

            <local-tx-datasource>

            <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
            <!-- Datasources are not available outside the virtual machine -->
            <jndi-name>jdbc/LOYALTY</jndi-name>
            <connection-url>jdbc:mysql://192.168.1.109:3306/LOYALTY</connection-url>

            <!-- The driver class -->
            <driver-class>com.mysql.jdbc.Driver</driver-class>
            <!-- The login and password -->
            <user-name>root</user-name>
            root
            <!-- The maximum connections in a pool/sub-pool -->
            <max-pool-size>5</max-pool-size>
            <!-- track unclosed statements -->
            <track-statements>true</track-statements>

            <!-- REQUIRED IN JBOSS 4.0.5GA; TRYING IN JBOSS 3.2.5 FOR CONSISTENCY -->

            <type-mapping>mySQL</type-mapping>

            </local-tx-datasource>


            I am facing same problem with Jboss 5.1.0 GA. However I am able to deploy the war on 4.2.3 GA successfully. Only change in web.xml being a wrapper tag around resource-ref as <jboss-web>. This is not required in Jboss 5.x.x as this gives invalid schema related errors.









            • 3. Re: mapped-name is required for jdbc
              Neelesh Parulkar Newbie

              I have already tried putting mapped-name in resource ref but no luck......

              • 4. Re: mapped-name is required for jdbc
                Neelesh Parulkar Newbie

                <resource-ref>
                DB Connection
                <res-ref-name>jdbc/LOYALTY</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
                </resource-ref>

                Here is the correct web-xml entry I have. Previsous one is missing the tag

                • 5. Re: mapped-name is required for jdbc
                  Wolfgang Knauf Master

                  Hi,

                  the "res-ref-name" is the name of the entry in your Environment Naming Context (needed only for programmatic JNDI lookups), it is NOT the name of the datasource in JNDI.

                  You need something like this (might still contain minor errors):

                  <resource-ref>
                   <res-ref-name>NameForLookup</res-ref-name>
                   <res-type>javax.sql.DataSource</res-type>
                   <mapped-name>jdbc/LOYALTY</mapped-name>
                   <res-auth>Container</res-auth>
                  </resource-ref>
                  


                  Hope this helps

                  Wolfgang

                  PS: Please use "[ code ]" tags to mark XML, so that no information is lost.