java.lang.NullPointerException

Spring JIRA | Buelent Zeyben | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Based on the OOTB sqoop.xml definition on GitHub we are required to provide the jdbc.url, jdbc.username and jdbc.password as a parameter definition. {code} <bean id="sqoopTasklet" class="org.springframework.xd.sqoop.SqoopTasklet"> <property name="arguments"> <list> <value>${command}</value> <value>${args}</value> <value>jdbc.url=${url}</value> <value>jdbc.username=${username}</value> <value>jdbc.password=${password}</value> <value>fs.defaultFS=${fsUri}</value> ... {code} This is causing a problem if we define the the sqoop connection parameters within the args list. We are using the --password-file option in the args list and need to specify the connection info via the --connect option with the --username within the args list. Our Job definition is: {code} job create bdl_lookup --definition "bdl-load --command=import --args='--connect=jdbc:oracle:thin:@<hostName>:1821/<dbName> --username=<user> --password-file=/user/workspace/secure-files/gdw.password --table=MASTERDATA.W_LOOKUP_D --target-dir=/<targetFolder/lookup_d -m 1' " {code} This results to an deployment: {code} 2015-05-07 11:40:51,586 1.2.0.M1 INFO DeploymentSupervisor-0 zk.ZKJobDeploymentHandler - Deployment status for job 'bdl_lookup': DeploymentStatus{state=failed,error(s)=org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'sqoopTasklet' defined in class path resource [config/bdl-load.xml]: Could not resolve placeholder 'url' in string value "jdbc.url=${url}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'url' in string value "jdbc.url=${url}" {code} If we skip the jdbc connection info from the module.xml file, similar to: {code} <bean id="sqoopTasklet" class="org.springframework.xd.sqoop.SqoopTasklet"> <property name="arguments"> <list> <value>${command}</value> <value>${args}</value> <!-- Comment out jdbc info <value>jdbc.url=${url}</value> <value>jdbc.username=${username}</value> <value>jdbc.password=${password}</value> --> <value>fs.defaultFS=${fsUri}</value> ... {code} Custom module deploys fine but get a We get a NullPointerException in the container logs: {code} 2015-05-07 11:46:04,450 1.2.0.M1 ERROR inbound.job:bdl_lookup-redis:queue-inbound-channel-adapter1 step.AbstractStep - Encountered an error executing step sqoopTask in job bdl_lookup java.lang.NullPointerException at org.springframework.xd.sqoop.SqoopTasklet.createCommand(SqoopTasklet.java:91) at org.springframework.batch.step.tasklet.x.AbstractProcessBuilderTasklet.execute(AbstractProcessBuilderTasklet.java:107) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77) {code}

    Spring JIRA | 2 years ago | Buelent Zeyben
    java.lang.NullPointerException
  2. 0

    Based on the OOTB sqoop.xml definition on GitHub we are required to provide the jdbc.url, jdbc.username and jdbc.password as a parameter definition. {code} <bean id="sqoopTasklet" class="org.springframework.xd.sqoop.SqoopTasklet"> <property name="arguments"> <list> <value>${command}</value> <value>${args}</value> <value>jdbc.url=${url}</value> <value>jdbc.username=${username}</value> <value>jdbc.password=${password}</value> <value>fs.defaultFS=${fsUri}</value> ... {code} This is causing a problem if we define the the sqoop connection parameters within the args list. We are using the --password-file option in the args list and need to specify the connection info via the --connect option with the --username within the args list. Our Job definition is: {code} job create bdl_lookup --definition "bdl-load --command=import --args='--connect=jdbc:oracle:thin:@<hostName>:1821/<dbName> --username=<user> --password-file=/user/workspace/secure-files/gdw.password --table=MASTERDATA.W_LOOKUP_D --target-dir=/<targetFolder/lookup_d -m 1' " {code} This results to an deployment: {code} 2015-05-07 11:40:51,586 1.2.0.M1 INFO DeploymentSupervisor-0 zk.ZKJobDeploymentHandler - Deployment status for job 'bdl_lookup': DeploymentStatus{state=failed,error(s)=org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'sqoopTasklet' defined in class path resource [config/bdl-load.xml]: Could not resolve placeholder 'url' in string value "jdbc.url=${url}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'url' in string value "jdbc.url=${url}" {code} If we skip the jdbc connection info from the module.xml file, similar to: {code} <bean id="sqoopTasklet" class="org.springframework.xd.sqoop.SqoopTasklet"> <property name="arguments"> <list> <value>${command}</value> <value>${args}</value> <!-- Comment out jdbc info <value>jdbc.url=${url}</value> <value>jdbc.username=${username}</value> <value>jdbc.password=${password}</value> --> <value>fs.defaultFS=${fsUri}</value> ... {code} Custom module deploys fine but get a We get a NullPointerException in the container logs: {code} 2015-05-07 11:46:04,450 1.2.0.M1 ERROR inbound.job:bdl_lookup-redis:queue-inbound-channel-adapter1 step.AbstractStep - Encountered an error executing step sqoopTask in job bdl_lookup java.lang.NullPointerException at org.springframework.xd.sqoop.SqoopTasklet.createCommand(SqoopTasklet.java:91) at org.springframework.batch.step.tasklet.x.AbstractProcessBuilderTasklet.execute(AbstractProcessBuilderTasklet.java:107) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77) {code}

    Spring JIRA | 2 years ago | Buelent Zeyben
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.xd.sqoop.SqoopTasklet.createCommand()
    2. org.springframework.xd
      SqoopTasklet.createCommand
      1. org.springframework.xd.sqoop.SqoopTasklet.createCommand(SqoopTasklet.java:91)
      1 frame
    3. org.springframework.batch
      AbstractProcessBuilderTasklet.execute
      1. org.springframework.batch.step.tasklet.x.AbstractProcessBuilderTasklet.execute(AbstractProcessBuilderTasklet.java:107)
      1 frame
    4. Spring Batch Core
      TaskletStep$ChunkTransactionCallback.doInTransaction
      1. org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
      2. org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
      2 frames
    5. Spring Tx
      TransactionTemplate.execute
      1. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      1 frame
    6. Spring Batch Core
      StepContextRepeatCallback.doInIteration
      1. org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
      2. org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77)
      2 frames