Wednesday, April 4, 2012

Deploy your ADF UIX applications to WebLogic

Just a quick blogpost how you can deploy your old ADF UIX ( 10.1.2)  applications to the WebLogic 11g ( 10.3.5 ) application server. Off course this is not supported by Oracle, who cares, your old 10.1.2 OC4J container is also end of life.  When it works, it works :-)

First you need to create a JDBC DataSource in the WebLogic Console.

You need to use the oracle.jdbc.OracleDriver driver class ( don't use XA, disable global commit ) else you will get some strange oracle BLOB errors.

Set Statement cache size to 0 ( in the connection pool Tab of the datasource )

also in the advanced options of the datasource you should de-select Wrap Data Types.
By default, data type objects for Array, Blob, Clob, NClob, Ref, SQLXML, and Struct, plus ParameterMetaData and ResultSetMetaData objects are wrapped with a WebLogic wrapper.


If you don't do this then ADF BC ( BC4J ) can't do its passivation in the ps_txn table ( this contains a BLOB datatype) and your applications behaves very strange
or you can set jbo.passivationstore to file


Next step is to make a shared library ( just use a war template ), For this I use an exploded folder so I can easily add and remove some jars.

I have a folder called adf.uix ( or a war with this name )

Folder META-INF
   File MANIFEST.MF with the following content

     Manifest-Version: 1.0
     Extension-Name: adf.uix
     Specification-Title: adf.uix
     Specification-Version: 1.0
     Implementation-Version: 10.1.2


Folder WEB-INF
  A empty web.xml file with the following content

     <?xml version = '1.0' encoding = 'windows-1252'?>
     <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"     "http://java.sun.com/dtd/web-app_2_3.dtd">
     <web-app>
     </web-app>
  
  Folder lib with all the 10.1.2 jars which I needed.



Deploy the shared library to WebLogic.

Next step is to unpack the war of your uix application ( we don't need the ear )

We need to create a weblogic deployment descriptor called weblogic.xml and put this in the WEB-INF folder. ( you can delete the orion one )

This weblogic descriptor contains a reference to our just created shared library. Also set the WEB-INF/lib as preferred classloading.


<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app
     http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
     xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
  </container-descriptor>
  <library-ref>
    <library-name>adf.uix</library-name>
  </library-ref>
</weblogic-web-app>

This is the content of my WEB-INF/lib folder 




Zip everything to a new war file or use the exploded folder.

When you use jdk1.6 or higher you can set -Djava.awt.headless=true so cabo uix does not need X-Windows or Windows desktop to generate gif images.

And when you don't see the images then you should also use an exploded folder instead of a war so cabo uix has a file path to store the generated images. Or make an UIX configuration class which contains cabo paths to a folder of the weblogic server.

Deploy the war or exploded folder  to weblogic, test it and delete your own OC4J Container.


8 comments:

  1. Hi Edwin, this is off the topic here. I read the artical "Three Recipes for Oracle Service Bus 11g" in oracle web site. It's great, but the DB schema and install.cmd are not in the downloaded source code. Could you guys please add them in? Thank you very much.

    ReplyDelete
    Replies
    1. Hi,

      I try to download the zip but it gives me some corruption problems. but I think you don't need a DB Schema for these recipes and maybe the install.cmd is removed by your virus scanner.

      thanks.

      Delete
  2. Hi Edwin.Sorry for my bad English.
    Great theme that you've tried here. But I have a problem I could not solve.
    When deploy my web application(JDeveloper 10g) I get this error:
    //-------------------------------------------------------------------
    Error 500--Internal Server Error

    java.lang.NullPointerException
    at oracle.adf.model.BindingRequestHandler.endRequest(BindingRequestHandler.java:226)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:166)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun
    (WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run
    (WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    //--------------------------------------------------------------------------
    Appears that not connected to the data source.
    But when I make an application without database access does not happen, everything works fine.
    Help me please.
    Thank you very much.

    ReplyDelete
    Replies
    1. Hi,

      did you update the web-inf/lib jars to the latest jdeveloper 10.1.2 or 10.1.3 versions also in the shared lib.
      somehow the ADF binding is failing.

      can you make a small testcase based on the hr demo schema then i will take a look.

      thanks

      Delete
  3. Hi Edwin,
    I am trying to develop SOA composite application which uses/invokes the ADF-BC application services for its process deployed in the same soa_server1. This ADF-BC is already developed, just I need to deploy it and use the services from BPEL. Deployment message in JDev console states that, deploy is successful. But when I am trying to test this application using JDev in the WSIL connection its gives error in a dialog. "An unexpected severe error has occured in JDev and when say ok ...JDev get closed.
    what could be problem with the deployed ADF-BC application.

    ReplyDelete
    Replies
    1. Hi

      did you get a stacktrace and try to deploy everything on the soa server.

      thanks

      Delete
  4. Thank you for this great post. Didn't you fall into the "JBO-29000: weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper cannot be cast to oracle.jdbc.OracleStatement" error? In bc4j.xml, I commented a tag like "DBConnection2" and replaced it with a tag like "jdbc/SuperBC4J" pointing to a Weblogic Data Source (with Wrap Data Types de-selected), but I get that previous error. I have't been able to make it work with the inline connection definition ( element)...i hangs out trying to reach the DB.

    ReplyDelete
    Replies
    1. Hi,

      make sure you are on the latest weblogic version with adf runtime and get the latest 10.1.2 or 10.1.3 jdev jars and replace your own with these. That solved most problems for me.

      thanks

      Delete