0

I am getting this error while scheduling quartz. Schedular is starting but while creating a bean it is failed at data-source-context.xml file.

Do i need to declare any system variable with the value oracle for environment?

data-source-context.xml file

<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>oracle</value>
    </constructor-arg>
    </bean>
</list>
</property>
</bean>

Console:

Jan 2, 2013 4:06:00 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4a804a80: display name [org.springframework.context.support.ClassPathXmlApplicationContext@4a804a80]; startup date [Wed Jan 02 16:06:00 GMT+05:30 2013]; root of context hierarchy
Jan 2, 2013 4:06:00 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [DWH/DWH-config.xml]
Jan 2, 2013 4:06:00 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [global-config.xml]
Jan 2, 2013 4:06:00 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [data-source-context.xml]
Jan 2, 2013 4:06:00 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@4a804a80]: org.springframework.beans.factory.support.DefaultListableBeanFactory@24152415
Jan 2, 2013 4:06:00 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@24152415: defining beans [dataSource,sessionFactory,transactionManager,environment,overrideProperties,placeholderProperties,lobHandler,incrementerParent,tm,jobRegistryBeanPostProcessor,jobRegistry,jobRepository,mapJobInstanceDao,mapJobExecutionDao,mapStepExecutionDao,jdbcTemplate,jobLauncher,essJob,essStep,essSkipStep,backOff,customEditorConfigurer,DWHDailyJob,initTask,directory,reader,dbWriter,skiplis,exitTask,inpFile,clean,cleanUpTask,temp]; root of factory hierarchy
[DWHMJobDetail] Job Terminated in error:
**    org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'environment' defined in class path resource [data-source-context.xml]: Initialization of bean failed; nested exception is java.lang.NullPointerException    **
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:478)
    at 
Lucky
  • 16,787
  • 19
  • 117
  • 151
Kosuri Naresh
  • 103
  • 1
  • 2
  • 14

1 Answers1

0

It looks like you have not set environment in JVM. Specify your environment in JVM settings like

-DTEST.ENVIRONMENT=test
Avinash T.
  • 2,280
  • 2
  • 16
  • 23
  • thanks avinash. I have one more doubt. Please correct me if i am wrong..From the XML file, is the value for environment variable is either "environment" or "oracle"? Did there specified anything in xML file? As i am new to spring, i am not able to understand the environment bean in xml. Where to configure these varibles in RAD/eclipse. – Kosuri Naresh Jan 02 '13 at 13:38
  • Should i declare the environment variables in MyComputer-->properties-->Advanced-->ENV variables-->system variables ??? – Kosuri Naresh Jan 02 '13 at 13:51
  • In eclipse, Windows -> Preferences -> Tomcat/Mongrel -> JVM settings – Avinash T. Jan 02 '13 at 13:56