Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Running batch samples in Oracle 10g

  1. #1
    Join Date
    Nov 2007
    Posts
    1

    Default Running batch samples in Oracle 10g

    Hi,

    I'm trying to run the sample jobs obtained from source at http://springframework.svn.sourcefor...g-batch/trunk/. Initially I downloaded the framework along with samples; Using maven and jdk 1.5 I was able to compile, run the associated tests with HSQLDB(default). I was still getting exceptions trying to update the in-memory database. Since I need to implement my application using Oracle 10g, I thought of using oracle to see how the samples work. I modified the following to point to oracle database.

    \samples\src\main\resources\batch.properties .
    \execution\src\main\resources\batch.template.prope rties
    \samples\src\main\resources\data-source-context-init.xml
    corrected the dialect in \samples\src\main\resources\hibernate-context.xml to point to oracle
    \execution\src\main\resources\schema-oracle10g.sql

    I am getting the exception listed below.
    HTML Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobLauncher' defined in class path resource [simple-container-definition.xml]: Cannot resolve reference to bean 'simpleJobRepository' while setting bean property 'jobRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleJobRepository' defined in class path resource [simple-container-definition.xml]: Cannot resolve reference to bean 'sqlJobDao' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlJobDao' defined in class path resource [simple-container-definition.xml]: Cannot resolve reference to bean 'jobIncrementer' while setting bean property 'jobIncrementer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobIncrementer' defined in class path resource [data-source-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'columnName' of bean class [org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer]: No property 'columnName' found
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:274)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1274)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1042)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:296)
    	at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:950)
    	at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:711)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:366)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
    	at org.springframework.batch.sample.AbstractBatchLauncherTests.createApplicationContext(AbstractBatchLauncherTests.java:53)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:212)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:187)
    	at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:140)
    	at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:100)
    	at junit.framework.TestCase.runBare(TestCase.java:132)
    	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
    	at junit.framework.TestResult$1.protect(TestResult.java:110)
    	at junit.framework.TestResult.runProtected(TestResult.java:128)
    	at junit.framework.TestResult.run(TestResult.java:113)
    	at junit.framework.TestCase.run(TestCase.java:124)
    	at junit.framework.TestSuite.runTest(TestSuite.java:232)
    	at junit.framework.TestSuite.run(TestSuite.java:227)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleJobRepository' defined in class path resource [simple-container-definition.xml]: Cannot resolve reference to bean 'sqlJobDao' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlJobDao' defined in class path resource [simple-container-definition.xml]: Cannot resolve reference to bean 'jobIncrementer' while setting bean property 'jobIncrementer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobIncrementer' defined in class path resource [data-source-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'columnName' of bean class [org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer]: No property 'columnName' found
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:274)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    	at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:447)
    	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:957)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:869)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:514)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:268)
    	... 33 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlJobDao' defined in class path resource [simple-container-definition.xml]: Cannot resolve reference to bean 'jobIncrementer' while setting bean property 'jobIncrementer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobIncrementer' defined in class path resource [data-source-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'columnName' of bean class 
    	... 47 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobIncrementer' defined in class path resource [data-source-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.InvalidPropertyException: Invalid property 'columnName' of bean class 
    	... 59 more
    Caused by: org.springframework.beans.InvalidPropertyException: Invalid property 'columnName' of bean class 
    	... 67 more
    Has anyone tried testing the samples in Oracle? Can you guide me on where the problem lies, or I have missed anything in the process? Couldn't find much help in the forum and the web, and hence this post.

    Thanks,
    -Mahesh

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    I'm guessing you set the batch.database.incrementer.class to something that doesn't work with Oracle. What are you using? One of the out-of-the-box incrementers might work (despite the fact that none is targeted at Oracle). You might have to write your own incrementer, or modify the data-source-context.xml (and the DDL) so that it uses an OracleSequenceMaxValueIncrementer. If you get it to work with OracleSequenceMaxValueIncrementer we would be interested in a patch (via JIRA http://opensource.atlassian.com/proj...owse/BATCH-240). I'm sure someone else must be using Oracle, but most of the folks I know using Spring Batch in anger seem to be on DB2 for some reason.

    I would also be interested to know what errors you were seeing with HSQLDB, as that is what we use in our CI build, so it definitely works for most people.

  3. #3
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    You should be able to just comment out the column name line in batch.properties, it's only there to support HSQLDB.

  4. #4
    Join Date
    Dec 2007
    Posts
    3

    Default UncategorizedSQLException

    I successfully run simpleTaskletJob in Oracle as well as in HSQL DB. But i got problem running tradeJob in Oracle, while it ran successfully in HSQL DB.
    I ran the above mentioned jobs through JUnit test cases and also through Job Launcher.

    Here is the exception i got when i tried to run tradeJob in oracle:

    Code:
    org.springframework.jdbc.UncategorizedSQLException: Executing query; uncategorized SQLException for SQL [SELECT id, quantity, price, customer from TRADE]; SQL state [null]; error code [17023]; Unsupported feature; nested exception is java.sql.SQLException: Unsupported feature
    Caused by: java.sql.SQLException: Unsupported feature
    	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    	at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:690)
    	at oracle.jdbc.driver.OracleConnection.createStatement(OracleConnection.java:3292)
    	at org.springframework.batch.io.cursor.JdbcCursorInputSource.executeQuery(JdbcCursorInputSource.java:324)
    	at org.springframework.batch.io.cursor.JdbcCursorInputSource.open(JdbcCursorInputSource.java:564)
    	at org.springframework.batch.io.cursor.JdbcCursorInputSource.read(JdbcCursorInputSource.java:203)
    	at org.springframework.batch.io.cursor.JdbcCursorInputSource$$FastClassByCGLIB$$762918c9.invoke(<generated>)
    	at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
    	at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:695)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
    	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:630)
    	at org.springframework.batch.io.cursor.JdbcCursorInputSource$$EnhancerByCGLIB$$7cd4e57c.read(<generated>)
    	at org.springframework.batch.item.provider.InputSourceItemProvider.next(InputSourceItemProvider.java:48)
    	at org.springframework.batch.execution.tasklet.ItemProviderProcessTasklet.execute(ItemProviderProcessTasklet.java:141)
    	at org.springframework.batch.execution.step.simple.SimpleStepExecutor.doTaskletProcessing(SimpleStepExecutor.java:372)

  5. #5
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    Are you also using Oracle 10g? The code that is throwing the error is trying to open a read_only cursor. Is the supported in your database?

  6. #6
    Join Date
    Dec 2007
    Posts
    3

    Default re:

    i am using oracle 9i.

  7. #7
    Join Date
    Dec 2007
    Posts
    9

    Default Oracle10g not working

    I have done the changes as mentioned in the above post. I still get the following error:

    java.lang.ClassCastException: java.lang.Long

  8. #8
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    What JVM version are you using? We target 1.4 (and above) with our distributed jars. If you compiled it yourself you can figure out how to make it compatible.

  9. #9
    Join Date
    Dec 2007
    Posts
    9

    Default Re:

    Hi Dave,
    I am using JDK1.5. The oracle jar, I used was not correct. Now its working fine.

  10. #10
    Join Date
    Dec 2007
    Posts
    9

    Default RestartFunctionalTest Error

    The RestartFunctionalTest when executed alongwith oracle as database, it inserts 7 rows i.e. it restart from the first data. Because of this, the unit test fails.

    Code:
    junit.framework.AssertionFailedError: expected:<5> but was:<7>
    	at junit.framework.Assert.fail(Assert.java:47)
    	at junit.framework.Assert.failNotEquals(Assert.java:280)
    	at junit.framework.Assert.assertEquals(Assert.java:64)
    	at junit.framework.Assert.assertEquals(Assert.java:198)
    	at junit.framework.Assert.assertEquals(Assert.java:204)
    	at org.springframework.batch.sample.RestartFunctionalTests.testRestart(RestartFunctionalTests.java:85)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at junit.framework.TestCase.runTest(TestCase.java:164)
    	at junit.framework.TestCase.runBare(TestCase.java:130)
    	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
    	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:120)
    	at junit.framework.TestSuite.runTest(TestSuite.java:230)
    	at junit.framework.TestSuite.run(TestSuite.java:225)
    	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    It works absolutely fine with hsqldb.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •