Show TOC

Procedure documentationConfiguring Resource References Using the web-j2ee-engine.xml Locate this document in the navigation structure

 

Resources are provided by external archives. They have their resource names specified in the respective deployment descriptors or annotations. To access the resources in your Web application, you have two options:

  • Using the same resource name as specified in the external archive

    In this case, you do not need to use the web-j2ee-engine.xml. You can directly access the resource using resource injection or JNDI lookup.

    More information: Injecting Resources into Web Applications.

  • Using a different resource name than the name specified in the external archive

    In this case, you need to use the web-j2ee-engine.xml as an additional element in the Web application. You need to map the resource to a new name there, and you can use that name for looking up the resource from then on.

    Note Note

    In this case, you need to access the resources in the source code using JNDI lookup in combination with the corresponding description in the web.xml. You cannot use resource injection with annotations.

    End of the note.

This procedure describes how to use the web-j2ee-engine.xml to change the resource name. The following graphic illustrates the explanations that follow.

This graphic is explained in the accompanying text.

Steps for changing the resource name using the web-j2ee-engine.xml

Procedure

  1. Check the resource name, as specified in the corresponding deployment descriptor or annotation.

  2. Use the same name in the content of the <res-link> tag in the web-j2ee-engine.xml.

  3. In the content of the <res-ref-name> tag, enter the new name of the resource.

  4. In the web.xml, describe the resource with the specified name.

  5. In the application source code, look up the resource using the specified name.

More Information

web-j2ee-engine.xsd