Reputation: 3183
I'm trying to use Moxy 2.4.1 (updated JAXB impl) and Jersey 1.17 (updated JAX-RS impl). I have the shared library modules deployed (as libraries) to the server with no problems.
In the app (WAR) I'm developing I try to reference them from the weblogic.xml file like so:
<library-ref>
<library-name>EclipseLink-2.4.1</library-name>
<specification-version>2.4.1</specification-version>
<implementation-version>2.4.1.v20121003-ad44345</implementation-version>
<exact-match>true</exact-match>
</library-ref>
<library-ref>
<library-name>Jersey-1.17</library-name>
<specification-version>1.17</specification-version>
<implementation-version>1.17.0</implementation-version>
<exact-match>true</exact-match>
</library-ref>
But only the first referenced library seems to get used. If I use Classloader Analysis Tool (wls-cat) I only see one FilteringClassLoader and the filter pattern only matches the packages for the first shared lib. Switching the order gives me the other library.
Looking at http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd shows that library-ref is unbounded.
Anything I can do besides merging the shared libraries and only using one library-ref per application?
Edit: Please note that I am using Shared Libraries (a WebLogic specific feature) and not Optional Packages (a EE standard feature). The definition of a library is the same with both methods but which types of modules can be libraries and how you reference them are different.
Upvotes: 3
Views: 4206
Reputation: 3610
For the references to the Classloader of the shared libraries to be detected you must add the weblogic-application.xml to the META-INF directory of your EAR.
The structure of your ear would be the following:
yourEarFile.ear
META-INF
weblogic-application.xml
yourWarFile.war
yourEarFile/META-INF
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application
xmlns="http://xmlns.oracle.com/weblogic/weblogic-application"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-application http://xmlns.oracle.com/weblogic/weblogic-application/1.2/weblogic-application.xsd">
<xml>
<parser-factory>
<saxparser-factory>org.apache.xerces.jaxp.SAXParserFactoryImpl</saxparser-factory>
<document-builder-factory>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</document-builder-factory>
</parser-factory>
</xml>
<library-ref>
<library-name>EclipseLink-2.4.1</library-name>
<specification-version>2.4.1</specification-version>
<implementation-version>2.4.1.v20121003-ad44345</implementation-version>
<exact-match>true</exact-match>
</library-ref>
<library-ref>
<library-name>Jersey-1.17</library-name>
<specification-version>1.17</specification-version>
<implementation-version>1.17.0</implementation-version>
<exact-match>true</exact-match>
</library-ref>
</weblogic-application>
Upvotes: 0
Reputation: 1563
If you are using a WAR file the appropriate way to include shared libraries is in the manifest: http://docs.oracle.com/cd/E17904_01/web.1111/e13706/libraries.htm#i1070938
Please see the section titled "Referencing Optional Packages from a Java EE Application or Module":
Any Java EE archive (JAR, WAR, RAR, EAR) can reference one or more registered optional packages using attributes in the archive's manifest file.
The WAR file has a Manifest as well where you define the shared libraries you want to pull in. The weblogic.xml does not do this for WAR files. The library-ref in weblogic.xml is for SPI's not shared libraries.
The proper way to do what you are asking is using the MANIFEST.MF file. For this specific example here is what you would do:
Extension-List EclipseLink Jersey
EclipseLink-Extension-Name: EclipseLink
EclipseLink-Specification-Version: 2.4.1
EclipseLink-Implementation-Version: 2.4.1.v20121003-ad44345
Jersey-Extension-Name: Jersey
Jersey-Specification-Version: 1.17
Jersey-Implementation-Version: 1.17.0
If you need, I can provide an example of how to do this with Maven. I've been doing this for years :)
Here is an overview of the shared libraries in WebLogic. I thought it had specific examples for WARS but I guess I left that out :)
http://www.youtube.com/watch?v=ArLTKapjV_8
Upvotes: 0