Use of Spring @Resource leads to "mapped-name is required" Exception in JBoss EAP

Solution Verified - Updated -

Issue

  • A @Resource annotation is used to wire a Spring components
  • During deployment, a RuntimeException is encountered indicating failure to bind the resource:

    java.lang.RuntimeException: mapped-name is required for <some-class-name>/<some-field-name> of deployment abc.war
        at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXmlResourceEnvRefs(WebResourceHandler.java:287)
        at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXml(WebResourceHandler.java:325)
        at org.jboss.web.tomcat.service.TomcatInjectionContainer.processMetadata(TomcatInjectionContainer.java:550)
    

Environment

  • Spring

    • 2.5.6
    • 3.0
  • Red Hat JBoss Enterprise Application Platform (EAP)

    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.