Advertisement

01.13.2008 at 01:46PM PST, ID: 23079575
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Configuring an oracle connection for OAS 10.1.3 and Hibernate 3

Tags: Oracle, Oracle AS, 10.1.3
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.ClassCastException: oracle.jdbc.pool.OracleDataSource

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.datasource">
                  java:/mydb
            </property>
            <property name="connection.driver_class">
                  oracle.jdbc.driver.OracleDriver
            </property>
            <property name="dialect">
                  org.hibernate.dialect.Oracle9Dialect
            </property>
            <property name="hibernate.connection.autocommit">
                  false
            </property>
            <property name="hibernate.default_schema">ES</property>
            <property name="hibernate.max_fetch_depth">3</property>
            <property name="hibernate.jdbc.batch_size">0</property>
            <property name="cache.use_query_cache">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.OracleDataSource"
             user="...."
             password="...."
             url="jdbc:oracle:thin:@mytestserver:1521:orcl">
      </native-data-source>
</data-sources>


And the stack trace when it tries to open the Hibernate session
---------------------------------------------------------


org.hibernate.HibernateException: Could not find datasource
      at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56)
      at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
      at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
      at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:366)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
      at com.escholar.hibernate.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:95)
      at com.escholar.hibernate.HibernateSessionFactory.getSession(HibernateSessionFactory.java:49)
      at com.escholar.servlets.WSAppLoaderServlet.Initiallize(WSAppLoaderServlet.java:155)
      at com.escholar.servlets.WSAppLoaderServlet.init(WSAppLoaderServlet.java:112)
      at javax.servlet.GenericServlet.init(GenericServlet.java:256)
      at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2361)
      at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4810)
      at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4734)
      at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4922)
      at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1134)
      at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:738)
      at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:414)
      at com.evermind.server.Application.getHttpApplication(Application.java:545)
      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1990)
      at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:1909)
      at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1606)
      at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:238)
      at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:99)
      at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(ApplicationDeployer.java:547)
      at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:202)
      at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
      at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
      at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
      at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
      at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: oracle.jdbc.pool.OracleDataSource
      at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52)
      ... 31 more
Start your free trial to view this solution
Question Stats
Zone: Software
Question Asked By: markecassidy
Solution Provided By: markecassidy
Participating Experts: 0
Solution Grade: A
Views: 125
Translate:
Loading Advertisement...
01.13.2008 at 03:32PM PST, ID: 20649860

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.27.2008 at 09:58PM PST, ID: 20757095

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628