Shared Java EE Libraries and Optional Packages Compared

9-4 Developing Applications for Oracle WebLogic Server a minimum version of the same library. Applications that require no specific version can be configured to use the latest version of the library. Section 9.3, Referencing Shared Java EE Libraries in an Enterprise Application .

9.1.4 Shared Java EE Libraries and Optional Packages Compared

Optional packages and shared Java EE libraries have the following features in common: ■ Both are registered with WebLogic Server instances at deployment time. ■ Both support an optional implementation version and specification version string. ■ Applications that reference shared Java EE libraries and optional packages can specify required versions for the shared files. ■ Optional packages can reference other optional packages, and shared Java EE libraries can reference other shared Java EE libraries. Optional packages differ from shared Java EE Libraries in the following basic ways: ■ Optional packages are plain JAR files, whereas shared Java EE libraries can be plain JAR files, Java EE Enterprise applications, or standalone Java EE modules EJB and Web applications. This means that libraries can have valid Java EE and WebLogic Server deployment descriptors. Any deployment descriptors in an optional package JAR file are ignored. ■ Any Java EE application or module can reference an optional package using META-INFMANIFEST.MF, whereas only Enterprise applications and Web applications can reference a shared Java EE library using weblogic-application.xml or weblogic.xml In general, use shared Java EE libraries when you need to share one or more EJB, Web application or Enterprise application modules among different Enterprise applications. Use optional packages when you need to share one or more classes packaged in a JAR file among different Java EE modules. Plain JAR files can be shared either as libraries or optional packages. Use optional packages if you want to: ■ Share a plain JAR file among multiple Java EE modules ■ Reference shared JAR files from other shared JARs ■ Share plain JARs as described by the Java EE 5.0 specification Use shared Java EE libraries to share a plain JAR file if you only need to reference the JAR file from one or more Enterprise applications, and you do not need to maintain strict compliance with the Java EE specification.

9.1.5 Additional Information