PDA

View Full Version : Datasource problem



garpinc2
Oct 10th, 2004, 04:35 PM
I am getting error in applicationContext.xml

nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.enhydra.jdbc.oracle.OracleXADataSource] to required type [javax.sql.DataSource] for property 'dataSource']
at org.springframework.beans.BeanWrapperImpl.doTypeCo nversionIfNecessary(BeanWr
apperImpl.java:905)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.j
ava:673)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.j
ava:588)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.j
ava:720)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.
java:747)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.
java:736)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory
.applyPropertyValues(AbstractAutowireCapableBeanFa ctory.java:840)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory
.populateBean(AbstractAutowireCapableBeanFactory.j ava:662)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.jav a:270)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory
.createBean(AbstractAutowireCapableBeanFactory.jav a:205)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(Abstra
ctBeanFactory.java:204)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(Abstra
ctBeanFactory.java:136)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInst
antiateSingletons(DefaultListableBeanFactory.java: 230)
at org.springframework.context.support.AbstractApplic ationContext.refresh(Abstr
actApplicationContext.java:284)
at org.springframework.web.context.support.XmlWebAppl icationContext.refresh(Xml
WebApplicationContext.java:131)
at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(Co
ntextLoader.java:156)
at org.springframework.web.context.ContextLoader.init WebApplicationContext(Cont
extLoader.java:97)
at org.springframework.web.context.ContextLoaderServl et.init(ContextLoaderServl
et.java:80)
at javax.servlet.GenericServlet.init(GenericServlet.j ava:256)
at org.mortbay.jetty.servlet.ServletHolder.start(Serv letHolder.java:219)
at org.mortbay.jetty.servlet.ServletHandler.initializ eServlets(ServletHandler.j
ava:436)
at org.mortbay.jetty.servlet.WebApplicationHandler.in itializeServlets(WebApplic
ationHandler.java:150)
at org.mortbay.jetty.servlet.WebApplicationContext.st art(WebApplicationContext.
java:449)
at org.mortbay.jetty.plus.PlusWebAppContext.start(Plu sWebAppContext.java:57)
at org.mortbay.http.HttpServer.start(HttpServer.java: 663)
at org.mortbay.jetty.plus.Server.start(Server.java:13 1)
at com.iw.plugins.jettyrunner.PluginRunner.launchWith XML(PluginRunner.java:171)
at com.iw.plugins.jettyrunner.PluginRunner.main(Plugi nRunner.java:131)


org.enhydra.jdbc.oracle.OracleXADataSource does implement javax.sql.DataSource

My applicationContext.xml

<bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java&#58;comp/env/jdbc/OlbDataSource</value>
</property>
</bean>

My jettyplus Jetty-4.2.11 is set up as follows:


<Call name="addService">
<Arg>
<New class="org.mortbay.jetty.plus.JotmService">
<Call name="addDataSource">
<Arg>jdbc/OlbDataSource</Arg>
<Arg>
<New class="org.enhydra.jdbc.oracle.OracleXADataSource">
<Set name="DriverName">oracle.jdbc.driver.OracleDriver</Set>
<Set name="Url">jdbc&#58;oracle&#58;thin&#58;@xxx&#58;1521&#58;xxx</Set>
<Set name="User">xxx</Set>
<Set name="Password">xxx</Set>
</New>
</Arg>
</Call>
</New>
</Arg>
</Call>

Colin Sampaleanu
Oct 14th, 2004, 05:38 PM
Are you sure that org.enhydra.jdbc.oracle.OracleXADataSource really derives from a real DataSource, javax.sql.DataSource?

If so, there may be some sort of classloading issue, where the javax.sql.DataSource class known to Spring is not the one in classloader used to get the OracleXADatasource...

irbouho
Oct 14th, 2004, 07:42 PM
Colin,

I checked this before and found that org.enhydra.jdbc.oracle.OracleXADataSource (http://xapool.experlog.com/doc/api/jdoc-1.2/org/enhydra/jdbc/oracle/OracleXADataSource.html) does implement DataSource. Unfortunately I could not reproduce this problem on my platform.

garpinc2
Nov 3rd, 2004, 10:15 AM
What happened on your platform?