11 August 2011

weblogic.xml and prefer-application-packages

Short and sweet this one, purely for my own future simple reference.

To use prefer-application-packages in weblogic.xml, it looks like this:
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" 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/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">

  <jsp-descriptor>
    <keepgenerated>true</keepgenerated>
    <debug>true</debug>
  </jsp-descriptor>

  <context-root>/quicktest</context-root>
  
  <container-descriptor>
    <prefer-application-packages>
        <package-name>org.codehaus.jackson.*</package-name>
        <package-name>org.codehaus.jettison.*</package-name>
        <package-name>org.objectweb.asm.*</package-name>
    </prefer-application-packages>
  </container-descriptor>

</weblogic-web-app>

5 comments:

Anonymous said...

From oracle document http://docs.oracle.com/cd/E21764_01/web.1111/e13712/weblogic_xml.htm#i1075205, I didn't find prefer-application-packages under container-descriptor, is this officially supported?
Thanks

Buttso said...

gday --

Yes it is -- we added it specifically to support war level filtering since it's a common deployment model.

It's in the XSD, so must be a doc oversight.

I'll log a doc bug, thanks for pointing it out.

-steve-

Buttso said...

I covered this a little yesterday:

http://buttso.blogspot.com.au/2012/03/web-application-filtering-classloader.html

The WLS 10.3.6 documentation shows it as well now:

http://docs.oracle.com/cd/E23943_01/web.1111/e13712/weblogic_xml.htm#sthref284

-steve-

Anonymous said...

hi,

coudl you please help wm with a sample on how I could use prefer-application-packages for a ear .I tried so many options nothing seem to work to take JPA2 on weblogic 10.3.5. I don't want to amke any changes to PRE-CLASSPATH rather manage this at application level .Appreciate your help .

Many thanks,
Sree

Buttso said...

gday Sree -

I had something on this topic a while back, have a look at this:

http://buttso.blogspot.com.au/2011/07/plugging-in-later-version-of.html

That seems like it covers what you are looking for.

Have a look anyway and post back if you still are having trouble.