Thursday, December 24, 2009

ADF 11: Create Application EAR for test and production deployment respectivly

Status: resolved
Oracle JDeveloper Deploy: 11.1.1.2.0.5536

In this post I want to show how you can easily automate the issue mentioned in Andrejus Baranovskis post about How to do Manual Deployment for ADF 11g Application EAR with Auto Generated JDBC Descriptors.

Introduction

Ok, so what actually is the issue with the Auto Generated JDBC Descriptors in the generated EAR? To understand the problem better I have made up a quick overview

image

You see a typical scenario of a development environment (not optimal but no that bad) On each developers machine there is JDeveloper and the Integrated WebLogic Server installed. If a developer joins a project she checks out the sourcecode, opens it Jdeveloper and is able to run the application. It order to get this working JDeveloper generates the appropriate JDBC descriptors and packages the datasource definition into the EAR which is deployed on the integrated WLS. The application runs on developers machine with zero configuration changes because ‘Auto-generate and Synchronize weblogic-jdbc.xml Descriptors During Deployment' checkbox on the Deployment page of the workspace's Application Properties dialog is activated.

On the right side you see the components on the test/nightly build server with dedicated test database! So the connection information is different from the dev system, the data source in  the WLS must be created manually or script based. For that reason the EAR must not include any datasource definitions because they are obtained from the container (WLS). The EAR is generated by the ojdeploy utility which operates mainly on the application workspace file (.jws)

The problem now is that the ‘Auto-generate and Synchronize weblogic-jdbc.xml Descriptors During Deployment' option is saved in the Application Workspaces file which resides in the SCM repository and both - the developer and Test-Server - obtain there config from a single source!

Solution

Is simple, works but maybe a bit dirty;-) Observing the application workspace file (jws) I recognized the following line

<value n="Weblogic-JDBC-Auto-Sync-Key" v="true"/>

So  switching the value to false before running ojdeploy should do the trick. I have done this with Ant. Create the following files into your workspace

image

as follows

deploy_to_ear.ant.properties
oracle.jdeveloper.workspace.path=C\:\pathto\YourApp.jws
autosync.true=<value n="Weblogic-JDBC-Auto-Sync-Key" v="true"/>
autosync.false=<value n="Weblogic-JDBC-Auto-Sync-Key" v="false"/>

deploy_to_ear.ant.xml
<?xml version="1.0" encoding="windows-1252" ?>
<project name="Deploy Helper Tasks" default="usage" basedir=".">
  <property file="deploy_to_ear.ant.properties"/>
  <target name="usage">
    <echo>Use one of the following targets:</echo>
    <echo>1) disable-wls-jdbc-autosync - desc todo</echo>
    <echo>2) enable-wls-jdbc-autosync  - desc todo</echo>
  </target>
  <target name="disable-wls-jdbc-autosync">
    <replaceregexp match="${autosync.true}"
                   file="${oracle.jdeveloper.workspace.path}"
                   replace="${autosync.false}"/>
  </target>
  <target name="enable-wls-jdbc-autosync">
    <replaceregexp match="${autosync.false}"
                   file="${oracle.jdeveloper.workspace.path}"
                   replace="${autosync.true}"/>
  </target>
</project>

deploy_to_ear.ojdeploy.xml
<?xml version = '1.0' standalone = 'yes' ?>
<ojdeploy-build>
  <deploy>
    <parameter name="workspace" value="${workspace.path}\YourApp.jws"/>
    <parameter name="profile" value="*"/>
    <parameter name="nocompile" value="true"/>
    <parameter name="nodatasources" value="true"/>
    <parameter name="forcerewrite" value="true"/>
    <parameter name="outputfile" value="${workspace.path}/deploy/${ear.filename}"/>
  </deploy>
</ojdeploy-build>

deploy_to_ear.bat
@echo off

echo [INFO] Create deployment EAR for ADF fusion web application

call ant -f deploy_to_ear.ant.xml disable-wls-jdbc-autosync
call ojdeploy -buildfile deploy_to_ear.ojdeploy.xml -define workspace.path=C:\yourpath\to\workspace,ear.filename=testapp1_without_datasources.ear
call ant -f deploy_to_ear.ant.xml enable-wls-jdbc-autosync

Alternatively to run the enable-wls-jdbc-autosync target after ojdeploy has finished you could also do a revert on the .jws file if your SCM system supports it.

In my sample application the generated EAR files look as follows

image

Keep on automating your build process;-)

Saturday, December 12, 2009

Oracle Team Productivity Center (OTPC) – Team Server part

Status: resolved
Oracle Team Productivity Center: 11.1.1.2.0
Oracle WebLogic Server: 10.3.2
Environment: TELDE

Overview

We want to use Oracles solution for Applpication Lifecycle Management (ALM) called Oracle Team Productivity Center. OTPC enables software development teams to collaborate and work productively together when developing applications using JDeveloper.

OTPC consist of several component from which we will cover the server side ones in this blog post. That are the Team Server which is connected to databased repository and some specific ALM connectors. Currently there are implementations for

  • JIRA (since 11.1.1.1.0)
  • MS Project Server (since 11.1.1.1.0)
  • Bugzilla (new in 11.1.1.2.0)

The following figures gives an overview of the involved components:

image

The Team Server component is a WAR exposing some WebServices which are cosumed by the JDeveloper TPC Extension counterpart. The deployement is currently supported either on a WebLogic Server or Apache Tomcat.

Quick Outline of this post

  1. Download OTPC Server Component
  2. Create Database Schema for OTPC
  3. Install  OTPC Server Component on WebLogic Server 10.3.2
  4. Install JDeveloper OTPC extension
  5. Test the OTPC connection.

Download Products

  Product
Download
  Oracle® Team Productivity Center Server Component + Connectors
Download from OTN

Create database schema

Area 
Description 
Putty

login as: oracle
oracle@192.168.234.140's password:
Last login: Mon Aug  3 21:47:45 2009 from 192.168.234.1

[oracle@telde ~]$

[oracle@telde ~]$ . ./setDb1Env.sh

Aktuelle Oracle Umgebung:

Oracle-Home: /u01/app/oracle/product/11.1.0/db_1

Oracle-SID:  orcl

[oracle@telde ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.7.0 - Production on Thu Nov 5 07:40:04 2009

Copyright (c) 1982, 2008, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create user ofm_tpc identified by ofm_tpc;

User created.

SQL> grant connect, resource to ofm_tpc;

Grant succeeded.

SQL> connect ofm_tpc/ofm_tpc;

Connected.

SQL> disconnect;

Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit;

[oracle@telde ~]$

Install OTPC Server Component

Area 
Description 
Client Start Xming!
WinSCP Copy downloaded tpcinstaller.jar to /u01/product/oracle/middleware/11.1.1/tpc
Putty / set java env

Login as oracle

[oracle@telde ~]$ . ./setFusionDomainEnv.sh

/home/oracle

Aktuelle Oracle Umgebung:

$WLS_DOMAIN:               fusion_domain

$WLS_DOMAIN_HOME(=$DH): /u01/app/oracle/product/11.1.1.2/middleware/user_projects/domains/fusion_domain

$MW_HOME:                  /u01/app/oracle/product/11.1.1.2/middleware

$JAVA_HOME:                /u01/app/oracle/product/11.1.1.2/middleware/jrockit_160_14_R27.6.5-32

[oracle@telde ~]$ java -version

java version "1.6.0_14"

Java(TM) SE Runtime Environment (build 1.6.0_14-b08)

BEA JRockit(R) (build R27.6.5-32_o-121899-1.6.0_14-20091001-2113-linux-ia32, compiled mode)

[oracle@telde ~]$ cd /u01/product/oracle/middleware/11.1.1/tpc/ [oracle@telde tpc]$ java -jar tpcinstaller.jar

Installer image
Choose: Next
  image

Input JDBC: jdbc:oracle:thin:@database.telde.local:1521:orcl
Input Username: ofm_tpc
Input Password: ofm_tpc
Choose: Next

  image 
Select: Server
Select: Connectors
Choose: Next
  image 
Input: /u01/app/oracle/product/11.1.1.2/middleware/user_projects/domains/fusion_domain/autodeploy
Choose: Next
  image

Choose File Name: <whatever connector you want to additionally be installed>
Choose: Next

  image 
Input Username: tpcadmin
Input Password: welcome1
Input Confirm Password: welcome1
Choose: Next
  image 
View Summary, Verify your made selections!
Choose: Finish
Installation in progress image
wait…..
  image
Choose: Close
Putty/Start WebLogic

Start the WebLogic server

[oracle@telde tmp]$cd $DOMAIN_HOME

[oracle@telde fusion_domain]./startWebLogic.sh

...

[EL Info]: 2009-11-05 07:47:00.511--ServerSession(41694633)--zip:/u01/app/oracle/product/11.1.1.2/middleware/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_appsdir_otpc_war/sfdu2u/war/WEB-INF/lib/_wl_cls_gen.jar!/-otpc login successful

Browser/Verify OTPC is running image

Upgrade notes

Test the connection to OTPC from JDeveloper

Area 
Description 
JDeveloper 

Start and Use Help>Check for updates to install the team productivity center extension, plus required client connectors.

  image
Select the Team Navigator tab or Open it by menu (View>Team>Team Navigator)
Click: Connect To Team Server

Input Team Server: telde.local
Input Port: 7001
Input Username: tpcadmin
Input Passwort: welcome1
Choose: Connect
JDeveloper/Team Administration Now you can reach the Team Administration as follows
image 
Now you are able to create user, assign team repositories and so on...

Observations

  • Calling the Test Server Page (<host>:<port>/otpc) you just get a simple message “Oracle Team Productivity Center” Request to Oracle: Please display some more information: Version, active connectors, etc.....!!! At the moment this does not look enterprise production ready!! Sorry. It looks like a prototyp so far……
  • Do I really have to create all the users into the OTPC repository by hand? Can’t I connect to an LDAP-Server? This also looks not enterprise production ready. Sorry.

Further Information

Monday, December 7, 2009

DOAG09: Deployment of ADF fusion web applications on Oracle WebLogic Server 11g

 

This year at DAOG 2009 (the german oracle user group) I had the chance to give a presentation on the interesting topic “deployment of adf applications on Oracle WebLogic Server 11g”.image

From my point of view it is interesting because there are some issues you need to consinder when deploying your adf fusion web app to a standalone WebLogic Server in your Test oder Production environment. It is not always as easy as deploying just to the local integrated WebLogic Server.

 

The following points are covered

  • Installation WebLogic Server 11g
  • Configuration WebLogic Domain for ADF11g/10g
  • Introduction of various deployment options: Jdev Remote, Console/EM, Ant, WLST
  • Deployment guide for needed artefacts: datasource, meta data service repository, security configuration
  • Overview deployment & needed configuration changes in clustered environment
  • Some best practices, some WLST fragments

Download: Deployment von ADF-Applikationen auf den Oracle WebLogic Server 11g

Language: only in german

Monday, November 23, 2009

ADF: Query-By-Example table filter bug

Status: open
Applies to JDeveloper: 11.1.1.2, 11.1.1.3

Today I tried if the Bug (discussed in http://forums.oracle.com/forums/message.jspa?messageID=3568706) is still reproducible.
And sadly to say: “Yes the bug still exists!”
The behaviour changed a bit but the table filtering feature still does not working as expected if used INSIDE PAGE FRAGMENT/TASKFLOW.
So take a look at the viewlet where I shortly explain the buggy behaviour.


Download Testcase: http://www.box.net/shared/sviqlzzobp

Related resources

http://forums.oracle.com/forums/message.jspa?messageID=3568706
http://forums.oracle.com/forums/thread.jspa?threadID=2157454

Sunday, November 22, 2009

TELDE - What's that?

If you are wondering what telde is all about then I would like to give a hint on a presentation my collegue Ulrich gave at DOAG 2009 : ADF 11g rich client development best practices . We are using TELDE for development, testing and so on...while developing Apps on the oracle stack (currently ADF11g/JDeveleloper/WebLogic/Oracle Enterprise Linux). So TELDE stands for

TEam Linux Development Environment

It consists of the following components right now:

Oracle Enterprise Linux 5.3

Oracle Database 11.1.0.7

Oracle WebLogic Server 11g

Oracle JDeveloper 11.1.1.x

Oracle Team Productivity Center

Hudson Continuous Integration Server 

OpenLDAP

SVN Server


running on VMWare.




So if you are interested in setting up such an environment, look at http://padora.blogspot.com


Monday, November 16, 2009

WLS: Monitoring Oracle JRockit JVM with JRockit Mission Control remotely

Status: resolved
JRockit Mission Control: 3.1.2
WebLogic: 10.3.2

Use case

You have the need to remotely monitor and profile the JRockit JVM(s) of Oracle WebLogic Server.


Solution

  1. Install JRockit Mission Control on the client
  2. Configure WebLogic Server Domain with JRockit JVM
  3. Configure JRockit Management Server

Components/Products

 Product
Download
 Oracle® WebLogic Server
Download from OTN
 Oracle® JRockit Mission Control 
Download from OTN 

How to

Bereich
Beschreibung
  
Putty 
Login as oracle
on telde.local
[oracle@telde ~]$ cd middleware/user_projects/domains/base_domain/ [oracle@telde base_domain]$ vi startWebLogic.sh
Putty/viAdd the following java Options before starting the WLS instance:

JAVA_OPTIONS="-Xmanagement:ssl=false,authenticate=false,port=7091"
export JAVA_OPTIONS

${DOMAIN_HOME}/bin/startWebLogic.sh $*

Save file and Close vi.
PuttyStart WLS

[oracle@telde base_domain]$ ./startWebLogic.sh
….
Notice the starting of the management server

[JRockit] Management server started on port 7091, ssl=false, authenticate=false.

ClientStart JRockit Mission Control
JRMCCreate a new connection
image
Enter Host
Enter Port
image
Click: Test connection
=> Status keeps “Unable to connect”
Click: Finish

Starting the console on the newly created connection you might receive the following exception:

Could not open Management Console for telde.local.
  com.jrockit.mc.rjmx.ConnectionException: Connection refused to host: 127.0.0.1; nested exception is:
    java.net.ConnectException: Connection refused: connect
    com.jrockit.mc.rjmx.ConnectionException: Connection refused to host: 127.0.0.1; nested exception is:
        java.net.ConnectException: Connection refused: connect
        at com.jrockit.mc.rjmx.ConnectionManager.connect(ConnectionManager.java:63)
        at com.jrockit.mc.console.ui.actions.StartConsole$1.preConnect…

So how to fix?
 

PuttyStop WLS
 Edit startWebLogic.sh
Add -Djava.rmi.server.hostname=<remotehost> to the java options so that it looks like
Putty/vi

..

JAVA_OPTIONS="-Djava.rmi.server.hostname=telde.local -Xmanagement:ssl=false,authenticate=false,port=7091"
export JAVA_OPTIONS

${DOMAIN_HOME}/bin/startWebLogic.sh $*

Save file and exit vi.

PuttyStart WLS once again

[oracle@telde base_domain]$ ./startWebLogic.sh
JRMCNow try to test connection again.
Result should be
image
JRMCStart the console and monitor CPU, Mem, seak for memory leaks, etc.
image

Resources

java.rmi.server.hostname (1.1 and later)

The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. In 1.1.7 and later, the default value of this property is the IP address of the local host, in "dotted-quad" format.

Tuesday, October 27, 2009

ADF: Export Collection ActionListener issue

Status: work in progress
JDeveloper: 11.1.1.1.0
WebLogic: 10.3.1

Issue

Create simple Fusion Web Application as follows:

  1. Create readonly VO in the Business Layer on a table with > 20,000 records and expose it through an AM
  2. Create simple JSPX in the ViewController project
  3. Generate readonly table on a PanelCollection by drag and drop from the data control palette
  4. Create a command button with ExportCollectionActionListener (type="excelHTML" and exportId="<id of the table component>")
    Example:
    <af:panelCollection id="pc1">
    <f:facet name="menus"/>
    <f:facet name="toolbar">
    <af:toolbar id="t2" flex="1">
    <af:commandToolbarButton text="Test here: Excel Export"
    id="ctb1">
    <af:exportCollectionActionListener type="excelHTML"
    exportedId="t1"/>
    </af:commandToolbarButton>
    </af:toolbar>
    </f:facet>
    <f:facet name="statusbar"/>
    <af:table id="t1" ....
    </af:table>
    </af:panelCollection>

Now observe the memory consumption of the WLS

  1. Run the web application
  2. View the Memory consumtion of WLS process: ca 400MB
  3. Click the export to Excel button.
  4. View the Memory consumtion of WLS process: ca 740MB
  5. Undeploy the application
  6. View the Memory consumtion of WLS process: ca 740MB
Observations
  1. A single export of 20,000 records consumes ca. 340MB
  2. It seems there is a memory leak because the memory consumption remains after undeployment.
  3. Same result on Windows XP and Oracle Enterprise Linux 5.3(32bit)
Question

So why the export functionality consumes so much RAM?
Is there a memory leak? How to workaround?

Solution

Still in progress..in cooperation with Oracle Support… will be updated here.

Proposal

In order to be more flexible and powerful it would be great to be able to implement own Exporter implementations, e.g.

<af:exportCollectionActionListener type="excelHTML" exportedId="t1"
exporterClass="com.company.fusionapp.export.MyExcelExporter"/>

or even better (like custom conveter concept)

<af:exportCollectionActionListener type="excelHTML" exportedId="t1" exporterId="myExporter" />

and in adfc-config.xml:

<exporter id="myExporter" class="com.company.fusionapp.export.MyExcelExporter"/>

Sunday, August 2, 2009

ADF: Text resource issue

Status: Resolved
JDeveloper: 11.1.1.1.0
WebLogic: 10.3.1

Last week I came accross a cool blog about ADF BUGS FACTS. The author inspired me to write myself about similiar experiences with ADF11/JDeveloper. So today I will describe a bug concerning the i18n capabilities in ADF11.

First I have to mention tha the support for i18n text resources improved very well with JDev11 but there is a case when things do not work correctly. So in the case your ViewController project name contains a dash. things do not work anymore as expected. So in our company we have following convention to name our applications/projects.

customer-app
      app-model
      app-webui

With that convention your not able to work with the “select text resource” feature on ADF Faces Pages, because invalid code is generated. So here is the example

jdev11_i18n_bug-1024x640Because the ViewController project is called myapp-ui you get the following buggy code

jdev11_i18n_bug2

Solution

Solution is to remove the dash in c:set and of course all EL references.

<c:set var="myappuiBundle"
     value="#{adfBundle['de.team.training.i18n.myapp-uiBundle']}"/>

and

<af:outputText value="#{myappuiBundle.MY_APPLICATION_TITLE}" id="ot1"/>

After this fix the text resource is resolved correctly

jdev11_i18n_bug3


Things learned

Don’t: use dashes (-) in project names! This may cause trouble in development of fusion web applications.

Related posts

Page Fragment Design view is messed up when using resource bundle

Comment from Milkbird: Thanks for your reference Andreas. I think this is realy usefull, since someone could loose a lot of time to find out what is wrong and how to fix it.