Announcement Announcement Module
Collapse
No announcement yet.
OC4J DataSource - TypeMismatchExcept Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • OC4J DataSource - TypeMismatchExcept

    Hi,

    I developed and tested my app on Tomcat. Now I'm trying to deploy it on OC4J, where I have to define the DataSource as oracle.jdbc.pool.OracleDataSource instead of javax.sql.DataSource.

    oracle.jdbc.pool.OracleDataSource implements the interface javax.sql.DataSource!
    Accessing the DataSource I get the following TypeMismatchException:

    Code:
    22:46:20,855 ERROR StartseiteControllerImpl: java.lang.RuntimeException: org.springframework.beans.factory.access.Bootst
    rapException: Unable to return specified BeanFactory instance: factory key [beanRefFactory], from group with resource na
    me [classpath*:beanRefFactory.xml]; nested exception is org.springframework.beans.factory.BeanCreationException: Error c
    reating bean with name 'beanRefFactory' defined in URL [code-source:/C:/Programme/oc4j_extended_101300/j2ee/home/applica
    tions/live/live/WEB-INF/lib/live-core-1.0-SNAPSHOT.jar!beanRefFactory.xml]: Instantiation of bean failed; nested excepti
    on is org.springframework.beans.FatalBeanException: Could not instantiate class [org.springframework.context.support.Cla
    ssPathXmlApplicationContext]; constructor threw exception; nested exception is org.springframework.beans.factory.BeanCre
    ationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]:
    Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException: Property
    AccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchExcept
    ion: Failed to convert property value of type [oracle.jdbc.pool.OracleDataSource] to required type [javax.sql.DataSource
    ] for property 'dataSource']
    I think this happens while LocalSessionFactoryBean.setDataSource is invoked.

    Has anyone an idea what is going wrong.
    Thanks in advance.

    Oemer

  • #2
    I have used OC4J (Oracle AS) too and this is how I define my data sources in data-sources.xml:-

    Code:
    <data-source
        name="MyDataSource"
        location="jdbc/MyDataSource"
        class="com.evermind.sql.DriverManagerDataSource"
        connection-driver="oracle.jdbc.driver.OracleDriver"
        url="jdbc:oracle:thin:@somwhere.com:1521:oraclesid"
        username="myuser"
        password="mypassword"
        inactivity-timeout="180">
    </data-source>
    BTW, com.evermind is still a part of OC4J, that package structure existed before Oracle licensed it, in case you weren't aware.

    HTH

    Comment


    • #3
      DataSources has been completely reworked in OC4J 10.1.3. No more com.evermind.sql.DriverManagerDataSource support.

      Here my config, which is working:

      Code:
      <native-data-source 
         user="user" 
         password="pass" 
         url="jdbc:oracle:thin:@host:1521:db" 
         data-source-class="oracle.jdbc.pool.OracleDataSource" 
         jndi-name="jdbc/MyDS" 
         name="MyDS"/>
      :-(

      Any other idea?

      Comment


      • #4
        Sorry, I only have one client who uses OC4J and they use Oracle AS 10g release 9.0.4.

        There have been numerous reported problems with 10.1.3 though, for example - http://forum.springframework.org/showthread.php?t=22008 - you may want to drop back down a version until the bugs are found and fixed.

        Comment

        Working...
        X