Thursday, August 21, 2008

Deployment Seam 2.0.2 Application against Oracle 10gR2 database to Jboss 4.2.3 via NetBeans 6.1 on Solaris Nevada (b96)

Technical exercise bellow is targeting testing Jboss-Seam 2.0.2 SP1 with
NetBeans 6.1 (JDK 6.0) to deploy Brian Leonard's Sample to Jboss 4.2.3
on Solaris Nevada ( build 96) with xVM kernel.
Hibernate has been selected as persistence provider. Oracle 10gR2 database instance has been installed on SNV93 DomU for performance evaluation.

Oracle 10g installation procedure on Solaris Nevada DomU may be viewed if needed

To tune Jboss 4.2.3 instance and make it connects to Oracle Server, perform the following steps on the JBoss Application Server 4.2.3 :
Download the JDBC driver for Oracle 10g Release 2 located at:
For the Oracle JDBC driver with JDK 1.4 and 1.5, use the ojdbc14.jar file.
Copy the JDBC driver to the JBoss environment by entering the following:
# cp ojdbc14.jar $JBOSS_HOME/server/default/lib
Create a file named $JBOSS_HOME/server/default/deploy/oracle-ds.xml and add the following contents:

<connection-url>jdbc:oracle:thin:@IP_OR_HOSTNAME_OF _ORACLE_DB_ SERVER:1521:ORACLE_SID

Testing the Oracle Database Connectivity
Test the connectivity between JBoss and Oracle by performing the following steps on the JBoss Application Server:
Create a JSP file named $JBOSS_HOME/server/default/deploy/jmx-console.war/oracleTest.jsp and add the following contents:

<%@page contentType="text/html" import="*,java.util.*,org.jboss.jmx.adaptor.model.*,*,java.sql.*,javax.sql.*,javax.naming.*"%>
<title>JBoss->Oracle Test </title>
<link rel="stylesheet" href="style_master.css" type="text/css">
<meta http-equiv="cache-control" content="no-cache">
InitialContext ctx = new InitialContext();
DatabaseMetaData dm = null;
DataSource ds = (DataSource)
Connection conn = null;
Statement stmt = null;
try {
conn = ds.getConnection();
dm =conn.getMetaData();
out.println("Connected to-> database version "+dm.getDatabaseProductVersion());
}catch (Exception sqlex) {

Start JBoss by entering the following:
# $JBOSS_HOME/bin/
Verify that the Oracle test page is displayed by opening a browser and navigating to the following URL:

Follow [1],[2] in new environment.
Add corresponding jars to ejb and web modules ([2]) and
proceed with persistence.xml , keeping Hibernate as persistence provider and selecting datasource as


previously defined for Jboss 4.2.3 Server.

Proceed with tuning web.xml,ejb-jar.xml,faces-config.xml per [1].

Modify code of entity bean and ([1])
to instantiate Seam instances at runtime and delete JSF managed bean
as no longer needed.Right click in text area to run "Fix imports" and
select appropriate ones. Embedding seam annotations will require this
fixes to be done.

Annotation @Interceptors({org.jboss.seam.ejb.SeamInterceptor.class})
is required only if ejb-jar.xml has not been modified.
Otherwise , it is not needed

Deploy "Registration Application" to Jboss and run.

Connect to Oracle database from NetBeans 6.1 and perform query against table "users" cumulating inserted records.

Jboss status via NetBeans 6.1 may be viewed here.

Regarding "Seam Plugin for NetBeans 6.1" , please , view [3],[4].
Viewing comments in [3] requires login, otherwise feedbacks stay hidden.