Hi
I'm using Toplink (10.1.3 Developer Preview 4) and Spring 1.2.6 (also tested using 1.2.5).
I'm attempting to set through Spring Configuration the oracle.toplink.sessions.DatabaseLogin so that I can use Spring property placeholders to set up the Oracle Toplink connection, and in particular set the tableQualifier property through configuration, rather than relying on the Toplink Session.xml (or Oracle synonyms) to specify the schema that will be in use.
However, I receieve a Spring NoSuchMethodError exception within the LocalSessionFactory relating to the login method of the DataBaseSession Obejct.
If I do not use the DatabaseLogin, and instead use org.springframework.jdbc.datasource.DriverManagerD ataSource, all works OK.
Spring Beans Config:
The exception raised is as follows:Code:<bean id="cdmDatabaseLogin" class="oracle.toplink.sessions.DatabaseLogin"> <property name="driverClassName"><value>${jdbc.driverClassName}</value></property> <property name="databaseURL"><value>${jdbc.url}</value></property> <property name="platformClassName" value="oracle.toplink.platform.database.oracle.Oracle9Platform"/> <property name="userName"><value>${jdbc.username}</value></property> <property name="password"><value>${jdbc.password}</value></property> <property name="tableQualifier"><value>${qualifier}</value></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.toplink.LocalSessionFactoryBean"> <property name="configLocation"><value>????/???/????/config/toplink/Session.xml</value></property> <property name="sessionName"><value>MyTransactions</value></property> <property name="databaseLogin"> <ref local="cdmDatabaseLogin"/> </property> <property name="sessionLog"> <bean class="org.springframework.orm.toplink.support.CommonsLoggingSessionLog"/> </property> </bean>
This relates to the following line of Spring Code within LocalSessionFactory.Code:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [aquila/administrator/server/config/spring/commonContext.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: oracle.toplink.sessions.DatabaseSession.setLogin(Loracle/toplink/sessions/DatabaseLogin;)V java.lang.NoSuchMethodError: oracle.toplink.sessions.DatabaseSession.setLogin(Loracle/toplink/sessions/DatabaseLogin;)V at org.springframework.orm.toplink.LocalSessionFactory.createSessionFactory(LocalSessionFactory.java:268) at org.springframework.orm.toplink.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:52) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72) at org.springframework.test.AbstractSpringContextTests.loadContextLocations(AbstractSpringContextTests.java:121) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.loadContextLocations(AbstractDependencyInjectionSpringContextTests.java:161) at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:101) at org.springframework.test.AbstractDependencyInjectionSpringContextTests.setUp(AbstractDependencyInjectionSpringContextTests.java:129) at junit.framework.TestCase.runBare(TestCase.java:125) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Can anyone assist in diagnosing (probably an error on my part!) why the DatabaseSession Object returned does not conform to the Interface, and have an accessible setLogin method.Code:// Override default DatabaseLogin instance with specified one, if any. if (this.databaseLogin != null) { session.setLogin(this.databaseLogin); }
Many Thanks


Reply With Quote