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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content