IBM Support

For Java EE 5 applications that use shared libraries and annotations, do not set the metadata-complete attribute to true

Troubleshooting


Problem

A problem occurs with Java™ Platform, Enterprise Edition (Java EE) 5 applications that use annotations and a shared library. When a Java EE 5 class contains annotations and that class depends on classes that reside in a shared library, setting the []metadata-complete attribute[] to []true[] causes an []@EJB[] annotation to be incorrectly represented in the deployment descriptor as [][] rather than [][]. For Web modules, this situation results in an injection failure.

Symptom

An error, such as the InjectionException exception, might occur if you set the metadata-complete attribute to true for a Java EE 5 application under the following conditions:

  • The application contains an EJB 3.0 or Web 2.5 module.
  • The application uses annotations and a shared library.

Cause

If your application contains Enterprise JavaBeans (EJB) 3.0 or Web 2.5 modules, during or after application deployment you can set the metadata-complete attribute to true. This value enables your application to write the complete module deployment descriptor, including deployment information from annotations, to extensible markup language (XML) format. On the administrative console, the metadata-complete attribute is set on the Metadata for modules panel. The default value, which is false, does not write out a module deployment descriptor. For more information on the Metadata for modules panel, see the Metadata for module settings topic in the Information Center for IBM WebSphere Application Server Version 7.0.

Annotations are a standard mechanism of adding metadata to Java classes. You can use metadata to simplify development and deployment of Java EE 5 artifacts. Prior to the introduction of Java language annotations, deployment descriptors were the standard mechanism that was used by Java EE components. These deployment descriptors were mapped to XML format, which facilitated their persistence. If you set the metadata-complete attribute to true, the product merges Java EE 5 annotation-based metadata with the XML-based existing deployment descriptor metadata and persists the result.

Resolving The Problem

Retain the false, or deselected, setting for the metadata-complete attribute if your Java EE 5 application uses annotations and a shared library.


To avoid the problem, complete any of the following actions when the metadata-complete attribute is set to true, or is selected, for a Java EE 5 application that uses annotations and a shared library:

  • Do not use a shared library with an annotated application.
  • Place the shared library in either the classes or lib directory of the application server.
  • Fully specify the metadata in the deployment descriptors.

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Deploy (for example: AAT or ANT or EAR\/WAR\/JAR)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0","Edition":"Base;Express;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS7K4U","label":"WebSphere Application Server for z\/OS"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Deploy (for example: AAT or ANT or EAR\/WAR\/JAR)","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
06 June 2019

UID

swg21318507