Hi I am using simple job which reads from on database and write to another. I am not using any hibernate mapping to achieve this.
This is done through reader and writer.
Still I am getting following error
Here is my data-source-context.xml fileCode:ould not resolve placeholder 'batch.schema.script' in [${batch.schema.script}] as system property: java.lang.Error: getenv no longer supported, use properti es and -D instead: batch.schema.script Could not resolve placeholder 'batch.business.schema.script' in [${batch.business.schema.script}] as system property: java.lang.Error: getenv no longer suppo rted, use properties and -D instead: batch.business.schema.script 17:14:06,509 ERROR main JDBCExceptionReporter:78 - Cannot create PoolableConnectionFactory (Io exception: NL Exception was generated) 17:14:06,539 ERROR main CommandLineJobRunner:209 - Job Terminated in error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [data-source-context.x ml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Hibernate Dialect must be explicitly set at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:190) at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:252) Caused by: org.hibernate.HibernateException: Hibernate Dialect must be explicitly set at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57) at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39) at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:422) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334) ... 16 more
I am using BatchSqlUpdateItemWriterCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> <!-- Initialise the database before every test case: --> <import resource="data-source-context-init.xml" /> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${batch.jdbc.driver}" /> <property name="url" value="${batch.jdbc.url}" /> <property name="username" value="${batch.jdbc.user}" /> <property name="password" value="${batch.jdbc.password}" /> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="mappingLocations" value="classpath*:/*.hbm.xml" /> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" lazy-init="true"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- Set up or detect a System property called "environment" used to construct a properties file on the classpath. The default is "hsql". --> <bean id="environment" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetClass" value="java.lang.System" /> <property name="targetMethod" value="setProperty" /> <property name="arguments"> <list> <value>environment</value> <bean class="java.lang.System" factory-method="getProperty"> <constructor-arg> <value>environment</value> </constructor-arg> <!-- The default value of the environment property --> <constructor-arg> <!--<value>hsql</value> --> <value>oracle</value> </constructor-arg> </bean> </list> </property> </bean> <!-- Use this to set additional properties on beans at run time --> <bean id="overrideProperties" class="org.springframework.beans.factory.config.PropertyOverrideConfigurer" depends-on="environment"> <property name="location" value="classpath:batch-${environment}.properties" /> <!-- Allow system properties (-D) to override those from file --> <property name="localOverride" value="true" /> <property name="properties"> <bean class="java.lang.System" factory-method="getProperties" /> </property> <property name="ignoreInvalidKeys" value="true" /> <property name="order" value="2" /> </bean> <bean id="placeholderProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" depends-on="environment"> <property name="location" value="classpath:batch-${environment}.properties" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <property name="ignoreUnresolvablePlaceholders" value="true" /> <property name="order" value="1" /> </bean> <bean id="secureProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:batch-secure.properties" /> <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /> <property name="ignoreUnresolvablePlaceholders" value="true" /> <property name="order" value="3" /> </bean> <bean id="lobHandler" class="${batch.lob.handler.class}" /> <bean id="incrementerParent" class="${batch.database.incrementer.class}"> <property name="dataSource" ref="dataSource" /> <property name="incrementerName" value="ID" /> </bean> </beans>
Please let me know how to debug this issue. The job was running on normal environment. The problem occurred when we shifted to RAC environment.Code:batch.jdbc.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=orac2n1-vip.oasis.perf.cab.ims.intuit.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=orac2n2vip.oasis.perf.cab.ims.intuit.com)PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(Service_Name=OASIS_RAC)))


Reply With Quote