XML Application Scoping

The XML Application Scoping mechanism in WebLogic allows you to configure XML resources such as parsers, transformers, and entity resolvers on a per-application basis. This is different from the XML Registry settings that we covered earlier — they apply to a server instance and all applications running on it. An application-scoped XML configuration has two major benefits:

  • It allows you to configure different parsers for different applications. You can covertly change the parsers that will be used by the enterprise application simply by editing a deployment descriptor.

  • It makes the resultant EAR file less dependent on the server configuration. If you do not specify an application-scoped factory, the application is at the mercy of the target server. You need to ensure that all servers that will host the enterprise application are configured identically. A scoped XML configuration defined for an application EAR removes this dependence.

To use this mechanism, you have to include an XML deployment descriptor, weblogic-application.xml, within the META-INF directory of the application EAR file, as shown in Example 18-4. You also can use this descriptor file to configure application-specific parameters, JDBC pools, security settings, EJB-wide settings, etc. For now, we focus only on the XML configuration settings.

Example 18-4. A typical weblogic-application.xml configuration

<weblogic-application> <!-- ... rest of weblogic-application ... --> <xml> <parser-factory> ...

Get WebLogic: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.