I'm trying to run an application using Oracle ADF Business Components on a JBoss Server. I've maneged to deploy it, but when I try to load the page I get below exception:
java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6 cannot be cast to oracle.jdbc.OracleConnection
Is there a way solve this? Maybe configure JBoss to not use this wrapped connection or configure the ADF framework to unwrap it?
This is a while back, but I'll just follow up on my own question.
There is a guide on Oracle Metalink (Needs login) wich explains how to deploy ADF/BC on JBoss. I'm pretty sure this is what solved this for me (it's a while ago..)
Here is a copy of it:
Abstract
The purpose of this note is to show how you create an ADF BC Application Module and how you deploy it on a JBoss Application Server. It will also show you what configurations you need to perform on the JBoss side in order for the Application Module to work correctly.
Scope & Application
This note is intended for anyone who is about to deploy an ADF BC Module to a JBoss Application Server.
How To Deploy an ADF BC Module to a JBoss Application Server
The steps necessary for deploying an ADF BC Module to a JBoss Application Server are the following:
I will go through each of these steps more detailed. There is also a complete example attached for download here. Setup the ADF Runtime Libraries on the JBoss Server
Setup data source(s) on the JBoss Server
To create an Oracle data source in the JBoss server, you need to take the following steps:
Create a file called oracle-ds.xml. This file will contain your data source configuration. Below is an example on how such a file can look like.
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>OracleDS</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:oracle:thin:@mydbhost.com:1521:mysid</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>hr</user-name>
<password>******</password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
</local-tx-datasource>
</datasources>
Copy the file to the /deploy. This will install it on the JBoss server.
Configure the ADF BC Module
There are a few steps that need to be taken upon the ADF BC Module in order for it to run on the JBoss server.
When creating an ADF BC Module that will be used on a JBoss application server, one needs to set the SQL Flavor to SQL92 and the Type Map to Java. This change is required when using JBoss as the Application Server.
****Package the ADF Business Components project as an EJB session bean.****
Figure 1. Configuration of the Application Module
Once done, your Project will look similar to the one shown in the figure 2 below.
Figure 2. The JDeveloper Project
The final step is to configure the Application Module to use the data source we created in the previous step. This is done as follows:
Deploy the ADF BC Module
If you have your JBoss server either locally or mapped on your local machine, you can deploy it directly from inside JDeveloper. If your JBoss server is remote, and not mapped to the local machine, or you have a JSP application that later will use this module, you cannot deploy it directly from within JDeveloper. Both methods are described below.
Deploying the Module from within JDeveloper
1. Create a connection to the target application server.
2. If you want to support JBoss-specific configuration options for the EJB, add a jboss.xml deployment descriptor file. For more information on this file, see http://www.jboss.org.
3. If your project is a Business Components UIX JSP project, add required Cabo resources to it.
4. Select the deployment profile in the Navigator, right-click, and choose Deploy to | < application server connection> to package the application as an archive file and deploy it via the selected application server connection.
Deploying the Module outside of JDeveloper
If your JBoss server is remote, and not mapped to the local machine, or you have a JSP application that later will use this module you will have to do as follows: