Thursday, December 29, 2011

ADF Faces on Weblogic 12c

Weblogic 12c is released a few weeks ago and now we have a robust, scalable Java EE6 implementation. The ADF seems to be slightly behind because a certified version of ADF Runtime is not yet available for weblogic 12c. You could try to install an older ADF runtime on 12c and I for sure ran into problems.

All I needed out of the ADF Runtime was the ADF Faces technology, so I thought to create a deployment-library of only needed jars that won't break ADF in general and then reference them from my webapp. That way, I could explore CDI and other cool features of Java EE6 bundled in Weblogic 12c, while continuing to use the ADF(faces). Now whenever the ADF Runtime is available, I can simply remove this custom ADF deployment-library from weblogic and update the needed library references in my webapp.

Here is what I did to create this temporal ADF deployment-library:

1. Created a maven web-archive project
$ mvn archetype:generate -DgroupId=com.test.adflib  -DartifactId=My-ADFLib -DarchetypeArtifactId=maven-archetype-webapp

2. Added <proj>/src/main/resources/META-INF/MANIFEST.MF to specify deployment-library name, version etc.
Specification-Title: TEMP-ADF Faces Library
Specification-Version: 1.0
Implementation-Title: TEMP-ADF Faces Library
Implementation-Version: 1.0
Implementation-Vendor: Self
Extension-Name: adf

2. Added following dependencies in the pom.xml and in added needed jars in my local repository.
    <dependency>
      <groupId>oracle.jdeveloper.library</groupId>
      <artifactId>ADF-Faces-Runtime-11</artifactId>
      <version>11.1.2.1.0</version>
      <type>pom</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oracle.jdeveloper.library</groupId>
      <artifactId>ADF-Common-Runtime</artifactId>
      <version>11.1.2.1.0</version>
      <type>pom</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oracle.jdeveloper.library</groupId>
      <artifactId>ADF-DVT-Faces-Runtime</artifactId>
      <version>11.1.2.1.0</version>
      <type>pom</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oracle.jdeveloper.library</groupId>
      <artifactId>ADF-DVT-Faces-Databinding-Runtime</artifactId>
      <version>11.1.2.1.0</version>
      <type>pom</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oracle.jdeveloper.library</groupId>
      <artifactId>ADF-DVT-Faces-Databinding-MDS-Runtime</artifactId>
      <version>11.1.2.1.0</version>
      <type>pom</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oracle.jdeveloper.library</groupId>
      <artifactId>Oracle-JEWT</artifactId>
      <version>11.1.2.1.0</version>
      <type>pom</type>
      <scope>compile</scope>
    </dependency>


4. Updated the pom.xml create-war plugin to include the custom MANIFEST.MF

  <build>
     <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>


5. Build(mvn clean install) and deploy the artifact as a deployment-library.

6. References this custom adf library by adding following to the weblogic.xml

    <library-ref>
        <library-name>adf</library-name>
        <specification-version>1.0</specification-version>
    </library-ref>

7. The web.xml in the webapp should register all the needed servlets(FacesServlet, ResourceServlet, GraphServlet,MapProxyServlet) as needed for ADF.



4 comments:

  1. Hi Suhas,

    And with these steps - did it eventually work for you? You mention you ran into problems... Are these steps the ones that got you into these problems - or the ones that got you out of them?

    kind regards,

    Lucas

    ReplyDelete
  2. Hi Lucas,

    Yes, it did work for me with the above steps.

    In the past, we had Weblogic 11g with ADF Runtime installed and our app had library-refs to needed libs in the ADF-Runtime. It was all fine, but then we upgraded to Weblogic 12c and the ADF Runtime stopped working with way too many exceptions.

    Therefore, in the absence of a certified ADF-Runtime of 12c, we decided to install a plain vanilla Weblogic 12c(no ADF Runtime) and then deploy a custom-ADF lib as posted on this blog, which entailed only needed libs for ADF-Faces. And yes, it worked.

    Suhas

    ReplyDelete
  3. Hi, Suhas
    I've tried your steps.
    After ran "mvn clean install", got following errors:
    [ERROR] Failed to execute goal on project My-ADFLib: Could not resolve dependencies for project com.test.adflib:My-ADFLib:war:1.0-SNAPSHOT: The following artifacts could not be resolved: oracle.jdeveloper.library:ADF-Faces-Runtime-11:pom:11.1.2.1.0, oracle.jdeveloper.library:ADF-Common-Runtime:pom:11.1.2.1.0, oracle.jdeveloper.library:ADF-DVT-Faces-Runtime:pom:11.1.2.1.0, oracle.jdeveloper.library:ADF-DVT-Faces-Databinding-Runtime:pom:11.1.2.1.0, oracle.jdeveloper.library:ADF-DVT-Faces-Databinding-MDS-Runtime:pom:11.1.2.1.0, oracle.jdeveloper.library:Oracle-JEWT:pom:11.1.2.1.0: Failure to find oracle.jdeveloper.library:ADF-Faces-Runtime-11:pom:11.1.2.1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

    Jacky Wen

    ReplyDelete
  4. Hi Jacky,

    You local maven-repository perhaps doesn't contain those dependency jars, and they certainly would not be available in a public maven-repository. Therefore, I can think of two choices, and would recommend #2:

    1. Add those jars to the local-repository -
    These jars could be found in jdeveloper or old ADF based appls, and then you can follow the maven documentation on adding those jars to your local-repo.

    OR

    2. Remove the dependencies altogether and add the jars to your WEB-INF/lib manually.

    a. Comment-out or remove the dependencies listed in step#2 of the blog.
    b. Create following dir under your maven-project My-ADFLib
    My-ADFLib/src/main/webapp/WEB-INF/lib
    c. Copy following jars from jdeveloper or old ADF based project My-ADFLib/src/main/webapp/WEB-INF/lib. Here is the list of jars.

    activation-1.1.0.0_1-1.jar adf-controller-security-11.1.1.jar adf-richclient-api-11-sherman-MLR-SNAPSHOT.jar adf-richclient-impl-11-sherman-MLR-SNAPSHOT.jar adf-share-base-11.1.1.jar adf-share-ca-11.1.1.jar adf-share-security-11.1.1.jar adf-share-support-11.1.1.jar adflogginghandler-11.1.1.jar adfsharembean-11.1.1.jar balipi-11.1.2.jar balishare-11.1.2.jar batik-anim-1.7.jar batik-awt-util-1.7.jar batik-bridge-1.7.jar batik-codec-1.7.jar batik-css-1.7.jar batik-dom-1.7.jar batik-ext-1.7.jar batik-extension-1.7.jar batik-gui-util-1.7.jar batik-gvt-1.7.jar batik-parser-1.7.jar batik-script-1.7.jar batik-svg-dom-1.7.jar batik-svggen-1.7.jar batik-swing-1.7.jar batik-transcoder-1.7.jar batik-util-1.7.jar batik-xml-1.7.jar cache-11.1.1.jar dvt-basemaps-11.1.1.jar dvt-databindings-11.1.1.jar dvt-databindings-mds-11.1.1.jar dvt-faces-11.1.1.jar dvt-facesbindings-11.1.1.jar dvt-jclient-11.1.1.jar dvt-trinidad-11.1.1.jar dvt-utils-11.1.1.jar identitystore-1.0.jar jewt-core-11.1.2.jar jgoodies-looks-11.1.2.jar mdslcm-client.jar mdslcm.jar mdsrt.jar oraclexsql.jar oramds.jar prefuse-11.1.1.jar share-11.1.1.jar trinidad-api-2.0.0.1-SNAPSHOT.jar trinidad-impl-2.0.0.1-SNAPSHOT.jar x1 xml-apis-ext-11.1.1.jar xml.jar xmlmesg.jar xmlparserv2.jar xmlparserv2_jaxp_services.jar xmlparserv2_sans_jaxp_services.jar xquery.jar xsqlserializers.jar xsu12.jar

    Alternatively, if you prefer ant based builds, you could do it that way too as long as the generated artifact contains above jars and deployed as library.

    Suhas

    ReplyDelete