Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: NPE (launcher) on CommandLineJobRunner

  1. #11

    Default Continued (done with Hibernate stuff)

    Code:
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    INFO  HibernateTransactionManager - Using DataSource [org.apache.commons.dbcp.BasicDataSource@180b22e] of Hibernate SessionFactory for HibernateTransactionManager
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG DefaultListableBeanFactory - Creating instance of bean '(inner bean)' with merged definition [Root bean: class [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
    DEBUG NameMatchTransactionAttributeSource - Adding transactional method [create*] with attribute [PROPAGATION_REQUIRES_NEW,ISOLATION_SERIALIZABLE]
    DEBUG NameMatchTransactionAttributeSource - Adding transactional method[*] with attribute [PROPAGATION_REQUIRED,ISOLATION_DEFAULT]
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG AspectJAwareAdvisorAutoProxyCreator - Creating implicit proxy for bean 'jobRepository' with 0 common interceptors and 1 specific interceptors
    DEBUG JdkDynamicAopProxy - Creating JDK dynamic proxy: target source is SingletonTargetSource for target object [org.springframework.batch.core.repository.support.SimpleJobRepository@1e91a4d]
    INFO  SimpleJobLauncher - No TaskExecutor has been set, defaulting to synchronous executor.
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'jdbcTemplate'
    DEBUG DefaultListableBeanFactory - Creating instance of bean 'jdbcTemplate' with merged definition [Root bean: class [org.springframework.jdbc.core.JdbcTemplate]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=false; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [simple-job-launcher-context.xml]]
    DEBUG DefaultListableBeanFactory - Eagerly caching bean 'jdbcTemplate' to allow for resolving potential circular references

  2. #12

    Default Continued (this is probably the interesting bit)

    Code:
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'dataSource'
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'importGeneralLedger'
    DEBUG DefaultListableBeanFactory - Creating instance of bean 'importGeneralLedger' with merged definition [Root bean: class [org.springframework.batch.core.job.SimpleJob]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [psoft-importer-job.xml]]
    DEBUG DefaultListableBeanFactory - Eagerly caching bean 'importGeneralLedger' to allow for resolving potential circular references
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'jobRepository'
    DEBUG DefaultListableBeanFactory - Creating instance of bean 'step1' with merged definition [Root bean: class [org.springframework.batch.core.step.item.SimpleStepFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [psoft-importer-job.xml]]
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'transactionManager'
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'jobRepository'
    DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'simpleItemReader'
    DEBUG DefaultListableBeanFactory - Creating instance of bean 'simpleItemReader' with merged definition [Root bean: class [com.fsb.finance.integration.psoft.batch.SimpleItemReader]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [psoft-importer-job.xml]]
    DEBUG DefaultListableBeanFactory - Eagerly caching bean 'simpleItemReader' to allow for resolving potential circular references
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG DefaultListableBeanFactory - Creating shared instance of singleton bean 'simpleItemWriter'
    DEBUG DefaultListableBeanFactory - Creating instance of bean 'simpleItemWriter' with merged definition [Root bean: class [com.fsb.finance.integration.psoft.batch.SimpleItemWriter]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [psoft-importer-job.xml]]
    DEBUG DefaultListableBeanFactory - Eagerly caching bean 'simpleItemWriter' to allow for resolving potential circular references
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG ClassUtils - Class [edu.emory.mathcs.backport.java.util.concurrent.Semaphore] or one of its dependencies is not present: java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.Semaphore
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor'
    DEBUG ClassPathXmlApplicationContext - Publishing event in context [org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51]: org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51: display name [org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51]; startup date [Tue May 20 12:13:42 EDT 2008]; root of context hierarchy]
    DEBUG DefaultListableBeanFactory - Returning cached instance of singleton bean 'importGeneralLedger'

  3. #13

    Default Continued (here's the exception)

    Code:
    ERROR CommandLineJobRunner - Job Terminated in error:
    java.lang.NullPointerException
    	at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:199)
    	at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:248)
    INFO  ClassPathXmlApplicationContext - Closing org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51: display name [org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51]; startup date [Tue May 20 12:13:42 EDT 2008]; root of context hierarchy
    DEBUG ClassPathXmlApplicationContext - Publishing event in context [org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51]: org.springframework.context.event.ContextClosedEvent[source=org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51: display name [org.springframework.context.support.ClassPathXmlApplicationContext@7c4c51]; startup date [Tue May 20 12:13:42 EDT 2008]; root of context hierarchy]
    INFO  DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1aae94f: defining beans [dataSource,sessionFactory,transactionManager,jobRegistryBeanPostProcessor,jobLauncher,jobRegistry,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor,txAdvice,jobRepository,mapJobInstanceDao,mapJobExecutionDao,mapStepExecutionDao,jdbcTemplate,simpleJob,taskletStep,simpleStep,skipLimitStep,customEditorConfigurer,importGeneralLedger,simpleItemReader,simpleItemWriter]; root of factory hierarchy
    DEBUG DefaultListableBeanFactory - Retrieved dependent beans for bean 'sessionFactory': [transactionManager]
    DEBUG DefaultListableBeanFactory - Retrieved dependent beans for bean 'transactionManager': [txAdvice, step1]
    DEBUG DefaultListableBeanFactory - Retrieved dependent beans for bean 'step1': [importGeneralLedger]
    DEBUG DisposableBeanAdapter - Invoking destroy() on bean with name 'sessionFactory'
    INFO  LocalSessionFactoryBean - Closing Hibernate SessionFactory
    INFO  SessionFactoryImpl - closing
    DEBUG DisposableBeanAdapter - Invoking destroy() on bean with name 'jobRegistryBeanPostProcessor'

  4. #14

    Default That's it

    Whew. That took a bit longer than I thought! :^)

    It does seem like other beans are able to wire each other, just that jobLauncher cannot be found. I did notice that CommandLineJobRunner has setLauncher(JobRunner). I tried renaming jobLauncher in my config to launcher, but it still did not work.

    - Saish

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

    Default

    Very odd, through all those logs I didn't see it loading the bean for JobLauncher, it seemed to load the data source and stop....can you post the contents of the data-sources.xml configuration file?

    BTW, if you use code tags (like you did) you can post a huge trace without worry, since it will put a scroll bar on it.

  6. #16

    Default

    Thanks LucasWard. Here is the configuration for the data sources:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans 
    	xmlns="http://www.springframework.org/schema/beans" 
    	xmlns:aop="http://www.springframework.org/schema/aop"
    	xmlns:tx="http://www.springframework.org/schema/tx" 
    	xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
    		
    	
    	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
    		<property name="url" value="REDACTED" />
    		<property name="username" value="REDACTED" />
    		<property name="password" value="REDACTED" />
    	</bean>
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource" ref="dataSource" />
    		<property name="mappingLocations" value="classpath*:/*.hbm.xml" />
    		<property name="hibernateProperties">
    			<value>
    				<![CDATA[
    					hibernate.show_sql=true
    					hibernate.format_sql=true
    			]]>
    			</value>
    		</property>
    	</bean>
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" lazy-init="true">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    	
    </beans>
    The URI, user and password have been redacted, but I know they work. Thanks again.

    - Saish

  7. #17
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    Nevermind, I saw it on page one. It's creating the bean fine, but I don't see any log statements where it's trying to autowire.

  8. #18

    Default

    Do I need to configure auto-wiring to be enabled somewhere? I did not see that in any of the samples and cannot remember doing it with our standard Spring implementation.

    - Saish

  9. #19

    Default

    I do see the following ClassNotFound a few lines before the error. Not sure if that would affect anything, but the bean is, I think, being returned as a singleton, so I thought I would point it out:

    DEBUG ClassUtils - Class [edu.emory.mathcs.backport.java.util.concurrent.Sem aphore] or one of its dependencies is not present: java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.Sem aphore

  10. #20
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    I have no idea why it's doing this, but I found the following in the log:

    Code:
    DEBUG DefaultListableBeanFactory - Creating instance of bean 'jobLauncher' with merged definition [Root bean: class [org.springframework.batch.core.launch.support.SimpleJobLauncher]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=false; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [simple-job-launcher-context.xml]]
    DEBUG DefaultListableBeanFactory - Eagerly caching bean 'jobLauncher' to allow for resolving potential circular references
    Most of that doesn't matter, but the important part is that autowireCandidate=false. Can you explicitely set that to true in the bean? Just add 'autowire-candidate=true' do your bean definition for the launcher.

Posting Permissions

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