Here is a cool site for instructing how to define OCBC connection strings for different data sources:
Blog related to Oracle technology, mainly interest areas are Java, Integration, Weblogic, OracleVM, XML, etc.
23.8.07
Oracle BAM 10.1.3 External Data Source and Access DB
When preparing for a BAM demo I needed to show information from BAM external data source (MS Access sample database Northwind). Manual only described how to configure Oracle Database, but didn't give a sample how to configure Access DB.
After a while of tweaking out the configuration I got Access DB set up as an external data source. The key is to define following values as a sample:
Driver: Microsoft Access Driver (*.mdb)
Connection string: Dbq=d:\demodb\Nwind.mdb;
26.7.07
OpenCMS 7.0.1 and Jetty
Finally had some time to play around with OpenCMS again. This time trying to get OpenCMS running on Jetty servlet engine.
Installing on Jetty is pretty straight forward. Just downloaded the OpenCMS zip file, unpacked the war file under $JETTY_HOME/webapps/opencms and extracted the war file with jar xvf opencms.war.
After bouncing the Jetty engine and trying to startup the OpenCMS setup screen I got an exception:
2007-07-25 19:21:06.019::WARN: EXCEPTION
javax.servlet.ServletException: Critical error during OpenCms initialization: The OpenCms setup wizard is still enabled.
at org.opencms.main.OpenCmsServlet.init(OpenCmsServlet.java:262)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:400)
...
This actually caused the whole Jetty engine to misbehave since I could not any more use other applications on the Servlet engine. And naturally the OpenCMS could not be started at all.
Downloaded the source code from read-only CVS repository and looked at the problem. This seems to be the same issue as with BEA WL9, so I needed to uncomment the "OnErrorExitWithoutException" parameter setting under $JETTY_HOME/webapps/opencms/WEB-INF/web.xml.
After uncommenting the servlet parameter and bouncing the Jetty engine I was able to startup OpenCMS setup screen successfully.
25.5.07
Running Liferay on OracleAS 10.1.2
Liferay portal installation on OracleAS 10.1.2 doesn't necessarily follow the installation instructions mentioned in the liferay.com site.
Here are the rough steps to configure Liferay 3.0.6 on OracleAS 10.1.2. J2EE and Web Cache installation.
1. Download the Liferay EAR file. Follow the instructions to update the config files mentioned in the Liferay home pages.
2. Liferay uses different XML parser that is by default configured in OracleAS 10.1.2. To make the container use Xerces parser you need to set up parameters for starting up the container. Make sure you change the "/home/oracle/xerces/xerces-2_9_0" path to reflect your environment.
Edit opmn.xml:
<ias-component id="OC4J">
<process-type id="home" module-id="OC4J" status="enabled">
<module-data>
<category id="start-parameters">
<data id="java-options" value="-server -Doc4j.userThreads=true -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Xbootclasspath/a:/home/oracle/xerces/xerces-2_9_0/xml-apis.jar -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -Djavax.xml.parsers.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl -Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl"/>
</category>
After editing the opmn.xml manually, validate the opmn.xml with command:
$ORACLE_HOME/opmn/bin/opmnctl validate
Reload the changes in opmn with command
$ORACLE_HOME/opmn/bin/opmnctl reload
Update the dcm repository with command:
$ORACLE_HOME/dcm/bin/dcmctl updateconfig
3. Configure OC4J global-web-application.xml:
To avoid this exception:
OracleJSP: oracle.jsp.parse.JspParseException: /html/themes/brochure/templates/init.jsp: Line # 27, <theme:defineObjects />
Error: Tag attempted to define a bean which already exists: themeDisplay
Resolve: Add following in $ORACLE_HOME/j2ee/home/config/global-web-application.xml
<init-param>
<param-name>req_time_introspection</param-name>
<param-value>true</param-value>
</init-param>
4. Copy following jar files to $ORACLE_HOME/j2ee/home/applib
liferay-jdbc.jar
xercesImpl.jar
xml-apis.jar
xmlParserAPIs.jar
The link to Liferay's JDBC driver can be found from Liferay.com. Xerces parser can be downloaded from Apache.org site.
5. Bounce the OC4J container
6. Deploy Liferay EAR file using OracleAS Enterprise Manager.
Test and make sure everything works. If you have any additions, pls let me know and I'll update the notes here.
Looks like a new version of Liferay 4.x.x just popped out. You might give a shot and try above installation instructions with the latest release as well.
30.12.06
Windows Live Blog Client
Blogger.com got upgraded and my blogger client w.Bloggar refused to work properly with the new beta.blogger.com. Althought the newly announced beta -> production change, w.Bloggar didn't still work.
I started looking at alternatives and found Microsoft Windows Live Blog Client that seems to work nicely with the new Blogger.com.
As the new year 2007 is arriving I wish you all:
29.10.06
Configuring Jetty 6 to work with Oracle DB
- Tomcat
- Jetty
Tomcat
Started with Tomcat 5.5. Installed Tomcat. Installed Axis 1.4. For Axis I needed to manually install bunch of missing JARs. Tried a simple JSP page with JSLT and SQL tags to dig out information from OracleXE. Just to get into phase where I didn't get any missing class exceptions took me a while. I had to manually install mail.jar, activation.jar, xmlsec.jar etc. In the end of stripping out the exceptions I finally could connect the OracleXE database but the only problem was that none of the results were not displayed in the actual JSP result HTML (despite the connection to the database was working). Weird... I used quite a bit of time searching internet for answer how to get this working.
It was time to throw the towel to the ring. Farewell Tomcat.
Jetty
Downloaded Jetty 6.0.1. Installed it. Installed Axis 1.4. Axis installation was a nice surprise, almost all the needed libraries were already there for Axis 1.4. I only needed to add xmlsec jar file and Axis was happy. Axis installation was much more fluent in Jetty than in Tomcat. Tried my test JSP to connect OracleXE. There I faced some challeges but got over them very fast and was up and running with working JSP, using JSLT + SQL tags printing results out of my Oracle database.
Jetty was a pleasant surprise to me. For those folks that needs sample application that works with Oracle database using data sources, here are the steps to do it:
1. Create directory webapps-plus under $JETTY_HOME if that directory doesn't exists.
Jetty 6.0.1 is configured out-of-the-box with JNDI support if you deploy your application under webapps-plus directory. Also in order to get the JNDI support you need to start the Jetty engine with following parameters:
java -jar start.jar etc/jetty.xml etc/jetty-plus.xml
2. Create a sample application subdirectory $JETTY_HOME/webapps-plus/mysample.
3. Copy WEB-INF from $JETTY_HOME/webapps/test to $JETTY_HOME/webapps-plus/mysample
4. Copy Oracle JDBC driver to $JETTY_HOME/webapps-plus/mysample/WEB-INF/lib. I use ojdbc14.jar.
5. Edit the jetty-web.xml in $JETTY_HOME/webapps-plus/mysample/WEB-INF
You can configure the Oracle datasource in this config file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://j
etty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Call class="org.mortbay.log.Log" name="debug">
<Arg>executing jetty-web.xml</Arg>
</Call>
<!-- Add a DataSource only valid for this webapp -->
<New id="oraclexe" class="org.mortbay.jetty.plus.naming.Resource">
<Arg>jdbc/oraclexe</Arg>
<Arg>
<New class="oracle.jdbc.pool.OracleDataSource">
<Set name="user">scott</Set>
<Set name="password">tiger</Set>
<Set name="URL">jdbc:oracle:thin:@myhostname.com:1521:XE</Set>
</New>
</Arg>
</New>
</Configure>
6. Create a sample JSP file that reports data from Oracle database using the data source defined in jetty-web.xml:
Here is the sample JSP with SQL tags:
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Oracle DB Test</title>
</head>
<body>
<h2>Results</h2>
<sql:query dataSource="jdbc/oraclexe" var="rs">
SELECT * FROM dual
</sql:query>
<c:choose>
<c:when test="${rs.rowCount == 0}">
Sorry, no messages found.
</c:when>
<c:when test="${rs.rowCount == null}">
Sorry, no messages found (null).
</c:when>
<c:otherwise>
Messages found (${rs.rowCount})
</c:otherwise>
</c:choose>
<c:forEach var="row" items="${rs.rows}">
Dummy ${row.dummy}<br/>
</c:forEach>
</body>
</html>
7. Bounce jetty to get all the changes in effect.
If everythings went well, you should be having a working connection to Oracle database printing out something like:
Results
Messages found (1) Dummy X
18.8.06
Disabling Gnome/KDE in RedHat startup
How to disable graphical desktop in server startup? This is to conserve system resourses when server is used only remotely e.g. SSH.
su -
vi /etc/inittab
Look for a line like this: id:5:initdefault:
This line specifies default runlevel on boot.
Default runlevel. The runlevels used by RHS are:
0 - halt (Do NOT set initdefault to this)
1 - Single user mode
2 - Multiuser, without NFS (The same as 3, if you do not have networking)
3 - Full multiuser mode
4 - unused
5 - X11
6 - reboot (Do NOT set initdefault to this)
Change the 5 in the quote above to a 3. Save and reboot.
27.3.06
HAM
There are products like Oracle BAM
Home Activity Monitoring (HAM?) is a word I could describe following ultra COOL Dutch site: http://www.bwired.nl/
.
Amazing !! :)
22.2.06
OC4J (9.0.4, 10.1.2 and 10.1.3) log file rotation
[New JVM parameters]
"stdstream.filesize"
Max file size limit of each archive. Unit is megabyte.
"stdstream.filenumber"
Max number of files that oc4j can keep as archives. The oldest file
will be automatically deleted if the limit is exceeded.
"stdstream.rotatetime"
Time when the log file is rotated. Format is "HH:mm". The archive
will be rotated at the specified time everyday.
[Usage]
ex 1: rotate stdout/stderr when the file size is reached to 2.5M byte.
java -Dstdstream.filesize=2.5 -jar oc4j.jar -out std.out -err std.err
ex 2: rotate stdout at 13:30 everyday
java -Dstdstream.rotatetime=13:30 -jar oc4j.jar -out std.out
ex 3: rotate stdout at 13:30 everyday and keep 10 files as archive
java -Dstdstream.rotatetime=13:30 -Dstdstream.filenumber=10 -jar oc4j.jar -out std.out
The generated log file would look like <filename w/o extension>_yyyy_MM_dd_HH_mm_ss.<extension>
e.g. std_2004_07_08_13_24_53.out
[Note]
1. The same parameter are used for both "-out" and "-err".
2. In AS mode, the log files will be created under <island name and process id> directory
(this isn't changed by this fix, existing code handles this)
3. Both "filesize" and "rotatetime" parameters can be used at the same time.
opmn.xml
In order to get these parameters in opmn.xml you need to define it as follows:
...
<category id="start-parameters">
<data id="java-options" value="-server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Dstdstream.filesize=0.2 -Dstdstream.filenumber=5"/>
<data id="oc4j-options" value="-out std.out -err std.err"/>
</category>
...
You will find the new log files under:$ORACLE_HOME/j2ee/home/home_default_island_1
The file naming will be like:
std_2006_02_22_14_01_17.out
std_2006_02_22_14_16_25.out
15.1.06
HTML DB Region Title Dynamic Translation
HTML DB has translation capabilities built-in but the functionality wasn't exactly what I was looking for. I wanted the same HTML DB application to support all above languages, not to have multiple languages and multiple applications.
Everything else was doable, I created dynamic content relational tables and the content of the web pages is retrieved from the database using the language preferred.
One problem are was region titles, which doesn't support translatability within the same application out of the box. I am able to print out the region title using application level attributes, so called substitution variables. This is half way what I wanted but there is no language perspective to this. I want to print out the welcome region box title as "Welcome", "Tervetuloa", "Välkommen" dependent on the browser language.
I finally discovered a way to do this. First of all I have to use javascript to do this. Secondly I thought I could use the "navigator.language" variable from the client browser to discover the preferred language of the browser, but this didn't work exactly as I thought. Namely this variable prints out the installed browser language, not the preferred language that user has selected from the browser preferences.
The workaround to discover how to get the "HTTP_ACCEPT_LANGUAGE" -setting took awhile. Finally I got a working Javascript snippet that did the trick with HTML DB:
<script type="text/javascript">var language = '&BROWSER_LANGUAGE.';
if (language.indexOf('fi') > -1) document.write("Tervetuloa");
else if (language.indexOf('sv') > -1) document.write("Välkommen");
else document.write("Welcome")</script>
So the key is to use the &BROWSER_LANGUAGE. -substitution variable to find out the preferred browser language to get the right result.
31.10.05
OpenCMS and OC4J 10.1.2 (part 2)
There were definitely something wrong with the installation of OpenCMS on OC4J. The installation failed on NPE but system somehow managed to start up. Perhaps some of the modules got installed correctly. I can see that some of the config files point to Tomcat setup (like pointing to ROOT -default web application), so there might be something Tomcat specific behind the scenes that affect the application execution on other containers.
Anyways, to fork the problem area I installed OpenCMS using Tomcat (which works fine) so that I got the repository installed correctly on my Oracle 10.1.3 database. What I did then was I copied all the OpenCMS config etc. files under Tomcat webapps to the OC4J directory to make sure everything is as it should be after the installation. What happens is that systems starts up nicely, the log file compared to Tomcat looks exactly the same (used UltraEdit file diff'er to find out the differences). But what happens next after entering login (Admin/admin), is not something I am looking for. The login screen keeps popping up all the times and the workspace isn't shown. No error messages, no exceptions, no beeps, no nothing.
One step closer to despairness was when I downloaded the whole OpenCMS sources tree on my JDeveloper and re-built the whole application from sources. Now the only thing to find out was to remotely debug the OpenCMS server using JDeveloper's remote debugger and starting OC4J in debugging mode. Ok. This should work... or should it? I set the debug break point and debug the application line-by-line. For some reason the debugger freaks out in the critical moments that should point out the problem area. What is going on?
I also see that other people face the same problem when looking at OpenCMS mailing list.
Battle continues. Having the sources and detail debugging should eventually reveal the source of the problem. Let's see how long this takes.
19.10.05
OpenCMS and OC4J 10.1.2
-Doc4j.userThreads=true
So if you start the OC4J from command line: java -jar oc4j.jar, you need to start with java -Doc4j.userThreads=true -jar oc4j.jar.
After this you will be able to run the setup successfully and continue using OpenCMS.
Re-packagaging EAR
For those that need helping hand on the re-wrapping the OpenCMS war file to be deployed as EAR in OC4J here are the steps:
1. Create a new subdirectory
2. Copy the opencms.war file to that directory
3. Create META-INF -directory and new file application.xml
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>opencms</display-name>
<module>
<web>
<web-uri>opencms.war</web-uri>
<context-root>opencms</context-root>
</web>
</module>
</application>
4. Package EAR file: jar cvf opencms.ear *
Deployment
For deployment I usually use a script that uses admin.jar. Here is a sample I use on Windows:
set OC4JDIR=D:\apps\oc4j_extended_101202\j2ee\home
set FILEE=%1%
java -jar %OC4JDIR%\admin.jar ormi://localhost admin welcome -undeploy %FILEE%
java -jar %OC4JDIR%\admin.jar ormi://localhost admin welcome -deploy -deploymentName %FILEE% -file %FILEE%.ear
java -jar %OC4JDIR%\admin.jar ormi://localhost admin welcome -bindWebApp %FILEE% %FILEE% http-web-site %FILEE%
For Linux you need to figure out yourself how to replace the variable names in Unix style ;)
Login Problems
In the end of the installation I still faced some NPE exceptions, looks like they were related somehow to user management.
Once I re-started the instance I got following errors in the opencms.log:
19 Oct 2005 06:59:21,578 ERROR [ org.opencms.main.OpenCmsCore: 296] Critical error during OpenCms initialization: The OpenCms setup wizard is still enabled.
This can be fixed by setting the setup wizard setting to false in opencms.properties -file.
Once trying to open up the admin workspace using URL: http://localhost:8888/opencms/opencms/system/login, I will get the login dialog where I enter the default Admin username and password. From the log files seems like I get successful authentication but the workspace never shows up. The login dialog will always be shown to user. Seems like browser type (IE, TB) doesn't have anything to do with this.
The login problem is still to be resolved until OpenCMS can be successfully used with OC4J.
I'll be back.
10.8.05
BPEL Orchestration versus Choreography
http://www.oracle.com/technology/pub/articles/matjaz_bpel1.html
8.7.05
Jakarta Slide on OC4J
Here is a sample startup script for my OC4J:
cd $HOME/oc4j/j2ee/home
java
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl
-jar oc4j.jar
Xalan and Xerces libraries should be placed under JAVA_HOME/jre/lib/ext and remember to give at least read access to the account running the OC4j container.
JDeveloper 10.1.2 and Linux-x86_64 with JDK 1.5 (64-bit)
If you want to get 10.1.2 JDeveloper running with JDK 1.5 you might get an error message such as:
Error: Hotspot VM not supported
Error: JDeveloper can't recognize the JDK version
Tha last error message is because of the first. To work around this you should edit the $JDEV_HOME/jdev/bin/jdev.conf -file and comment out the line that shows:
SetJavaVM hotspot
After this you should be able to start JDeveloper 10.1.2.
You might get some weird sticky startup screen showing in front of the initial questionnaire windows. After passing these (either try moving the windows or just pressing Enter) you should be fine with JDeveloper.
21.6.05
Powerpoint notes removal add-in
Here is the PPT add-in (HJK_Remove_Notes.ppa), which you need to copy to the Microsoft add-ins directory. In my workstation the target directory is: C:\Documents and Settings\hkaukovu\Application Data\Microsoft\AddIns
After this you should restart the Powerpoint and navigate to Tools -> Add-Ins and press "Add New...". Choose the HJK_Remove_Notes.ppa -file and press Enable Macros button to start the add-in. You should have Plugins -menu item after the "Help" and from there if you choose "Delete Notes" you should be able to delete all the notes from the currently open PPT. The VBA macro will confirm you before you delete the notes.
If you find any issues pls let me know.
Comment on Blojsom installation on OC4J
There is an easier way for installing applications on OC4J as pointed by Olaf Heimburger in his blog:
http://www.orablogs.com/olaf/archives/001043.html
20.6.05
OC4J: Adding your own logging handler for J2EE application logging
Oracle OC4J J2EE logging is based on the J2SE 1.4 java.util.logging. This is the new standard logging utility that has most of the same features log4j has, althought log4j still has more custom logging handlers compared to JUL logging.
You can add your own JUL (java.util.logging) handler as logging handler in the container component (defined in j2ee-logging.xml), but this doesn't affect any of the sub-component loggings, like JMS, server, RMI etc. j2ee-logging.xml affects on custom logging events used in the applications.
One thing to note here is that in order to use e.g. java.util.logging.FileHandler, you must set the "-Djava.util.logging.config.file" -option in the "java -jar oc4j.jar" call to configure the logging options. Setting the properties in the j2ee-logging.xml doesn't have any effect on the java.util.logging handlers.
So in order to run the OC4J with the wanted logging handler you need to startup the container with following command line:
java -Djava.util.logging.config.file=d:\apps\jdev1012\j2ee\home\properties\logging.properties -jar oc4j.jar
Here is a sample j2ee-logging.xml:
<logging_configuration>
<log_handlers>
<log_handler name="oc4j-handler" class="java.util.logging.FileHandler">
</log_handler>
</log_handlers>
<loggers>
<logger name="oracle" level="ALL" useParentHandlers="false">
<handler name="oc4j-handler"/>
</logger>
</loggers>
</logging_configuration>
Here is a sample logging.properties file:
java.util.logging.FileHandler.level=ALL
# "/" the local pathname separator
# "%t" the system temporary directory
# "%h" the value of the "user.home" system property
# "%g" the generation number to distinguish rotated logs
# "%u" a unique number to resolve conflicts
# "%%" translates to a single percent sign "%"
java.util.logging.FileHandler.pattern=%h/central%u.log
java.util.logging.FileHandler.limit=0
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.append=true
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
oracle.emp.kaukovuo.logger.test.LoggerServlet=ALL
12.4.05
OC4J Logging and debugging
OracleAS Containers for J2EE - Logging and Debugginghttp://www.oracle.com/technology/tech/java/oc4j/htdocs/oc4j-logging-debugging-technote.html
11.4.05
Loading Java properties file inside EJB component (OC4J)
Properties prop = new Properties();
try
{
prop.load(new FileInputStream("hello.properties"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
Under OC4J you might want to keep all the properties files under the same directory e.g. $OC4J_HOME/properties. For this you should edit the container application.xml file under $OC4J_HOME/config -directory. Add following line to the application.xml:
<library path="../properties"/>
In the J2EE application you can trust the class loader to find the properties file under this directory. For this you should code your application as:
Properties prop = new Properties();
try
{
prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("hello.properties"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}