Tuesday, December 21, 2010

ADF Select the first row in a rich table programmatically

Object rowKey = resultTable.getAttributes().get("scrollTopRowKey");
RowKeySet rks = resultTable.getSelectedRowKeys();

Tuesday, November 30, 2010

ADF Popup buttons rendred outside the dialog - IE

If you have custom buttons in your popup that are right aligned and they are toolbarbuttons they may render outside the dialog in Internet Explorer.

Just remove the af:toolbar tag and make the buttons af:commandButton instead of af:commandToolbarButton and they should behave.

Also remeber that commandToolbarButton partial submit is set to true by default.

JBO-25013: TooManyObjectsException

oracle.jbo.TooManyObjectsException: JBO-25013: Too many objects match the primary key oracle.jbo.Key[Key null ].

Ok so for you it may be trying to insert a duplicate record this should explain your problem (also check trigger they could be the cause.)

NOTE: You can also try to create a new duplicate EO if you have a page with two VO's using the same EO. This could sort your problems.

For me I needed to add a launch listener on my LOV and clear the cache of my vo.

<af:inputListOfValues id="NameId"


public void launchLOVPopup(LaunchPopupEvent launchPopupEvent){
clearVOCache("YourAMDataControl", "ViewNameVO");

public void clearVOCache(String amName, String voName){
ApplicationModule appModule = getApplicationModule(amName);
ViewObject vo = appModule.findViewObject(voName);

Thursday, November 18, 2010

***** adf secret password

Ok so my secret password text inputs always changed to ****** after submit (not the number of characters I typed in) on error on the client. Though this was a bit weird so I checked it out and found that this is ADF default behaviour.

The only way to change this is to create your own renderer so I left it as it was. Also changing this in any way will make your app less secure.

Monday, November 15, 2010

ADF programmatic disabled

I am creating dynamic links and here is something useful I used for programmatic creatin of the links.

    "#{bindings.MyVOIterator.estimatedRowCount == 0}",

public static ValueExpression getValueExpression(
  String expression, Class clazz){
  FacesContext ctx = FacesContext.getCurrentInstance();
  ELContext elCtx = ctx.getELContext();
  Application app = ctx.getApplication();
  return app.getExpressionFactory().createValueExpression(
    elCtx, expression, clazz);

Friday, November 5, 2010

Util code

public static MethodExpression getMethodExpression(
  String expr, Class returnType, Class[] argTypes){
  FacesContext fc = FacesContext.getCurrentInstance();
  ELContext elctx = fc.getELContext();
  ExpressionFactory elFactory = fc.getApplication().getExpressionFactory();
  return elFactory.createMethodExpression(
  elctx, expr, returnType, argTypes);
public static javax.faces.el.MethodBinding getMethodBinding(
  String expr, Class[] argTypes){
  FacesContext fc = FacesContext.getCurrentInstance();
  ELContext elctx = fc.getELContext();
  return fc.getApplication().createMethodBinding(expr, argTypes);

  SetPropertyListener listener = new SetPropertyListener(
   JSFUtils.getValueExpression("#{pageFlowScope.route}", String.class));
    .put("route", link.getRoute());

Thursday, November 4, 2010

ADF weblogic remote deployment problem -

Use the t3 protocol (ProtocolException Tunneling problem) not http for remote deployments and dont forget the -upload flag (Unable to access application source information in)!

<java classname="weblogic.Deployer"
fork="true" failonerror="true"
<arg value="-library"/>
<arg value="-upload"/>
<arg value="-adminurl"/><arg value="t3://$wlHost:7001"/>
  <arg value="-username"/><arg value="weblogic"/>
  <arg value="-password"/><arg value="weblogic1"/>
  <arg value="-source"/><arg value="/deploy/application.ear"/>
  <arg value="-targets"/><arg value="DefaultServer"/>
<arg value="-deploy"/>

Monday, November 1, 2010

ADF Date convert secondary pattern

This will try the second pattern if there is an error with the first. This should
sort out most situations you need else you will need to write a custom tag.

<af:convertDateTime pattern="yyyyMMdd" secondaryPattern="yyyy-MM-dd" />

NOTE: interesting javascript override
Java [custom converter]

public class YourDateConverter
extends DateTimeConverter implements ClientConverter {

public Object getAsObject(
FacesContext facesContext,
UIComponent uiComponent, String string){//do convert here}

public String getAsString(
FacesContext facesContext, UIComponent uiComponent, Object object)
{//do convert here}

public java.lang.String getClientConversion(
javax.faces.context.FacesContext fc,
javax.faces.component.UIComponent c){
String conv = super.getClientConversion(fc, c);
return "new YourDateTimeConverter('dd/MM/yyyy',null,'01/11/2010','DATE')";

function YourDateTimeConverter(
  pattern, locale, exampleString, type, messages) {
    this._exampleString = exampleString;
    this._pattern = pattern;
    this.trconverter =
     new TrDateTimeConverter(
       pattern, locale, exampleString, type, messages);

YourDateTimeConverter.prototype = new TrConverter();

YourDateTimeConverter.prototype.getAsString = function (formatTime) {
  //do your convert here date to string

YourDateTimeConverter.prototype.getAsObject = function (parseString, label) {
  //do your convert here string 2 date

Wednesday, October 27, 2010

ADF Exact custom filters

Step 1)
Add your custom filter to the column filter facet.
  <f:facet name="filter">
    <af:selectBooleanCheckbox value="#{backingBean.customfilter}"         id="id99"/>

Step 2) Create the getters and setters in your backing bean
    public Boolean getCustomfilter(){
        Boolean returnobj = null;
        Object filterValue = super.getFilterValue("AttributeName");
        if (filterValue != null){
            returnobj = ("Y".equalsIgnoreCase(filterValue.toString())) ? Boolean.TRUE : Boolean.FALSE;
        return returnobj;
    public void setCustomfilter(Boolean deletefilter){
        String value = filter == null ? null : (deletefilter) ? "Y" : "N";
        super.setFilterValue(value, "AttributeName");

NOTE: Dates

Filtered Dates with timestamps in ADF dont work very nicely if you just want to filter by date. So your can modify the date filters as above and here is some code to help with the process. (Note you will need to override the queryListener)
just call this from your listener.

ArrayList fieldNames = new ArrayList();
queryEvent, vo, "#{bindings.CustomVOQuery.processQuery}", fieldNames);

public void queryWithDateFilter(
  QueryEvent queryEvent, ViewObject vo, 
  String mappedQueryEL, List fieldNames){

  FilterableQueryDescriptor fqd = 
  Map map = fqd.getFilterCriteria();

  if (fieldNames != null){
    Map selectedValues = getSelectedValues(fieldNames, map);
    StringBuilder whereClauseSql = new StringBuilder();
    for (String fieldKey : fieldNames){
      String filterKey = "dateFilter_" + fieldKey;
      Object selectedValue = selectedValues.get(fieldKey);
      if (selectedValue != null){
        fqd.getFilterCriteria().put(fieldKey, null);
        AttributeDef def = getAttributeDefForKeyName(vo, fieldKey);
          "TRUNC(" + def.getColumnNameForQuery() + ", 'DDD') = :" + filterKey);
        vo.defineNamedWhereClauseParam(filterKey, convertDate(selectedValue), null);
          filterKey, convertDate(selectedValue));
      } else {
        if (hasParam(filterKey, vo.getNamedWhereClauseParams())){
   if (whereClauseSql.length() > 0){
    } else {
      mappedQueryEL, Object.class, QueryEvent.class, queryEvent);
    for (String fieldKey : fieldNames){
      Object selectedValue = selectedValues.get(fieldKey);
      fqd.getFilterCriteria().put(fieldKey, selectedValue);
  } else {
      mappedQueryEL, Object.class, QueryEvent.class, queryEvent);

protected Map getSelectedValues(
  List fieldNames, Map mapValues){
  Map returnMap = new HashMap();
  Set set = mapValues.keySet();
  for (String key : set){
    if (fieldNames.contains(key)){
      returnMap.put(key, mapValues.get(key));
  return returnMap;

private Object convertDate(Object selectedValue){
   if (selectedValue != null && selectedValue instanceof java.util.Date){
     java.util.Date dateValue = (java.util.Date)selectedValue;
     return new Date(new java.sql.Date(dateValue.getTime()));
   } else {
    return selectedValue;

protected AttributeDef getAttributeDefForKeyName(
  ViewObject vo, String fieldKey){
  AttributeDef def = null;
  AttributeDef[] defs = vo.getAttributeDefs();
  if (defs != null){
    for (AttributeDef currentDef : defs){
      if (currentDef.getName().equalsIgnoreCase(fieldKey)){
        return currentDef;
  return def;

ADF VO criteria performance problem

One of our screens backed by a huge table was slow. (+1 10 seconds just for the query alone). And here is what I found out:

Our query with a criteria to filter the tablename and key < 1 second
a.ele_name AS ELEMENT_NAME, a.pk AS PKEY, a.audit_result AS AUDIT_RESULT
FROM audit a, mds_users u
WHERE a.user = u.code
AND a.ele_name = :tablename
AND a.pk = :key

ADF converted query 12 seconds looks something like this:
a.ele_name AS ELEMENT_NAME, a.pk AS PKEY, a.audit_result AS AUDIT_RESULT
FROM audit a, users u
WHERE a.user = u.code) QRSLT WHERE ( ( ( (UPPER(PKEY) = UPPER(:key) ) AND (UPPER(ELEMENT_NAME) = UPPER(:tablename) )) ) ) ORDER BY AUDIT_DATE DESC

So I remove the UPPER from the query and all was good. Note to self always check this or you will suffer. (Ignore case check box in the criteria if you are looking for this)

Tuesday, October 19, 2010

Auto Submit button for page fragements

If your region is encased in a form you will have no access to the defaultCommand on your af:form.

Try adding a subform to your fragement (jsff) and use its defaultCommand - note this will affect your naming. This should also work for popup buttons.

ie. after your <jsp:root
<af:subform defaultCommand="submitButton" id="s3">
   ... your code

Monday, October 18, 2010

JDBC oracle Boolean problem.

? := SYS.SQLJUTL.BOOL2INT(boolReturnFunction(?,?))

And then map the result to an int.

Tuesday, October 12, 2010

ADF tree menu code

We have a tree menu that works of a hierarchical structure in the DB. Note you must have seperate iterators for the tree and the view. It will disclose and select an item in your tree based on a selection. This can be modified in various ways to get your trees jumping through hoops.

So here is the code so I dont loose it:
<af:tree value="#{bindings.TreeRootMenuVO2.treeModel}" var="node"
    rowSelection="single" id="t1"
    contentDelivery="immediate" fetchSize="500">
  <f:facet name="nodeStamp">
    <af:outputText value="#{node}" id="ot1"/>

  <af:commandToolbarButton text="Find Node" id="cb5"

  <af:commandToolbarButton text="JS Test" id="cb15">
    <af:clientListener method="selectNode" type="click"/>
Java code for the selection of an item.
public void selectionListener(SelectionEvent selectionEvent){
  //Invoke standard tree selection listener
    Object.class, new Class[]{ SelectionEvent.class }, 
    new Object[]{ selectionEvent });
  RichTree rt = this.getMenuTree();
  RowKeySet rks = rt.getSelectedRowKeys();
  BigDecimal menuId = null;

  for (Object facesTreeRowKey : rks){
    JUCtrlHierNodeBinding root = (JUCtrlHierNodeBinding)rt.getRowData();
    menuId = (BigDecimal)root.getRow().getAttribute("MenuId");

  DCIteratorBinding iter = 
  //this method just applies a view criteria containing just the pk to the 
  //iterator then calls  
  applyCriteriaAndQuery(iter, "MenuVOPKCriteria", createMenuParams(menuId));

Java code for the find in tree method.
public void findInTree(ActionEvent actionEvent) throws Exception{
  // find current row in the menu iterator
  BigDecimal menuId = retrieveCurrentRowId();
  if (menuId != null){
  JUCtrlHierBinding tree = (JUCtrlHierBinding)
  // Method that gets the hieracical tree for the selected item
  List keyPath = getBranchKeys(menuId);
  if (keyPath != null){
    JUCtrlHierNodeBinding node = tree.findNodeByKeyPath(keyPath);
    List selectedKeyList = node.getKeyPath();
    RowKeySet sRowKeys = menuTree.getSelectedRowKeys();
    List disclosedKeyList = new ArrayList();
    buildDisclosedRows(node, disclosedKeyList);
    RowKeySet dRowKeys = menuTree.getDisclosedRowKeys();
    if (disclosedKeyList != null && disclosedKeyList.size() > 0){
      for (Object disclosedItemList : disclosedKeyList){

    private void buildDisclosedRows(JUCtrlHierNodeBinding node, List keyList){
        JUCtrlHierNodeBinding parent = node.getParent();
        if (parent != null && parent.getKeyPath() != null){
            buildDisclosedRows(parent, keyList);

And just for interest sake some javascript code to work with the menu that does very little but should give you an idea.

<af:resource type="javascript">
  function selectNode(evt) {
    //Get instance of AdfRichTree.js
    var tree = AdfPage.PAGE.findComponent("t1");
    var srks = tree.getSelectedRowKeys();
    var firstRowKey;
    for (rowKey in srks){
      firstRowKey  = rowKey;
      alert("idx:::" + firstRowKey);

    if (tree.isPathExpanded(firstRowKey)){
      var keys = new Array[1];
      keys[0] = 7;
If you need any other code that I have left out just shout.

Monday, October 11, 2010

Traversing a hierarchical oracle tree in SQL backwards

So I have a menu table with a parent child relationship menu_id, menu_name, parent_id and I want to retrieve the whole branch that Menu Child E is in. ie all its ancestors. The result should be ordered from the root.

So given:
Root (id:0 parent_id: null)
  Menu Parent A(id:1 parent_id: 0)
    Menu Child B(id:2 parent_id: 1)
  Menu Parent C(id:3 parent_id: 0)
    Menu Child D(id:4 parent_id: 3)
    Menu Child E(id:5 parent_id: 3)

I want:
Root (id:0 parent_id: null)
  Menu Parent C(id:3 parent_id: 0)
    Menu Child E(id:5 parent_id: 3)

m.menu_id, m.menu_name, m.parent_id
start with
m.menu_id = 5
connect by
prior m.parent_id = m.menu_id

Random helpful code

adfFacesContext.isPartialRequest(fctx); //needed for a phase listener I had

Will add more here when I think of it...

Thursday, October 7, 2010

rangeChangeListener not firing in ADF table

Apparently this doent work in ADF so you cant really use the table outside of the adf framework.

Readonly View Objects and Disconnect Application Module Upon Release

Once setting Disconnect Application Module Upon Release a few of our screens with tables that depend on SQL query backed read only view objects stop functioning correctley. (Som flashed one refreshed the table to the top when the down arrow was used etc)

Creating keys for these view objects fixed the problems.

Wednesday, October 6, 2010

Before I forget - debugging in ADF

Right click on you ViewController project.
Select Project Properties
Click on Edit on your Configuration
Unser java options Add: -Djbo.debugoutput=console -Djbo.jdbc.trace=true

Monday, October 4, 2010

The DocumentChange is not configured to be allowed for the component:

<FilteredPersistenceChangeManager><_addDocumentChangeImpl> The DocumentChange is not configured to be allowed for the component: RichTable[org.apache.myfaces.trinidad.component.UIXTable$RowKeyFacesBeanWrapper@fdf42c, id=audTab]

This is what I understand this message to mean:
If MDS is configured a request is send to the FilteredPersistenceChangeManager wich then does a check to see if the component is configured.

If the change is not configured then the change will then be written to the users session and you will get the above message in your logs.

To configure the MDS stuff in your adf application :
1) Open adf-config.xml - located in Application Resources < ADF META-INF dir.
2) On the View tab click the green plus button and select the component that the error is complaining about.
3) Configure as needed.

Thursday, September 30, 2010

No no no - SQL paging in oracle - It cant be

SELECT t1.*, ROWNUM rnum
FROM your_table t1
WHERE t1.name = ? ORDER BY t1.name DESC)
WHERE rnum >=? AND rownum <= ?

You got to be kidding me is there not an easy way like limit in mysql

Wednesday, September 29, 2010

Auto Focus in ADF

still to fill in details but heres the idea

-- bind query to backing bean
-- get Id from bound query and inject some javascript with the id.

public void focus(UIXComponent comp) {
StringBuilder script = new StringBuilder();
FacesContext context = FacesContext.getCurrentInstance();
script.add("var elem = document.getElementById(").append(comp.getClientId(context)).append("); if (elem != null) {elem.focus();}");
Service.getRenderKitService(context, ExtendedRenderKitService.class).addScript(context, script.toString());

-- viola

ok after some pain here is the javascript function that works on ie and firefox

function focusField(elementId) {
var comp = document.getElementById(elementId);
if (comp != null) {

NOTE: On some screens the auto focus does not work because the component does not have an id or children(has not been initialized etc) for this just run the method bound to the value attribute on component after the one you want to focus or create a dummy. ie

in the java : {public String getAutoFocus() { focus(focusField); return "";}}

Remeber this method will be called more than once so it may have undesired results.

Tuesday, September 28, 2010

Get the package body for oracle stored procedure

select dbms_metadata.get_ddl('PACKAGE_BODY', 'PACKAGE', 'SCHEMA') from dual;

Thursday, September 23, 2010

ADF Excel export

In adf if you export your tables that contain lov inside the index or id is exported and not the selected item value.

If your table is read only change your existing table column from eg:
<af:outputText value="#{row.bindings.Field.items[row.bindings.Field.inputValue].label}"

Me and my ADF

--Just a random set of opinions read no further if you are looking for technical info.

Ok so I have been working with ADF for 8 months now (have worked with SOA suite before) and here are a couple of rants and findings:

Development speed etc:
  • The initial learning curve in VERY steep.
  • Get help - we had an adf expert help us out - invaluable.
  • Get the adf source code - it will help you.
  • Like any framework you need to write a bit of framework extension code
  • It is NOT just drag and drop dev if you want anything custom.
  • Try to get things right from the start or you will end up redoing a lot and it is not very "refactoring" friendly.
  • Forms devs will have to get a LOT of training to use this. (they will have to learn java and ADF unless you run a sweat shop dev process)
  • Hire a very very compentant java dev before switching over from forms.
  • Having a lot of logic in pl\sql with this framework may not be a bad thing.
  • Try to do as little custom stuff as possible
  • Once you have a good set of patterns and framework in place dev speeds up CONSIDERABLEY (+- 6 months for a fresh team with no ADF experience)
Comparision with other frameworks:
Getting your forms team to learn java would be less of a learning curve unless you structure you teams very well.

I would love to have a project that uses EJB3 with ADF's (fabulous JSF components) jsf stuff. Not overly fond of BC right now.

At the moment I find the ADF framework more difficult to use than other JEE frameworks because of the size of it and it does a lot of stuff "for free" so it is difficult to debug if it goes wrong. (Note I have worked with the following (Maven, Maven2, Ant, glassfish, DB2, postgres, mysql, EJB3, EJB2, Hibernate, trinidad, myfaces, struts, jsp, IBM RAD, eclipse etc) so I am not speaking out of my ass)

Wish list:
  • Maven2 Intergration
  • Proper SVN and CI intergration
  • JDev startup times improved
  • JDev is crap so use eclispe (wishful thinking)
  • OJDeploy compile times
  • JDev (shortcuts are anti intuitive, Ctrl - across open projects, speed of rendering of Design view etc etc)
Final thoughs: ADF given time will mature into an awesome framework that will speed up dev time and allow developers to focus on solving business problems. It is not a silver bullet and the answer to all you problems though and takes time to learn.

Almost foolproof ADF Oracle proxying

1) Create a common application model (this also sets up the oracle users in the context just for auditing)
    protected void prepareSession(Session session){


            String userName = ADFContext.getCurrent().getSecurityContext().getUserName();
            String host = ((HttpServletRequest)ADFContext.getCurrent().getEnvironment().getRequest()).getRemoteHost();
            String ip = ((HttpServletRequest)ADFContext.getCurrent().getEnvironment().getRequest()).getRemoteAddr();

            if (userName != null){
                setupSessionInfo(getDBTransaction(), host, ip, userName);
            //this is done because of a crappy weblogic caching error
        } catch (Exception e){
            session = null;
            System.out.println("------> Error in user proxy");
            throw new ApplicationModuleException(e);

2) Extend this AM in all you application modules that require proxy
public class MyAMImpl extends MyParentApplicationModuleImpl implements MyAM{

3) Grant user rights to connection pool user

alter user MyUser grant connect through CPUser;

4) Proxy user method

public static void proxyUser(DBTransaction transation) throws SQLException{

        Statement stat = transation.createPreparedStatement("rollback", 0);
        OracleConnection oConn = (OracleConnection)stat.getConnection();

        Properties props = new Properties();
        String uname = ADFContext.getCurrent().getSecurityContext().getUserPrincipal().getName();
        props.put(OracleConnection.PROXY_USER_NAME, uname);
        if (oConn.isProxySession()){
            oConn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME, props);
        } catch (SQLException e){
            if (!stat.isClosed()){
            throw e;

        if (!stat.isClosed()){


5) Clear cache method (could just switch weblogics cache off)
public static void clearPoolCache(DBTransaction transation) throws SQLException{

        Statement stat = transation.createPreparedStatement("rollback", 0);
        OracleConnection oConn = (OracleConnection)stat.getConnection();
        if (!stat.isClosed()){

6) setupSessionInfo method
protected void setupSessionInfo(DBTransaction transaction, String host, String ipAddress, String userName){

//this sql is just an example you can do more here
        String sql = " BEGIN dbms_session.set_identifier(:host); dbms_application_info.set_client_info(:ipAddress); END;";

        Map parameters = new HashMap();
        parameters.put("host", host);
        parameters.put("ipAddress", ipAddress);
        parameters.put("userName", userName);
        AdfJdbcUtil.executeNamedCall(false, transaction, sql, parameters);

Wednesday, September 22, 2010

ant and ojdeploy

<target name="buildJar">
<exec executable="${ojdeploy.path}" dir="${basedir}/${application.name}">
    <arg line="-workspace ${basedir}/${application.name}/${application.name}.jws"/>
    <arg line="-project ${application.name}"/>
    <arg line="-profile ${application.name}"/>
    <arg line="-nodatasources"/>
    <arg line="-forcerewrite"/>
    <arg line="-basedir ${basedir}/${application.name}"/>

UnsupportedCallbackException: Accessing the HttpServletRequest from a custom auth provider

There could be more than one cause of this problem but here is what cause it for me:

My custom provider was the first provider in the list and was set to sufficient.

I got an UnsupportedCallbackException when I tried to use the ContextHandlerCallback to retrieve the request in my provider.

This was due to the fact that weblogic log in was using my provider and it uses the SimpleCallbackHandler (boo hiss).

Here is my code: (I throw an login exception and fail the login if the callbacks are null for my login)

  private Callback[] getCallbacks() throws LoginException{
    Callback[] callbacks = new Callback[3]; // need one for the user name
    callbacks[CALLBACK_USERNAME_POSITION] = new NameCallback("username: ");
    callbacks[CALLBACK_PASSWORD_POSITION] = new PasswordCallback("password: ", false);
    callbacks[CALLBACK_CONTEXT_POSITION] = new ContextHandlerCallback();

    } catch (IOException e){
    } catch (UnsupportedCallbackException e){
      System.err.println("UnsupportedCallbackException:" + e.getMessage());
      return null;
  return callbacks;
Get the Request after obtaining the callback:
private HttpServletRequest getRequestCallback(Callback[] callbacks){
  ContextHandlerCallback cb = (ContextHandlerCallback)callbacks[CALLBACK_CONTEXT_POSITION];
  if (cb != null){
    return (HttpServletRequest)cb.getContextHandler().getValue("com.bea.contextelement.servlet.HttpServletRequest");
  return null;

Friday, September 17, 2010

Case Insensitive Filter

On the column just set the filterFeatures attribute to caseInsensitive


1) Map your querylistener and table binding to methods in your backing bean.

2) Implement the above mentioned methods and so what you need to the filter:

public void queryListener(QueryEvent queryEvent){
FilterableQueryDescriptor des = (FilterableQueryDescriptor)getModuleTable().getFilterModel();
Map _criteriaMap = des.getFilterCriteria();
Set featureSet = new HashSet();
Iterator criteriaIter = _criteriaMap.keySet().iterator();
Map filterFeatures = new HashMap();
while (criteriaIter != null && criteriaIter.hasNext()){
String keyCr = (String)criteriaIter.next();
((HashMap)filterFeatures).put(keyCr, featureSet);
JSFUtils.invokeMethodExpression("#{bindings.MdsModuleElementsVO2Query.processQuery}", Object.class, QueryEvent.class, queryEvent);

private RichTable moduleTable;

public void setModuleTable(RichTable moduleTable){
this.moduleTable = moduleTable;

public RichTable getModuleTable(){
return moduleTable;

LOV resizing error: IllegalStateException

When doing a search on a lov then resizing the columns your recieve an error message along the lines of IllegalStateException. Try configuring your columns and table in adf-config file (view menu).

Back button and connection leaks

If your back button behaves badly or connections are not closed when you close the browser and leaky.

On your application module try checking "Disconnet Application Module Upon Release" this solved our problem. (Click on your AM, goto configurations, click on the Pooling and scalibility tab)

Wednesday, July 28, 2010

java.lang.IllegalStateException: ADF_FACES-60003:Component with ID not registered for Active Data

This was hard to fix: if anyone wants the code just ask. Or if you have a better solution please post comment.

Once excel export has been clicked if we navigate around using ppr to refresh the region we get this error.

I was forced to create an export handler tag wich forces the export to happen in a new window.

Because this page is getting some hits here is some of the code (also use this method for pdf export):
Button with new listener: (xmlns:new="http://za.co.company/adf/faces/common/my" in your jsp:root)
<af:commandToolbarButton text="Export" id="ctb1" immediate="true" partialSubmit="true" icon="images/excel.jpg">
    <new:myExportCollectionActionListener exportedId="audTab" type="excelHTML" filename="audit.xls" title="Audit"/>

import oracle.adfinternal.view.faces.export.ExportCollectionActionListener;
import oracle.adfinternal.view.faces.taglib.listener.ExportCollectionActionListenerTag;

public class MyExportCollectionActionListenerTag extends ExportCollectionActionListenerTag{

protected ActionListener createActionListener(){
  ExportCollectionActionListener exportListener = 
    (ExportCollectionActionListener) super.createActionListener();
  MyExportCollectionActionListener listener = new 
  return listener;

  protected String getTagName(){
    return "myExportCollectionActionListener";
Actual work:

public class MyExportCollectionActionListener extends 

public void processAction(ActionEvent event){
  String exportedId = getExportedId();
  UIComponent exported = (exportedId == null) ? null : 
   exporter = new TableExcelExporter();
   File outputFile = getTempFile(filename);
   FileOutputStream os = new FileOutputStream(outputFile);
   OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outputFile));
   if (exporter instanceof PdfExporter){
   ((PdfExporter)exporter).exportPdf(context, os, collection, getTitle(), 
   } else {
     exporter.export(context, writer, collection, getTitle(), exportedRowsType);
   String generatedFileNameParam = URLEncoder.encode(outputFile.getAbsolutePath(), "UTF-8");
   HttpServletRequest request = (HttpServletRequest)externalContext.getRequest();
   ExtendedRenderKitService erks =    
   StringBuilder script = new StringBuilder();
   erks.addScript(FacesContext.getCurrentInstance(), script.toString());

In the meta-inf dir create your tld, taglib.xml and delaritivecomp-metadata.xml.

Create an export servlet to render the output from the temp file.

JBO-25014 - Another user changed row

Check your columns that are set by defaults and triggers are always update in your EO

Thursday, June 3, 2010

ADF css not copying to deployed artifact

Right click on the project you want to change.
Goto Project properties
Select Compiler from the menu

Under Copy file types to output driectory add the extension you want to copy

Wednesday, May 12, 2010

JBO Exception: could not validate all transctions

1) Enable logging: on your view project goto propeties (right click). Click Run/Debug/Profile. Edit default. add these Java Options: -Djbo.debugoutput=console -Ddatasource.verbose=true

2) Make sure that the data types match if you are programmatically creating rows etc. - ie dont use java.util.Date use java.sql.Date.

Tuesday, May 11, 2010

Building from the command line with ant

Just note this will crash jdeveloper daily.

Ant conditional logic

This ant code will allow the target (audit here) to only be called if the property must_aduit is set ie. (-Dmust_audit bob).

Tuesday, May 4, 2010

ArrayIndexOutOfBoundsException oracle ADF

Watch out for ordering if you edit the view object xml directly it can waste a lot of time.

Monday, May 3, 2010


Q) Where do I add a managed bean or a view?

Q) Where can I add a phase listener?

A) faces-config.xml

Q) My BC stuff is not showing up on the screen:

Check that you have configured your security setting correctley:

1) Application Resources\Descriptors\META-INF
2) Open jazn-data.xml
3) Click on ADF Policies tab
4) Make sure your flow and page have rights (to test just add all rights (green plus button) to valid_user)

Thursday, April 29, 2010

ojdeploy build failing on linux

The nodependacies flag was set on linux with ojdeploy so the dependant project was not built - this cause a class not found error.

JSF Phase Listener for ADF

Make sure you hook into the After Phase method on RESTORE_VIEW otherwise the adf context will not have been initialized.

public void afterPhase(PhaseEvent phaseEvent) {
   System.out.println("___________________________________ -after phase is logged in " + isLoggedIn());

private boolean isLoggedIn() {
    if (ADFContext.getCurrent() == null ||     ADFContext.getCurrent().getSecurityContext() == null ||
    ADFContext.getCurrent().getSecurityContext().getUserName() == null ||     ANONYMOUS_USERNAME.equalsIgnoreCase(ADFContext.getCurrent().getSecurityContext().getUserName()))
        return false;
    return true;

ORA-03115 typo

ORA-03115: Unsupported network datatype or representation - dont do the following:
(send the query in on creation and execution)
statement =
transaction.createPreparedStatement(query, DBTransaction.DEFAULT);
ResultSet resultset = statement.executeQuery(query);

What was I thinking...

Teamcity build error

I am having a problem with Teamcity not building my builds, if we kick of the build the history is not updated but it runs through. going to upgrade to 5.1 and keep the configuration. hey well.

getUserPrincipalName returns anonymous

I upgraded to the new jdeveloper release and my security stoped working (proxy stuff).

So I had to change getUserPrincipalName in my Application module to ADFContext.getCurrent().getSecurityContext().getUserPrincipal().getName().

Who knew...

Monday, April 26, 2010

Oracle ADF

My thinking so far after one day of use and no training is a project team for ADF can include you forms developers but you really need one or two excellent java developer to get through.

Sunday, April 25, 2010

Oracle proxy user error

ORA-01012: not logged on;

If you are using the oracle proxy user setup. Check that you user has rights to proxy though you connection pool user.


Thursday, April 22, 2010

Weblogic Custom Authentication Provider Error

If you are not getting your login exception set in javax.servlet.error.exception : try reordering your custom provider to the top of the provider list in the Weblogic Admin Console.

Just a quick note:

If you are having a hard time propogating the cause of your weblogic errors that are thrown from your custom provider try this before you throw them:

protected static void throwException(boolean propagateCauseForLoginException,
LoginException e,
Throwable cause) throws LoginException {
if (propagateCauseForLoginException) {
throw e;