onsdag, november 01, 2006

JDeveloper 10.1.3.1 Released

No updates in a long time... It's been busy times... Anyway, this is probably well known by now, but I add it for reference:

The new JDeveloper 10.1.3.1.0 (Build 3984) is available from OTN:
http://www.oracle.com/technology/software/products/jdev/htdocs/soft10131.html

torsdag, september 14, 2006

Hierarchical Questions Using TopLink

A colleague asked about how one can implement hierarchical questions using TopLink. There is a section in the manual describing this nicely.

The URL to the section is:
http://www.oracle.com/technology/products/ias/toplink/doc/1013/MAIN/_html/qryadv008.htm#i1134801

The following code snippet is an excerpt from it:

ReadAllQuery raq = new ReadAllQuery(Employee.class);
Expression startExpr = expressionBuilder.get("id").equal(new Integer(1));
Expression connectBy = expressionBuilder.get("managedEmployees");
Vector order = new Vector();
order.addElement(expressionBuilder.get("lastName"));
order.addElement(expressionBuilder.get("firstName"));
raq.setHierarchicalQueryClause(startExpr, connectBy, order);
Vector employees = uow.executeQuery(raq);


this will generate the following SQL:

SELECT * FROM EMPLOYEE START WITH ID=1 CONNECT BY PRIOR ID=MANAGER_ID ORDER SIBLINGS BY LAST_NAME, FIRST_NAME

onsdag, september 13, 2006

JDeveloper 10.1.3 ServiceUpdate 5 Available

A new Service Update for JDeveloper 10.1.3 is available via "Check for Updates".

Please note that this is not applicable for the JDeveloper 10.1.3.1 Developer Preview.

This is the fifth Service Update (SU5) for JDeveloper 10.1.3.0.4. It fixes some commonly-encountered critical issues. We recommend that all customers apply this Service Update. This Service Update requires that Service Update 1 has been installed. Please ensure that JDeveloper Service Update 1 is already installed before installing Service Update 5.

torsdag, augusti 24, 2006

Keep the 'home' Instance Clean

We sometimes sees people deploying applications to the default 'home' OC4J instance within the Oracle Application Server. Even though this will work, it is a better practice not deploying any Applications to this Instance, and leave this one alone. We have some internal use of this instance, and it is not ment for regular Application deployments. Therefore; please create a new OC4J instance and use this for your own Application deplyoments.

onsdag, augusti 23, 2006

RuleAuthor Fails to Start with Strange Error Message

An interesting problem that has appeared recentley is that I've seen the RuleAuthor fail with an exception:

java.io.FileNotFoundException: Could not find RuleHome.uix.uix

on a few occasions recently. It is possible to get to the login screen, but once you have logged in, this error appears.

It turned out; that this was caused by that the Oracle HTTP Server (OHS) was started by using apachectl instead of via OPMN. This led to inconsistency between the OHS to OC4J mapping in the mod_oc4j mappings. Could be worth keeping in mind...

onsdag, augusti 16, 2006

Developer's Preview of Oracle Application Server 10g Release 3 (10.1.3.1.0) for the Oracle SOA Suite Out Now

A Developer's Preview of Oracle Application Server 10g Release 3 (10.1.3.1.0) Developer Preview for the Oracle SOA Suite is now out on OTN.

It is available for download at: http://www.oracle.com/technology/software/products/ias/soapreview.html

Developer's Preview of Oracle JDeveloper 10g 10.1.3.1 Out Now

A Developer's Preview of Oracle JDeveloper 10g (10.1.3.1.0) is now out on OTN.

It is available for download at: http://www.oracle.com/technology/software/products/jdev/htdocs/soft10131studio.html

How do to Make JDeveloper Keep the Wrapper Code for EJB's for Debugging Purpose

Sometimes it is useful to have the wrapper code for EJB's for debugging. This code is not generated by default, but you can have JDeveloper generate it for you.

The wrappers are not generated during compilation, but during deployment. The easiest way to get hold of them is to run the EJB in the embedded OC4J server, this will cause a deployment to take place, and the wrappers will be generated.

You also need to set a switch for them to be generated. To do this you go to Project Properties -> Runner, and add the following switches:
-DKeepWrapperCode=true -DWrapperCodeDir=d:\tmp

and the wrapper code will be generated into whatever directory you specified with the -DWrapperCodeDir switch.

onsdag, juli 05, 2006

Incremental Deployment using JDeveloper & OC4J

In the JDeveloper online help and in the OC4J Deployment Guide 10.1.3, the option to use virtual directories is mentioned. This feature can be used to implement incremental deployment using JDeveloper & OC4J.

Here is how it works:
The element 'virtual-directory' adds a virtual directory mapping for static content. This is conceptually similar to symbolic links on a UNIX system. The virtual directory enables you to make files in the "real" document root directory available to the application, even though the files do not physically reside in the Web application WAR file.


Here is an example:

1. Start JDeveloper & a standalone OC4J Server (10.1.3 versions).
2. Create a new Workspace in JDeveloper, with 2 empty projects.
3. In Project 1, create a new HTML page.
4. Create a new WAR deployment profile for Project 1, set the J2EE Context to 'foo'.
5. Deploy the application to the standalone OC4J server.
6. Ensure that you can access the HTML file from a browser.
7. In Project 2, create a new JSP file.
8. Add the deployment descriptor orion-web.xml to Project 2. Add this line to that file:

<virtual-directory virtual-path="/foo" real-path="D:\oracle\oc4j1013\j2ee\home\applications\webapp1\webapp1" />

You need, of course, to alter the real-path to where your first application has been deployed. You could also have placed the files directly somewhere on the server, and referenced this directory here instead of creating a Project and deploying them.

9. Create a new WAR deployment profile in Project 2, set the J2EE Context to 'fuu'.
10. Deploy the application to the standalone OC4J server.
11. Ensure that you can access the JSP file from a browser.
12. Now you will be able to access the HTML file by using:

http://localhost:8888/fuu/foo/untitled1.html

13. Alter the JSP in Project 2 and re-deploy Project 2. Notice that you can still access the HTML file from the above URL without having to re-deploy also these files.

onsdag, juni 28, 2006

JDeveloper 10.1.3 SU4 Available

The Service Update 4 (SU4) for JDeveloper 10.1.3 is available. Use 'Help' -> 'Check for Updates' from within JDeveloper to download and install it.

onsdag, maj 31, 2006

Configuring a 2:nd OC4J Instance for ADF use within an Oracle Application Server

When you setup a second OC4J instance within an Oracle Application Server 10.1.3 it won't have the ADF Libraries configured, this means that if you deploy an ADF application to this instance, it won't work. Further, there is no option neither within JDeveloper nor with the ADF Installer to configure this second instance for use with ADF, so what to do in this situation? Answer: You'll just have to do some manual configuration.

Assuming that you have created the 2:nd OC4J instance by using the createInstance command, you then need to update the files server.xml and application.xml for this instance with some additional configuration before starting it.

Both of these files are located in the directory:

<ORCALE_AS_HOME>/j2ee/<INSTANCE_NAME>/config

Open them with your favourite editor.

Add the following entries:

server.xml
==========

<shared-library name="oracle.expression-evaluator" version="10.1.3" library-compatible="true">
<code-source path="../../../jlib/commons-el.jar"/>
<code-source path="../../../jlib/oracle-el.jar"/>
<code-source path="../../../jlib/jsp-el-api.jar"/>
</shared-library>

<shared-library name="adf.oracle.domain" version="10.1.3" library-compatible="true">
<code-source path="../../../BC4J/lib"/>
<code-source path="../../../jlib/commons-cli-1.0.jar"/>
<code-source path="../../../mds/lib/concurrent.jar"/>
<code-source path="../../../mds/lib/mdsrt.jar"/>
<code-source path="../../../jlib/xmlef.jar"/>
<code-source path="../../../jlib/commons-el.jar"/>
<code-source path="../../../jlib/oracle-el.jar"/>
<code-source path="../../../jlib/jsp-el-api.jar"/>
<code-source path="../../../BC4J/jlib/adfmtl.jar"/>
<code-source path="../../../BC4J/jlib/adfui.jar"/>
<code-source path="../../../BC4J/jlib/jdev-cm.jar"/>
<code-source path="../../../BC4J/jlib/adf-connections.jar"/>
<code-source path="../../../BC4J/jlib/dc-adapters.jar"/>
<code-source path="../../../ord/jlib/ordim.jar"/>
<code-source path="../../../ord/jlib/ordhttp.jar"/>
<code-source path="../../../jlib/ojmisc.jar"/>
<code-source path="../../../lib/xsqlserializers.jar"/>
<import-shared-library name="oracle.xml"/>
<import-shared-library name="oracle.jdbc"/>
<import-shared-library name="oracle.cache"/>
<import-shared-library name="oracle.dms"/>
<import-shared-library name="oracle.toplink"/>
<import-shared-library name="oracle.sqlj"/>
<import-shared-library name="oracle.ws.core"/>
<import-shared-library name="oracle.ws.client"/>
<import-shared-library name="oracle.xml.security"/>
<import-shared-library name="oracle.ws.security"/>
<import-shared-library name="oracle.ws.reliability"/>
<import-shared-library name="oracle.jwsdl"/>
<import-shared-library name="oracle.http.client"/>
</shared-library>

<shared-library name="adf.generic.domain" version="10.1.3" library-compatible="true">
<code-source path="../../../BC4J/jlib/bc4jdomgnrc.jar"/>
<code-source path="../../../BC4J/lib"/>
<code-source path="../../../jlib/commons-cli-1.0.jar"/>
<code-source path="../../../mds/lib/concurrent.jar"/>
<code-source path="../../../mds/lib/mdsrt.jar"/>
<code-source path="../../../jlib/xmlef.jar"/>
<code-source path="../../../jlib/commons-el.jar"/>
<code-source path="../../../jlib/oracle-el.jar"/>
<code-source path="../../../jlib/jsp-el-api.jar"/>
<code-source path="../../../BC4J/jlib/adfmtl.jar"/>
<code-source path="../../../BC4J/jlib/adfui.jar"/>
<code-source path="../../../BC4J/jlib/jdev-cm.jar"/>
<code-source path="../../../BC4J/jlib/adf-connections.jar"/>
<code-source path="../../../BC4J/jlib/dc-adapters.jar"/>
<code-source path="../../../ord/jlib/ordim.jar"/>
<code-source path="../../../ord/jlib/ordhttp.jar"/>
<code-source path="../../../jlib/ojmisc.jar"/>
<code-source path="../../../lib/xsqlserializers.jar"/>
<import-shared-library name="oracle.xml"/>
<import-shared-library name="oracle.jdbc"/>
<import-shared-library name="oracle.cache"/>
<import-shared-library name="oracle.dms"/>
<import-shared-library name="oracle.toplink"/>
<import-shared-library name="oracle.sqlj"/>
<import-shared-library name="oracle.ws.core"/>
<import-shared-library name="oracle.ws.client"/>
<import-shared-library name="oracle.xml.security"/>
<import-shared-library name="oracle.ws.security"/>
<import-shared-library name="oracle.ws.reliability"/>
<import-shared-library name="oracle.jwsdl"/>
<import-shared-library name="oracle.http.client"/>
</shared-library>

<application name="bc4j" path="../../../BC4J/redist/bc4j.ear" start="true" />

application.xml
===============

<imported-shared-libraries>
<import-shared-library name="adf.oracle.domain"/>
</imported-shared-libraries>

Please also verify that the file jdev-cm.jar exists in the location pointed by the line:

<code-source path="../../../BC4J/jlib/jdev-cm.jar"/>

If this file does not exists there, just copy it from your JDeveloper installation to this location.

When you now start the 2:nd instance you will be able to deploy ADF applications also to this instance.

JDeveloper Release 9.0.4.3 Out

The 9.0.4.3 maintenance release is now out. For information of bugs fixed in this release, please refer to:

http://www.oracle.com/technology/products/jdev/htdocs/904/9043_fix_list.html

It can be downloaded from OTN at the URL:

http://www.oracle.com/technology/software/htdocs/jdevlic.html?http://otn.oracle.com/software/products/jdev/htdocs/soft9043.html


For reference, here is the current list of the latest releases of the JDeveloper versions:

9.0.4.3
9.0.5.2
10.1.2.1
10.1.3 SU3

torsdag, april 06, 2006

Recursion in RL Functions

Today I was thinking if it were possible to create recursive functions in the RL Language, so I made a small test by calculating factorials. I started by defining the function as:

function factorial(long x) returns long {
if( x == 1) {
return 1;
} else {
return x*(factorial( x-1 ));
}
}

Next, I just ran it by using:

println("The factorial of 12 is: " + factorial(12) + ".");

and this gave me the expected result of:

The factorial of 12 is: 479001600.

so, this seems to work fine.

Next thing will be to try recursion for facts, and of course for rules... More about that later.

måndag, april 03, 2006

Site Feeds

Added links to Atom and RSS feed links in the Links section. They are also available here:

Atom Site Feed
RSS Site Feed

fredag, mars 31, 2006

How to Remove the Topic / Folder info in Metalink

Note, this post only applies to those who use the Oracle Support system Metalink.

When browsing articles in Metalink, by default the Folder and Topic information is displayed in the list of articles. This can by quite annoying, but it's easy to switch off.

To do this, just click on the 'Hide Folder / Topic' button just above the articles. See the picture below:


Once switched off, the list looks much neater, in my opinion, as shown below:

torsdag, mars 30, 2006

RL Language Rules Extension for JDeveloper

I have created an extension for JDeveloper, which makes it a bit easier to work with the Oracle Business Rules Language, RL Language within JDeveloper. Read more about it on OTN at:
http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/rules/howto.html

måndag, mars 27, 2006

Callout from within Oracle Business Rules

Within Oracle Business Rules you sometimes need to make callouts to an external Object within the action part of your rule. This is very easy to achieve. Suppose that you have a class with an external method similar to:

package myPackage;
public class CallOut {
public CallOut() { }

public void test(String myVariable) {
System.out.println("Callout from Rules with argument: " + myVariable);
}
}

and you would like to call upon this method from within the action part of a rule. The first thing you need to do is also to import this class into your dictionary. Once done, you need to define a new RLFunction. This function needs to have 2 variables defined, one for the class itself, and one for the argument. The argument should have the argument type String, while the class needs to have the Type CallOut, or whatever your class is named. Within the function body you then define the actual function like:

TestCallOut.test(message);

Now you have a Rules function that you cal call upon from the action part of any rule within your ruleset(s), like:

Call callOut( Passenger.name, new CallOut () )

The RL code that is generated for such a task will look like:

function callOut(String message, myPackage.CallOut TestCallOut)
{
//RL literal statement
TestCallOut.test(message);
}// DM.callOut

for the function, this will be defined in the DM ruleset. The call will look like:

rule myRule
{
priority = 0;
if
(
(
fact myPackage.SomeFactObject v0_SomeFactObject && (
(v0_SomeFactObject.anAttribute <>
)
{
DM.callOut(v0_SomeFactObject.someArgument, new myPackage.CallOut());
}
} //end rule myRule;

I hope this will have shown you how-to make a callout from Oracle Business Rules to a method within an Object.

onsdag, mars 15, 2006

JDeveloper Subversion Extension EA1 Available on OTN

Oracle is providing a Subversion Extension for JDeveloper 10.1.3. It is officially available from OTN at this URL:

http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/subversion/subversion.html

To install it, just follow the provided installation instructions.

tisdag, februari 14, 2006

Installing Rule Author on a standalone OC4J 10.1.3

It is possible to install the Rule Author on a standalone OC4J 10.1.3. Below is one way of achieving this.

1. Copy the ruleauthor.ear from a AS installation on Linux, located in /rules/webapps to the windows machine, for example to d:\tmp\ruleauthor.ear

2. Startup a standalone OC4J 10.1.3 on the windows machine.

3. Deploy the Rule Author to it using:

java -jar admin.jar ormi://localhost:23791 oc4jadmin
-deploy -file D:/tmp/ruleauthor.ear -deploymentName ruleauthor

and

java -jar admin.jar ormi://localhost:23791 oc4jadmin
-bindWebApp ruleauthor ruleauthor default-web-site ruleauthor

4. Add the default user, goto http://localhost:8888/em/ and follow the steps given in the Oracle Business Rules User's Guide, section 2.1:

http://download-uk.oracle.com/docs/cd/B25221_01/web.1013/b15986/guistart.htm#sthref76

don't forget to restart the ruleautor application after defining the user.

5. Now you can use the Rule Author at the URL http://localhost:8888/ruleauthor/RuleHome.uix by using the user created in previous step.

måndag, februari 06, 2006

Combining TopLink with Oracle Business Rules

This sample will show you how you retrieve some objects by using TopLink and then use Oracle Business Rules to do some selection upon these objects. I am not using neither a file based nor a WebDAV based rule repository for this sample, instead I create the ruleset on the fly.

Suppose you have a table, PERSON, that has the following structure:

PERSON
------
PID NUMBER
NAME VARCHAR2(32)
SEX CHAR(1)
EYECOLOR VARCHAR2(8)
INCOME NUMBER

and this is mapped to a Person object which has corresponding fields and accessors. I will also assume that you have setup a TopLink mapping between the table and the object.


Now, we first need to retrieve the objects from the DB, assuming we are working with a 2-tier here, we do this as follows:

SessionManager sessionManager = SessionManager.getManager();
Session session = sessionManager.getSession("default");
Vector v = session.readAllObjects(Person.class);


This will read all persons in the database and put them into a Vector. Now, we have a vector, v, that holds our persons. The next step is to initiate the RuleSession, as mentioned before, this is done on the fly with one simple rule:

RuleSession rs = new RuleSession();
String rset =
"ruleset main {" +
" import ruleexample1.bo.Person;" +
" rule blueEyeFemaleWithIncomeOver40000 {" +
" if (fact Person p && p.getEye_color().equals(\"Blue\") && p.getSex().equals(\"F\") && p.getIncome()>40000 ) {" +
" println(p.getName() + \" is a female with blue eyes and an income over 400000.\");" +
" }" +
" }" +
"}";
rs.executeRuleset(rset);

this rule will fire for females with blue eyes and has an income over 40000. Once done, we can assign the persons as facts, this is done by:

for (int i=0;i<v.size();i++) {
rs.callFunctionWithArgument( "assert", (Person)v.elementAt(i) );
}

once the facts are in place, we can run this by calling:

rs.callFunction( "run" );

That's it! This will print out a list of objects that matches the conditions set out in the rule set.

fredag, februari 03, 2006

Functions in Oracle Business Rules RL Language

The Oracle Business Rules RL Language syntax is very similar to Java, so it should be very easy for a Java programmer to get a grasp on the syntax quickly. If you have a background working with Jess, you will however notice that the syntax differs a bit. I will give a quick demonstration on the differences concerning functions.

In Jess you create a function like:

Jess> (deffunction max (?x ?y)
(if (> ?x ?y) then
(return ?x)
else
(return ?y)))

and you call upon it with the following statement:

Jess> (printout t "The biggest number of 5 and 7 is: " (max 5 7) "." crlf)

In RL Language you create a similar function like:

RL> function max(long x, long y) returns long {
if (x<=y) { return y; }
else { return x; }
}

and you call upon it with the following statement:

RL> println("The biggest number of 5 and 7 is: " + max(5,7) + ".");

So, as you can see, with respect to functions, Jess and RL Language looks quite the same, however, there are syntactical differences for the programmer to be aware of.

torsdag, februari 02, 2006

Oracle Business Rules not Installed by Default

I downloaded and installed the Oracle AS 10.1.3 today in order to get going with the Oracle Business Rules. As indicated on the OTN page it says that this should be included with the installation. It is included, but the Rule Author it is not installed by default.

So, once you have installed the Oracle AS 10.1.3, you also need to deploy the ruleauthor.ear file to the OC4J instance where you want your Rule Author to run. The file is located in the /rules/webapps directory.

Once deployed, the Rule Author came up nicely.

Started Blog

Started this blog on the 2nd of February 2006.