Hi -
We have an application that deploys to JBoss - no problem. It uses Hibernate3 and Oracle 10. I have been trying to get it to deploy properly to OAS 10.1.3. I got around some issues with antlr etc by telling the classloader to load our war lib first.
My remaining problem is getting the connection to work. I have tried googling the problem, and also read over the documentation about OC4J's datasources for 10.1.3.
Hibernate finds the xml and configures it. But when it goes to create a session it gives a class cast exception for the datasource. I have hibernate3.jar and the ojdbc14.jar in my WEB-INF/lib.
Caused by: java.lang.ClassCastExcepti
on: oracle.jdbc.pool.OracleDat
aSource
I can test the datasource deployed for the app in the console and it works.
Below are relevant portions of hibernate cfg xml, data-sources.xml and the stack trace.
(Any help is appreciated. I have tried using ManagedDataSource too with connection pool but that seems like I'm going down the wrong path.)
Hibernate cfg xml portion
--------------------------
<session-factory>
<property name="hibernate.connection
.datasourc
e">
java:/mydb
</property>
<property name="connection.driver_cl
ass">
oracle.jdbc.driver.OracleD
river
</property>
<property name="dialect">
org.hibernate.dialect.Orac
le9Dialect
</property>
<property name="hibernate.connection
.autocommi
t">
false
</property>
<property name="hibernate.default_sc
hema">ES</
property>
<property name="hibernate.max_fetch_
depth">3</
property>
<property name="hibernate.jdbc.batch
_size">0</
property>
<property name="cache.use_query_cach
e">false</
property>
Here is the data-sources.xml (with name and passwd left blank to protect the innocent)
<?xml version="1.0" encoding="UTF-8" ?>
<data-sources>
<native-data-source
name="MyNameds"
jndi-name="java:/mydb"
description="Native DataSource"
data-source-class="oracle.
jdbc.pool.
OracleData
Source"
user="...."
password="...."
url="jdbc:oracle:thin:@myt
estserver:
1521:orcl"
>
</native-data-source>
</data-sources>
And the stack trace when it tries to open the Hibernate session
--------------------------
----------
----------
----------
-
org.hibernate.HibernateExc
eption: Could not find datasource
at org.hibernate.connection.D
atasourceC
onnectionP
rovider.co
nfigure(Da
tasourceCo
nnectionPr
ovider.jav
a:56)
at org.hibernate.connection.C
onnectionP
roviderFac
tory.newCo
nnectionPr
ovider(Con
nectionPro
viderFacto
ry.java:12
4)
at org.hibernate.connection.C
onnectionP
roviderFac
tory.newCo
nnectionPr
ovider(Con
nectionPro
viderFacto
ry.java:56
)
at org.hibernate.cfg.Settings
Factory.cr
eateConnec
tionProvid
er(Setting
sFactory.j
ava:366)
at org.hibernate.cfg.Settings
Factory.bu
ildSetting
s(Settings
Factory.ja
va:60)
at org.hibernate.cfg.Configur
ation.buil
dSettings(
Configurat
ion.java:1
881)
at org.hibernate.cfg.Configur
ation.buil
dSessionFa
ctory(Conf
iguration.
java:1174)
at com.escholar.hibernate.Hib
ernateSess
ionFactory
.rebuildSe
ssionFacto
ry(Hiberna
teSessionF
actory.jav
a:95)
at com.escholar.hibernate.Hib
ernateSess
ionFactory
.getSessio
n(Hibernat
eSessionFa
ctory.java
:49)
at com.escholar.servlets.WSAp
pLoaderSer
vlet.Initi
allize(WSA
ppLoaderSe
rvlet.java
:155)
at com.escholar.servlets.WSAp
pLoaderSer
vlet.init(
WSAppLoade
rServlet.j
ava:112)
at javax.servlet.GenericServl
et.init(Ge
nericServl
et.java:25
6)
at com.evermind.server.http.H
ttpApplica
tion.loadS
ervlet(Htt
pApplicati
on.java:23
61)
at com.evermind.server.http.H
ttpApplica
tion.findS
ervlet(Htt
pApplicati
on.java:48
10)
at com.evermind.server.http.H
ttpApplica
tion.findS
ervlet(Htt
pApplicati
on.java:47
34)
at com.evermind.server.http.H
ttpApplica
tion.initP
reloadServ
lets(HttpA
pplication
.java:4922
)
at com.evermind.server.http.H
ttpApplica
tion.initD
ynamic(Htt
pApplicati
on.java:11
34)
at com.evermind.server.http.H
ttpApplica
tion.<init
>(HttpAppl
ication.ja
va:738)
at com.evermind.server.Applic
ationState
Running.ge
tHttpAppli
cation(App
licationSt
ateRunning
.java:414)
at com.evermind.server.Applic
ation.getH
ttpApplica
tion(Appli
cation.jav
a:545)
at com.evermind.server.http.H
ttpSite$Ht
tpApplicat
ionRunTime
Reference.
createHttp
Applicatio
nFromRefer
ence(HttpS
ite.java:1
990)
at com.evermind.server.http.H
ttpSite$Ht
tpApplicat
ionRunTime
Reference.
<init>(Htt
pSite.java
:1909)
at com.evermind.server.http.H
ttpSite.ad
dHttpAppli
cation(Htt
pSite.java
:1606)
at oracle.oc4j.admin.internal
.WebApplic
ationBinde
r.bindWebA
pp(WebAppl
icationBin
der.java:2
38)
at oracle.oc4j.admin.internal
.WebApplic
ationBinde
r.bindWebA
pp(WebAppl
icationBin
der.java:9
9)
at oracle.oc4j.admin.internal
.Applicati
onDeployer
.bindWebAp
p(Applicat
ionDeploye
r.java:547
)
at oracle.oc4j.admin.internal
.Applicati
onDeployer
.doDeploy(
Applicatio
nDeployer.
java:202)
at oracle.oc4j.admin.internal
.DeployerB
ase.execut
e(Deployer
Base.java:
93)
at oracle.oc4j.admin.jmx.serv
er.mbeans.
deploy.OC4
JDeployerR
unnable.do
Run(OC4JDe
ployerRunn
able.java:
52)
at oracle.oc4j.admin.jmx.serv
er.mbeans.
deploy.Dep
loyerRunna
ble.run(De
ployerRunn
able.java:
81)
at com.evermind.util.Releasab
leResource
PooledExec
utor$MyWor
ker.run(Re
leasableRe
sourcePool
edExecutor
.java:298)
at java.lang.Thread.run(Threa
d.java:595
)
Caused by: java.lang.ClassCastExcepti
on: oracle.jdbc.pool.OracleDat
aSource
at org.hibernate.connection.D
atasourceC
onnectionP
rovider.co
nfigure(Da
tasourceCo
nnectionPr
ovider.jav
a:52)
... 31 more
Start Free Trial