Announcement Announcement Module
Collapse
No announcement yet.
Toplink DataBaseLogin NoSuchMethod setLogin Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Toplink DataBaseLogin NoSuchMethod setLogin

    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:
    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>
    The exception raised is as follows:
    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)
    This relates to the following line of Spring Code within LocalSessionFactory.

    Code:
    // Override default DatabaseLogin instance with specified one, if any.
    	if (this.databaseLogin != null) {
    		session.setLogin(this.databaseLogin);
    	}
    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.

    Many Thanks

  • #2
    If the method is there then make sure it accepts the oracle/toplink/session/
    DatabaseLogin class as argument and that it has the needed visibility.

    Comment


    • #3
      Toplink DataBaseLogin NoSuchMethod setLogin

      Hi Costin,
      No source for the Toplink classes, but looking at JavaDoc etc. the class does have a setLogin Method

      public Abstract Interface oracle.toplink.sessions.DatabaseSession

      public Abstract void setLogin(Login arg)

      In LocalSessionFactory, setLogin is called with DatabaseLogin as the argument which extends DatasourceLogin and implements Login.

      Therefore, as far as I can see, the method is public, and the object being passed to it conforms to the required interface.

      Marc

      Comment


      • #4
        Are you using an older version of toplink that maybe doesn't has this method? I'm shooting in the dark but in my experience it was usually this the cause - older classes (different method/no method/different signature).

        Comment


        • #5
          Hi
          I've cross checked the versions of JavaDoc and JAR files, and reinstalled all to no effect.
          I'll keep on checking!!
          Marc

          Comment


          • #6
            You can also look at the sample from Spring distribution. AFAIK the petstore contains toplink code and for sure there is a similar configuration to yours.

            Comment


            • #7
              Toplink DataBaseLogin NoSuchMethod setLogin

              Hi
              Just for information.
              I have received a reply on Oracle Tech Net forum, stating that Toplink Spring integration code will be enhanced so that both 9.0.4 and 10.1.3 versions of this method will be supported.
              The Integration code could be recompiled against the 10.1.3 version of Toplink lin order to fix the problem.
              See http://forums.oracle.com/forums/thre...25672&#1125672 for full information.

              Many Thanks for all replies.
              Marc

              Comment


              • #8
                Excellent! I'll mark this thread with some stars - I'm sure it will help others in the future.

                Comment

                Working...
                X