Tips & Tricks – ODTUG (chapter 2)

Today I had the opportunity to attend loads of interesting sessions as well, the tips & tricks I’ve picked up regarding ADF, SCM, OWB, JDeveloper.

Some of these tips are very obvious, but worth reminding ;o)

Tips & Tricks when building applications (with JDeveloper):

  • Use 1 source control system, preferably Subversion ;o)
  • For Continuous integration you can use maven/ant which is tightly integrated, supported within Jdeveloper
  • Use Unit Testing througout your project phases, you can use our QA-tool for APEX-development and use JUnit, HTTPUnit, … for JEE based web development such as ADF Faces
  • Define a seperate lib-directory to handle the external libraries you’re using within Jdeveloper, so you’re able to version them efficiently and to manage your dependancies
  • Watch out when you’re refactoring BC4J or ADF applications, because configuration files, pageDefinition files aren’t refactored completely

Tips & Tricks on versioning in Jdeveloper 11g:

  • SCM can be any versioning system such as Subversion and CSV (supported by default), clearcase, serena, …
  • You have the possibility to create a repository within Jdeveloper 11g but this is for development purposes only and not well documented either, so no best practice
  • When you check in your project at a certain child-level, say for example the ViewController-project, Jdeveloper will automatically start from the root level (commit the whole working directory) and drill down to only commit those files that have been changed.
  • Version at application level
  • Define files you want to exclude from being versioned
  • The conflict-resolution is xml-aware which is a great future because most of the time you would be changing configuration files that are defined in XML

A term that will pop-up more and more ‘CLOUD Computing’ or ‘CLOUDS’ … another paradigm ;o)

This just means that clouds are up in the sky, floating around and the IT-world these clouds would hold different services made available to the outside world.

The services would be put inside the cloud to open up business, to start integrating … in other words now the sky has definitly become the limit!

Tips & Tricks from ODTUG

The tips & tricks I’ve learned so far at different ODTUG sessions I’ve attended:

When you’re thinking about moving to fusion middleware:

  • Use a small subset of tools, no big bang approach: ADF + BC + BPEL
  • ADF Faces is still evolving, so you need to consider the rewrite that’s needed when using Faces as your UI
  • Use templates to introduce a common look-and-feel by using af:region-tags which will centralize the layout so you don’t need to go through each page when layout changes
  • Use Enterprise Business Objects, EBO’s, as they are being used in AIA, one common business object that will be the facade-layer between your web layer and model layer
  • Use Grid Control to monitor your fusion-based applications
  • Set up datasources and pooling on the Application Server not on Application Tier
  • Prevent SQL-Injection by using bind variables
  • Use black- and white-lists for defining the security-rules and do’s and donts of your application
  • Don’t define nested roles when defining security in ADF Applications, use flat structures because not all JEE Servers support nested roles

More high-level, pragmatic:

  • Concentrate on business drivers, not on technology: on the ‘what’ not the ‘how’
  • Business Services are your hub, not the database anymore

A great paradigm Basheer Khan uses:

When your moving to a new home you will tap into existing services such as electricity, phone, internet, cable-tv, water, … => this is the same approach that you will be using when moving to SOA. You will tap into existing services.

APEX versus ADF

When talking about User Interfaces, Rapid Application Development (RAD), AJAX-like features such as Drag-and-Drop functionality a lot of frameworks pop up.

When you’re looking at Frameworks and tooling and vendor-specific solutions you could think of APEX, Application Development Framework (ADF), ADF Rich Client Components, Trinidad, …

To be able to compare these products, we’ve tried to build a matrix of features and how these features are managed in APEX and ADF.

We’re talking about 10.1.3 features, not yet about 11g because these aren’t production ready yet. 11g is very promissing about web 2.0 functionality and more service oriented approach, but for now let’s stick to what we have.

Feel free to comment, add features, add comparisons …

How to Integrate Bpel Processes with a User Interface

There are different ways to call/instantiate bpel processes from a front-end application.
Depending on the customers’ knowledge and expertise the choice between the different solutions can be made accordingly.

In this blog-post I will explain some of these options in short:

  • Call Bpel Process from Java-Code:

String input = “1450″;

// Here you need to define the request-operation of your bpel process

String xml =
“<asyncloanflowprocessrequest
xmlns=”http://xmlns.oracle.com/AsyncLoanFlow”&gt;
<input>”+input+”</input></asyncloanflowprocessrequest>”;

Locator Locator locator = new Locator(“default”,”bpel”);
IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME);

// construct the normalized message and send to Oracle BPEL Process Manager
NormalizedMessage nm = new NormalizedMessage();
nm.addPart(“payload”, xml );
deliveryService.post(“AsyncLoanFlow”, “initiate”, nm);

  • Call Bpel Process from your User Interface (JSP, JSPX, JSF, …):

This means you need to define the same code as defined in the above java-sample
in a jsp-script tag.

  • Use the Databinding layer of ADF Faces to integrate the Faces Application with your Bpel Process:
  1. Create BPEL WebService DataControl defined on the WSDL-endpoint of the BPEL Process


  2. Create new JSF JSP page
  3. Drag & Drop UI Components based on DataControl
  4. Run
  • Define a Web Service Proxy on your deployed Bpel process:

  1. Create WebService Proxy defined on the WSDL-endpoint of the BPEL Process

  2. Create new JSF JSP page
  3. Call the Web Service Proxy Service from your backing-bean code to initialize the deployed bpel process. Bind this method to the submit/invoke/initiate-button when you want to call the bpel process.
  4. Run

Other options can be explored as well, but these are the most common ones to think of.

Spice Up Your Oracle Knowledge – SOA EXSite – A Practical View On Oracle ESB

Oracle and Distrilogie are presenting different “Monthly Oracle Partner Training” programs and the first month (September) the focus lies on SOA.
This is a partner-dedicated event aimed at informing the Partner community about Oracle Acquisition strategy and “Best-in-Class” offerings that are critical to meet the customer needs.

My task was to give the partners a practical view on Oracle Enterprise Service Bus using a pre-sales case I’ve worked providing an answer to the customers’ specific technical requirements.

This presentation first gives an insight on the business requirements stated by the customer and then focuses on the business value of ESB for each of these requirements.

  • The first requirement was regarding the ability to work with one General Business Object (GBO) that described the customers’ data model. The answer in ESB is using an XML Schema Definition File (xsd) where we describe the required data in an hierarchical, nested manner. Given the customer the possibility to work with the same object throughout the whole business process.
  • The second requirement ‘How can we make a synchronous call from existing applications to an ESB Service?’ ‘How can we propagate changes to our different systems’? The first answer uses file- and ftp-adapter to bacth-read a CSV file. The file is polled for using the file adapter, format the file in a required format using the transform-functionality of ESB and put this file on the ftp-server of the client. For the second question regarding propagation I’ve given a demo where a JMS queue will listen for new messages. Once a message has been received a call will be made to a procedure on the database to unpack the message and create a new record. In this demo I’ve also mentioned the managed- and non-managed approach when implementing ESB Services which explains the virtualization-features of ESB.
  • The 3d requirement was regarding two-way synchronous services were I’ve integrated the ESB Services with an ADF Faces Web Application. Giving the customer an insight on the ease of integration between Oracle ADF and ESB Services using the data binding layer on Web Services.
  • In the last requirement the customer was curious about the integration-possibilities of web services and database procedures, jobs. The question that popped their mind: ‘Can we schedule a web service call using a database job?’. And this is no hastle at all, not for ESB and not for our Oracle Database. We can use the utl_http-package or utl_dbws-package to call our web service endpoint and the procedure holding the pl/sql functionality will be scheduled using dbms_job.

This demo and presentation gave me and the customers a real practical hands-on experience of Oracle’s Enterprise Service Bus and convinced us of the ease of integration when using such technology.

A pragmatic approach and an open vision using practical demo’s and hands-on sessions is the answer to every Enterprise Integration Challenge.

JDeveloper Tips & Tricks

In the different projects I’ve worked on the past few years, I’ve always worked in an Oracle-Java environment. This means I’ve always used an Oracle Database, mostly JDeveloper as my IDE environment and deploying to an OC4J instance or an Oracle IAS instance.

During these projects different issues arose regarding business requirements we needed to implement using JSF/ADF or deployment-issues when porting a 9i application to 10g environment, …

I’ve tried to keep my own cookbook regarding these different issues we’ve faced and how we resolved them.

In this post you will find different challenges we’ve addressed regarding working in an Oracle-Java environment. Please feel free to comment and add challenges/issues to the list !


You want to open up documents in a new screen, such as pdf-documents or word-documents
Use ‘targetFrame=_blank’ for a goLink to open the link in a new window

Refresh a table-component when a dropdown-component is changed, a filter.
To refresh a table given a pre-defined filter you can use the following components ‘selectOneChoice’ with a table-component and this table-component holds a partial-trigger which listens to the ‘selectOneChoice’-component. This means you will use the partial-page-rendering feature of jsf which only render the table-component on the page and no other components.

Buttons aren’t shown correctly on a linux environment when using a custom skin
ADF Faces generates images on the fly for the different widgets (buttons, tabs, …), in the different languages, if it’s a multi-lingual application. The buttons, f.ex. are not standard HTML buttons, but GIF images. They are created in a cache directory
(\public_html\WEB-INF\temp\adf\images\cache\\) and then reused for the next runs.

The generation of the image may fail, f.ex. because the physical font is not available on your OS.
In the case of a button, it will then be generated as a standard HTML button, instead of an empty image, with no text.

Change font to “Dialog” instead of using “Arial, Helvetica’ because “Dialog” is a special font, a virtual font, that doesn’t depend on any physical font installed on your machine.
If the application runs in a Linux environment, you need to use either a virtual font, f.ex. Lucida, or a font physically installed on your Linux system

Navigation between pages without validation-exceptions being thrown
You want to be able to navigate away from a creation-page but the validation-exceptions are always triggered => use ‘immediate=true’ attribute on the command-link or the menutab-component so validation isn’t fired
You’re getting ‘current rowkey has been modified’-exceptions, set the enableTokenValidation-attribute on the pageDefinition-file to false so rowkey-validation isn’t performed

Delete files from Jdeveloper or exclude files from the Jdeveloper project
If you want to delete files from your project make sure to use the ‘File-menu’ ‘Erase from disk’ instead of the delete icon in your application navigator. If you use this delete-icon this means an exclude-option is added to your project-properties so the files aren’t shown anymore, but they still exist.

Your application does not work as expected
Try stopping OC4J, clean up the workspace (go to run-menu and choose clean-up), rebuild the entire workspace and run again.

When running the page, the browser remains empty
Apply the same steps as for the previous problem: ‘Your application does not work as expected’
Delete the WEB-INF/temp folder from the view-project and test the application again

The JSPX Design Editor looks strange

If you see this in the JSPX Design Editor:

Then JDeveloper does not properly recognize the Faces tag libraries.
You can try to click the refresh button (indicated by the arrows in the screen shot above).

If that does not work:
1. Close all JSPX’s in JDeveloper.
2. Go to the ViewController Project, to the Project Properties, and then to the JSP Tag Libraries category.
3. Remove all JSP Tag Libraries. When asked to remove other Tag libraries, click OK, but when asked to remove Java libraries click Cancel.
4. Close JDeveloper and open it again.
5. Add the tag libraries
o JSF Core
o JSF HTML
o ADF Faces Components
o ADF Faces HTML
6. Rebuild the ViewController project
7. Open the JSPX again.

Exporting table-date (master or master-detail) to Excel in an ADF-Faces application
Using your ‘FacesCtrlRangeBinding’ the table-component in your pageDefinition-file, you can export the data to an Excel-file. If you have a table that needs to be exported to Excel and when there are columns that you don’t want as a part of the export, create a new table binding in the pagedef with the right columns and use the name of the new table binding as a parameter of the ExportToExcel method in the backing bean of your page.

This could be the case when a calendar object is displayed in the table, typically you will want to use a dateAsString field in the exportToExcel.

You will find the code to support this functionality below; if you have any questions please comment.


You’re getting the following error when trying to connect to an Oracle Database via JDBC:
Error initializing connection: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: invalid or unknown NLS parameter value specified

When you take a look at this URL: http://www.oracle.com/technology/products/jdev/htdocs/10.1.3.0.3/readme.html#ide5
The next topic is very important regarding this issue:
ORA-604/ORA-12705 Error on Some Unsupported Locales in JDBC (4704421)
Make sure you’re not defining a Locale that isn’t supported by JDK 1.5, have a look at the ‘supported locales’ in the JDK 1.5 specs: http://java.sun.com/j2se/1.5.0/docs/guide/intl/locale.doc.html.

Classpath-issues when deploying an application to OC4J or IAS
When you have a look at the OC4J DeveloperGuide (http://download.oracle.com/docs/cd/B31017_01/web.1013/b28952.pdf), more specifically at chapter Executing Queries at Runtime Through the ClassLoading MBean (page 53). You will find EM has all the needed functionality to have an in depth view of the class loading of your specific project.

An example mentioned in the developer guide:

Executing Queries at Runtime Through the ClassLoading MBean
Queries can be
executed on a running OC4J instance by calling the executeQuery operation on the
ClassLoading MBean.
This MBean is accessible through the Web-based
Application Server Control Console interface. See the Oracle Containers for J2EE
Configuration and Administration Guide for details on accessing and using the
MBeans packaged with OC4J.
1. Click the Administration link in the
Application Server Control Console.
2. Click System MBean Browser.
3.
Expand the ClassLoading node in the navigation pane, then select the singleton
MBean instance.
4. Click the Operations tab in the right-hand pane, then
click the executeQuery operation.
5. Enter the name of the query you want to
execute as the value for queryClassName. For example, LoaderTree.
6. Click
the queryArguments icon, then add a new row for each argument you want to
specify. Do NOT enclose arguments in parentheses; these are added automatically
when the operation is invoked. Click OK when finished specifying
arguments.
7. Click the Invoke button to call the operation.

In the chapter ‘Troubleshooting Class-Loading-Related Problems in OC4J’ an explanation is given about the different exceptions that may occur and how to solve them.

Compiler-errors when checked “Use Javac” Compiler option in the Project Properties dialog
This problem has been reported asBUG 6311285 – OJC ALLOWS CASTING OF GENERIC OF IMPL CLASS TO GENERIC OF INTERFACE CLASSA fix is already included with JDeveloper 11.1 Developer PreviewAs a workaround you can use javac instead of ojc for compilation. javac will report such wrong assignments. You need to compile with ojc only if you want to use JDeveloper profiling or code coach.
For more information have a look at the following forum-thread: http://forums.oracle.com/forums/thread.jspa?threadID=537140

Memory Leaks in Jdeveloper:

1)Check the Virtual Memory used by Jdev: edit jdev.conf and increase the JVM memory ( tag AddVMOption).

2)Don’t load technologies you don’t need ( Jdev Preferences – Extension Manager- Extension to Use ).

3)Uncheck the “bells” in Jdev Preferences:Environment: splash scren, silenty reload, decrease undo level;Diagrams: automatically straighten lines

4)Split the project up into different modules: User Management – Reporting – Administering Site – …

No tip but just fun: SOA Facts.

Buzzing about Adobe Flex

I’ve heard a lot of rumours and buzzing around Adobe Flex … so what’s the catch ;o)

For one of my projects I need to get acquanted with Adobe Flex to see what it has to offer and how fast you can learn and implement a real-time application (small test case). I’ve already created a small test case in ADF and now I need to have a look at Adobe Flex .

With my Oracle Fusion Middleware background, ADF for example, I can make a comparison with Flex, how intuitive is the IDE (it’s based on Eclipse), what about J2EE-requirements such as bindings between the different tiers, …

One major drawback of Flex is that it’s again another proprietary code you have to learn, using basic xml tagging but yet another format, another language. If I have a look at ADF it’s much more standardized and if you have a J2EE background it’s comprehensive and you just use the existing knowledge and experience to build on.

But that’s enough talking wright … let’s create a Flex playground =>

First I’ve installed a trial version of flex builder 3 and then I went to search the internet for some sort of a ‘Adobe Flex for dummies’-guide ;o)

I’m using the quickstart guide, which you can find on http://www.adobe.com/devnet/flex/quickstart/coding_with_mxml_and_actionscript/ to get started with Adobe Flex.

The first impressions are … sexy and vivid applications with the same look & feel as flashplayer applications. Let’s try and create one myself:

  1. The first section in the Quickstart-guide : Coding with MXML and ActionScript works very well, and if you want to use the TIP

Tip: To see the intermediary ActionScript files that Flex generates, add the
–keep-generated-actionscript option to your mxmlc command.

Just use this command in the developer-prompt of adobe flex:

C:\adobe_flex\QuickStart>mxmlc –strict=true –keep-generated-actionscript MyFirstExample.mxml

After you’ve done the first chapter you were able to define and compile a flex application using the Adobe Flex 3 SDK Command Prompt.

In the second chapter : Creating your first application , you perform almost the same exercise but now you’ll use the Flex Development Environment which uses the Eclipse IDE. So J2EE Developers which are used to Eclipse should recognize this immediatly, it’s the same IDE you’re working with, only the needed plug-ins for Flex are added/used.

Steps you need to perform to build a ‘hello world’ (sounds familiair) application:

  1. Create a new Flex Project (accept all the defaults)
  2. Copy/paste the code from chapter 2 and choose to run the application
  3. Start playing around yourself

Let’s compare the IDE I’m used to, which is JDeveloper, with Adobe Flex Builder 3 using the sample application from the 2nd chapter.

  1. :( => I can’t re-organise my components in the outline-view which can be compared to the structure-view in JDeveloper. I have to use the design-or source-view in Flex to re-organize the components, let’s say for instance I want to move my components (textarea, panel and label) from the tile into a VDividedBox, I need to do this in the source-or design-view and can’t rearrange using the outline-view.
  2. :( => I don’t have a look-up of the existing functions that are defined in the mx:
    Script tag. To avoid erroneous referring of functions in the CDATA-part you could have a drop-down or look-up of the existing functions in the properties that can use these, e.g. the onclick-event could have such a drop-down. This is usefull code insight when working with the ‘Flex Properties’-panel in the IDE.
  3. :) => The code-insight on each component (each component you’ve defined an ID for, such as myText or myLabel) is very helpfull to have a look at the available methods on these objects.
  4. :) => different ways of specifying eventHandlers which gives each developer the choice between different approaches and if you’re referring to a non-existant label/field/method a compile time error will be shown.
  5. :) => when you’ve messed up the mxml file, meaning the tags aren’t constructed properly anymore for a mx:application, the design-tab won’t work anymore. This is a very handy feature because it will point you to the code that produces the exception. You have the possibility to check what’s wrong with your source code without having to search inside your mx:application for tags that aren’t closed properly etc. In the following screen-shot you can see the behaviour:

That’s it for playground time today, I have to get back to business with JDeveloper but untill now I’m still curious.

Create a demo using EJB 3.0, Toplink and ADF as the UI layer and Bpel and ESB as the back-end layer (through web service invocation) – Episode 1

The case I worked out for my demo application is the following: Create a new person via the UI (using JSF and EJB3.0 as data-layer) and initiate a bpel process for the creation of the person. The bpel process will check if all business requirements were met for the person that needs to be created using Business Rules.
A human task was added to make sure the Personal Manager has approved the new person and finally an ESB was added to actually create the person.
The ESB will transform the person-object, an xml-file, to the specific format I need to be able to insert the person in my db.

During the creation of my demo-project I faced some design problems which I will explain in the following chapters:

The first part of the case was simple, create a UI using EJB 3.0 and ADF Faces using JDeveloper as my IDE.
The UI consists of a ListPersons.jspx – page that lists all existing persons of my persons-db and a link to the CreatePerson.jspx-page. In the CreatePerson.jspx page I will create a new Person and initiate the bpel process from here.

But it wasn’t as simple as I thought … to be able to initiate my bpel process using the EJB-objects I needed to prefetch the sequence-value needed for uniquely identifying the person-object, e.g. the Person.personid. This is needed because the bpel process needs all xml-tags to be filled in. If for example the personid, or firstname isn’t filled in you will get the following exception ‘unexpected null value for literal data’.

To be able to prefetch the id in my EJB i thought I could ‘eagerly fetch’ this id using an annotation in EJB 3.0, but there’s no such annotation available :(

What to do next … fetch the sequence value myself and populate the Person.personID with my sequence-value.

I’ve added a new method in my SessionBean that gets the sequence value from my db-sequence, this method is invoked from my custom-method ‘createPersonObject() which constitutes a valid person-object.

The custom-method to fetch the sequence-value uses the ‘createNativeQuery’-method on the EntityManager:

em.createNativeQuery(“select person_seq.nextval from dual”);

The UI now works correctly, using the createPersonObject()-method as binding-layer to go to the CreatePerson.jspx file.

Now I need to link my existing Bpel Process to this UI … coming up soon …