Wednesday, February 10, 2010

Maven2 Plug-in for JDeveloper 11.1.1.2

Note: Maven plugin provided by jdeveloper is a preview version. Its not supporting all the features of maven. I would suggest wait till they release final version of it.


Installing the Maven plug-in

JDeveloper11g --> help --> Check for Updates --> search for maven --> select Developer Preview: Maven for JDeveloper or download the zip from the below link.
http://www.oracle.com/technology/products/jdev/101/update/exchange.xml#oracle.jdeveloper.maven

Running maven commands from jdeveloper :
Right click pom and select maven goals.

Project Structure :

Model project:


Project Source Paths -
Java Source Paths: remove existing and add path to [ApplicationHome]\Model\src\main\java
Output Directory: [ApplicationHome]\Model\target\classes
Default Package: com.mycompany.appname.model
Modelers - Model Path: [ApplicationHome]\jdeveloper\diagramMetaData
Database - Database Path: [ApplicationHome]\database\diagrams
Technology Scope: ADF Business Components (and Java)

ModelTest project:
Project Source Paths -
Java Source Paths: remove existing and add path to [ApplicationHome]\Model\src\test\java
Output Directory: [ApplicationHome]\Model\target\test-classes
Default Package: com.mycompany.appname.model

ViewController project:

Project Source Paths -
Java Source Paths: remove existing and add path to [ApplicationHome]\ViewController\src\main\java
Output Directory: [ApplicationHome]\ViewController\target\classes
Default Package: com.mycompany.appname.view
ADFmSource directory: remove existing and add path to [ApplicationHome]\ViewController\src\main\java
Modelers - Model Path: [ApplicationHome]\jdeveloper\diagramMetaData
Web Application - HTML Root Folder: [ApplicationHome]\ViewController\src\main\webapp

ViewControllerTest project:

Project Source Paths -
Java Source Paths: remove existing and add path to [ApplicationHome]\ViewController\src\test\java
Output Directory: [ApplicationHome]\ViewController\target\test-classes
Default Package: com.mycompany.appname.view

Tuesday, February 9, 2010

How to package a project to be a shared library in WebLogic Server

How to package a project to be a shared library in WebLogic Server


If you are packaging a project and want to deploy it as a shared library in a WebLogic Server, you must wrap the ADF Library JAR with a WAR or EAR file and then install the WAR or EAR as a shared library into the Oracle WebLogic Server.



For design time usage, producers of the ADF library JAR can create a .library file that contains the paths to the ADF Library JAR files. The consuming project can add this Library file to the project's libraries and classpath. When the Library file is created, the Deploy by Default option must be deselected, otherwise the JAR paths in the Library file will be included in the user's deployment, thereby creating a runtime conflict with the same JARs in the shared library.



When the consuming application is being deployed, the dependent ADF Library JAR wrapped inside a WAR or EAR must already have been deployed to the Oracle WebLogic Server as as shared library.



Create an ADF Library JAR file.

Right-click the project and select Project Properties > Libraries and Classpath and add the ADF Library JAR file created in step 1.

Create a WAR deployment profile for the project.

Create the WAR or EAR file. If you do not have ADF Faces components in your project, add the ADF Faces technology scope to your project before you create the WAR or EAR file.

Deploy the WAR or EAR file to the WebLogic Server as a shared library using tools such as the Oracle Fusion Middleware Configuration Wizard, Enterprise Manager, or WLST scripts.

From the main menu, choose Tools > Manage Libraries.

In the Manage Libraries dialog, click Load Dir.

In the Load Directory dialog, select the directory where you want to place the Library files. This folder should be in a location next to the corresponding folder of ADF Library JAR files to simplify the process of locating files. It can even be the same folder.

In the Manage Libraries dialog, click New.

In the Create Library dialog, enter a library name and click Add Entry.

In the Select Path Entry dialog, select the libraries you want to add and click Select.

In the Create Library dialog, be sure that Deployed by Default is not selected, click OK and click OK again.

Open the Library file you created in Step 10 in a text editor and set the locked property to true and save the file.

At design time, any consuming project can reference this shared library by adding the Library file to the project using the Project Properties window.

In the Application Navigator of the consuming project, from the main menu, choose Tools > Manage Libraries.

In the Manage Libraries dialog, click Load Dir.

In the Load Directory dialog, select the directory where the Library files were created in Step 7.

In the Application Navigator of the consuming project, right-click a project and select Project Properties.

In the Project Properties window, select Libraries and Classpath and click Add Library.

In the Add Library dialog, select the Library file and click OK.

click OK.

You must edit either the WEB-INF/weblogic.xml for a WAR or the META-INF/weblogic-application.xml for an EAR to include a library-ref entry that specifies the name and version of the shared library that was produced in Step 4.

Post-deployment application configuration using ADF MBeans

If you plan to configure ADF connection information or adf-config.xml using ADF MBeans after the application has been deployed, make sure that the application is configured with MDS. The adf-config.xml file must include MDS entries, as shown in the following example. If it does not, edit the file to include them.



<adf-mds-config xmlns="http://xmlns.oracle.com/adf/mds/config">

<mds-config xmlns="http://xmlns.oracle.com/mds/config"

version="11.1.1.000">

<persistence-config>

<metadata-store-usages>

<metadata-store-usage default-cust-store="true"

deploy-target="true" id="myRepos">

</metadata-store-usage>

</metadata-store-usages>

</persistence-config>

</mds-config>

</adf-mds-config>



The web.xml file must also contain entries for each ADF MBean. The following example shows entries for three ADF MBeans.



<listener>

<listener-class>oracle.adf.mbean.share.connection.ADFConnectionLifeCycleCallBack

</listener-class>

</listener>

<listener>

<listener-class>oracle.adf.mbean.share.config.ADFConfigRuntimeLifeCycleCallBack

</listener-class>

</listener>

<listener>

<listener-class>oracle.bc4j.mbean.BC4JConfigLifeCycleCallBack

</listener-class>

</listener>



11.1.1.0 Known Issues

http://www.oracle.com/technology/products/jdev/htdocs/11/11.1.1.1/knownissues.html

Saturday, January 30, 2010

Weblogic Deployment Plan

In weblogic for an application a plan can be setup using plan.xml

How to create plan.xml
1. Open application that was deployed using weblogic console
2. Open configuration tab and make changes. Any changes made to configuration of the application will create plan.xml.
3. It will prompt the location of the Plan.xml.

How does it look like and how does it work ?
Here is a sample of a plan.xml :
<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://xmlns.oracle.com/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/deployment-plan http://xmlns.oracle.com/weblogic/deployment-plan/1.0/deployment-plan.xsd">
<application-name>app</application-name>

<variable-definition>

<variable>

<name>SessionDescriptor_invalidationIntervalSecs_12648285993120</name>

<value>59</value>

</variable>

<variable>

<name>mypath</name>

<value>C:\Documents and Settings\ram\My Documents</value>

</variable>

</variable-definition>

<module-override>

<module-name>TestWeblogicPlan_application1.ear</module-name>

<module-type>ear</module-type>

<module-descriptor external="false">

<root-element>weblogic-application</root-element>

<uri>META-INF/weblogic-application.xml</uri>

<variable-assignment>

<name>SessionDescriptor_invalidationIntervalSecs_12648285993120</name>

<xpath>/weblogic-application/session-descriptor/invalidation-interval-secs</xpath>

</variable-assignment>

</module-descriptor>

<module-descriptor external="false">

<root-element>application</root-element>

<uri>META-INF/application.xml</uri>

</module-descriptor>

<module-descriptor external="true">

<root-element>wldf-resource</root-element>

<uri>META-INF/weblogic-diagnostics.xml</uri>

</module-descriptor>

</module-override>

<module-override>

<module-name>TestWeblogicPlan_ViewController_webapp1.war</module-name>

<module-type>war</module-type>

<module-descriptor external="true">

<root-element>weblogic-web-app</root-element>

<uri>WEB-INF/weblogic.xml</uri>

<variable-assignment>

<name>mypath</name>

<xpath>/weblogic-web-app/virtual-directory-mapping/local-path</xpath>

</variable-assignment>

</module-descriptor>

<module-descriptor external="false">

<root-element>web-app</root-element>

<uri>WEB-INF/web.xml</uri>

</module-descriptor>

</module-override>

<config-root>C:\TGDev\Products\Oracle\Middleware\user_projects\domains\OWCS_domain\servers\AdminServer\upload\TestWeblogicPlan_application1</config-root>

</deployment-plan>



As you can see XPath is used to qualify the path of the attribute to update. For instance, here it's "/weblogic-web-app/session-descriptor/timeout-secs".

You will notice that the XPath indicated is simply the path to that attribute in the following weblogic.xml deployment descriptor.


The changes in Plan.xml will take effect only after update of the application and restart of the domain.



Note: specify your changes in the overide tag of plan.xml. With the plan.xml you can set values to weblogic.xml and weblogic-application.xml

Tuesday, January 26, 2010

11g virtual dir url pattern is not identified correctly

<virtual-directory-mapping>

<local-path>x:/test/vdir</local-path>

<url-pattern>/test/*</url-pattern>

</virtual-directory-mapping>

Solution
1. Create directory name test and put ur file in that directory

The directory should be created at this path x:/test/vdir. But do not specify the test directory in your local-path.

<virtual-directory-mapping>

<local-path>x:/test/vdir</local-path>

<url-pattern>/test/*</url-pattern>

</virtual-directory-mapping>

Test URL : http://hostname:port/testapp/test/mypage.pdf