IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

Spring Batch, le launcher renvoie null


Sujet :

Spring Java

  1. #1
    Membre du Club
    Homme Profil pro
    Chef de projet NTIC
    Inscrit en
    Janvier 2012
    Messages
    70
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Chef de projet NTIC
    Secteur : Enseignement

    Informations forums :
    Inscription : Janvier 2012
    Messages : 70
    Points : 67
    Points
    67
    Par défaut Spring Batch, le launcher renvoie null
    Bonjour,

    J'essaye d’intégrer Spring batch dans un projet client, qui repose sur spring boot, spring security, mvc et jpa pour la persistance, par contre j'y arrive toujours pas,
    Mon code est comme ceci :
    la classe de configuration de spring batch

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
     
    import java.util.Date;
    import java.util.HashMap;
    import java.util.Map;
     
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
     
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.batch.core.Job;
    import org.springframework.batch.core.JobParameter;
    import org.springframework.batch.core.JobParameters;
    import org.springframework.batch.core.Step;
    import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
    import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
    import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
    import org.springframework.batch.core.explore.JobExplorer;
    import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
    import org.springframework.batch.core.job.SimpleJob;
    import org.springframework.batch.core.launch.JobLauncher;
    import org.springframework.batch.core.launch.support.RunIdIncrementer;
    import org.springframework.batch.core.launch.support.SimpleJobLauncher;
    import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
    import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
    import org.springframework.batch.core.repository.JobRepository;
    import org.springframework.batch.core.repository.JobRestartException;
    import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.springframework.context.annotation.DependsOn;
    import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
    import org.springframework.core.env.Environment;
    import org.springframework.scheduling.annotation.EnableScheduling;
    import org.springframework.transaction.PlatformTransactionManager;
    import org.springframework.transaction.jta.WebSphereUowTransactionManager;
     
    import fr.cc.suivireco.productionmanagement.dataaccess.api.OrganismeEntity;
     
    @Configuration
    @EnableBatchProcessing
    @EnableScheduling
    public class BatchConfiguratioOrganisme implements InfrastructureConfiguration {
     
      private Logger logger = LoggerFactory.getLogger(BatchConfiguratioOrganisme.class);
     
      @Autowired
      public JobBuilderFactory jobBuilderFactory;
     
      @Autowired
      public StepBuilderFactory stepBuilderFactory;
     
      @Autowired
      private Environment env;
     
      private SimpleJobLauncher jobLauncher;
     
      private JobExplorerFactoryBean jobExplorer;
     
      public DataSource dataSource() {
     
        try {
          InitialContext initialContext = new InitialContext();
          return (DataSource) initialContext.lookup(this.env.getProperty("datasource.jndi"));
        } catch (NamingException e) {
          throw new RuntimeException("JNDI lookup failed.", e);
        }
      }
     
      @Bean
      public Job job() {
     
        return this.jobBuilderFactory.get("job").incrementer(new RunIdIncrementer()).flow(step1()).end().build();
      }
     
      @Bean
      public Step step1() {
     
        return this.stepBuilderFactory.get("step1").<OrganismeCsv, OrganismeEntity> chunk(5).reader(new Reader())
            .processor(new Processor()).writer(new Writer().jdbcBatchItemWriter()).build();
      }
     
      @Bean
      public static PropertySourcesPlaceholderConfigurer placeHolderConfigurer() {
     
        return new PropertySourcesPlaceholderConfigurer();
      }
     
      /**
       * {@inheritDoc}
       */
      @Bean
      public JobRepository getJobRepository() throws Exception {
     
        JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
        factory.setDataSource(dataSource());
        factory.setTransactionManager(getTransactionManager());
        factory.afterPropertiesSet();
        return factory.getObject();
      }
     
      /**
       * {@inheritDoc}
       */
      public PlatformTransactionManager getTransactionManager() throws Exception {
     
        return new WebSphereUowTransactionManager();
      }
     
      @Bean
      public JobLauncher getJobLauncher() throws Exception {
     
        SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
        jobLauncher.setJobRepository(getJobRepository());
        jobLauncher.afterPropertiesSet();
        return jobLauncher;
      }
     
      public void launch()
          throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, Exception {
     
        Job job = new SimpleJob("job");
        Map<String, JobParameter> parameters = new HashMap<String, JobParameter>();
        parameters.put("timestamp", new JobParameter(new Date().getTime()));
        JobParameters jobParameters = new JobParameters(parameters);
        // JobExecution firstExecution = getJobRepository().createJobExecution(job.getName(), jobParameters);
        getJobLauncher().run(job, jobParameters);
      }
     
      @Bean
      @DependsOn("dataSource")
      public JobExplorerFactoryBean jobExplorer() {
     
        this.jobExplorer = new JobExplorerFactoryBean();
        this.jobExplorer.setDataSource(dataSource());
        return this.jobExplorer;
      }
    }
    l'interface implémenté

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
     
     
    import javax.sql.DataSource;
     
    import org.springframework.context.annotation.Bean;
     
    /**
     * TODO rboughani This type ...
     *
     * @author rboughani
     */
    public interface InfrastructureConfiguration {
     
      @Bean
      public abstract DataSource dataSource();
     
    }
    Le controller de lancement du job
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
     
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.batch.core.Job;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.context.ApplicationContext;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;
     
    @RestController
    public class JobLauncherController {
     
      // @Autowired
      // JobLauncher jobLauncher;
     
      @Autowired
      Job jobs;
     
      @Autowired
      private ApplicationContext context;
     
      @RequestMapping("/launchjob")
      public String handle() throws Exception {
     
        Logger logger = LoggerFactory.getLogger(this.getClass());
        try {
          // JobParameters jobParameters =
          // new JobParametersBuilder().addLong("time", System.currentTimeMillis()).toJobParameters();
     
          BatchConfiguratioOrganisme batchConfiguratioOrganisme = new BatchConfiguratioOrganisme();
          batchConfiguratioOrganisme.launch();
     
          // ApplicationContext context = new ClassPathXmlApplicationContext("dispatcher-servlet.xml");
          // JobLauncher jobLauncher = (JobLauncher) this.context.getBean("getJobLauncher");
          // jobLauncher.run(this.jobs, jobParameters);
     
        } catch (Exception e) {
          logger.warn(e.getMessage());
        }
     
        return "Done";
      }
    }
    processeur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
     
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.batch.item.ItemProcessor;
    import org.springframework.transaction.annotation.Transactional;
     
    import fr.cc.suivireco.productionmanagement.dataaccess.api.OrganismeEntity;
     
    public class Processor implements ItemProcessor<OrganismeCsv, OrganismeEntity> {
     
      private static Logger logger = LoggerFactory.getLogger(Processor.class);
     
      @Override
      @Transactional
      public OrganismeEntity process(OrganismeCsv organismeCsv) throws Exception {
     
        OrganismeEntity organisme = new OrganismeEntity();
        organisme.setCRCAriane(organismeCsv.getOr_crc());
        organisme.setLibelle(organismeCsv.getOr_nom());
        organisme.setORIDAriane(organismeCsv.getOr_id());
        organisme.setDepartement(organismeCsv.getOr_dpt());
        organisme.setNatureJuridique(organismeCsv.getOr_nat());
     
        // if (organismeCsv.getOr_typ().contains(" "))
        // organisme.setTypeOrganismeId(organismeCsv.getOr_typ());
        // else
        // organisme.setTypeOrganismeId(null);
     
        organisme.setLoiNotre(Character.toChars(Integer.parseInt(organismeCsv.getOr_crc().toString()))[0]);
     
        logger.error("Convert orgnaisme {} +=| - |=+ {}", organisme.getLibelle(), organisme.getCRCAriane());
     
        return organisme;
      }
     
    }
    le lecteur
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
     
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    import org.springframework.batch.item.ExecutionContext;
    import org.springframework.batch.item.ItemReader;
    import org.springframework.batch.item.NonTransientResourceException;
    import org.springframework.batch.item.ParseException;
    import org.springframework.batch.item.UnexpectedInputException;
    import org.springframework.batch.item.file.FlatFileItemReader;
    import org.springframework.batch.item.file.mapping.DefaultLineMapper;
    import org.springframework.batch.item.file.mapping.FieldSetMapper;
    import org.springframework.batch.item.file.transform.DelimitedLineTokenizer;
    import org.springframework.batch.item.file.transform.FieldSet;
    import org.springframework.core.io.ClassPathResource;
     
    public class Reader implements ItemReader<OrganismeCsv> {
     
      private int count = 0;
     
      Logger logger = LoggerFactory.getLogger(this.getClass());
     
      @Override
      public OrganismeCsv read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
     
        FlatFileItemReader<OrganismeCsv> reader = new FlatFileItemReader<OrganismeCsv>();
        OrganismeCsv organismeCSV = new OrganismeCsv();
     
        reader.setResource(new ClassPathResource("organismesDelta2016-12-19.csv"));
        reader.setLineMapper(new DefaultLineMapper<OrganismeCsv>() {
          {
            setLineTokenizer(new DelimitedLineTokenizer() {
              {
                setNames(new String[] { "or_crc", "or_nom", "or_id", "or_dpt", "or_nat", "or_typ" });
                setDelimiter("||");
              }
            });
            setFieldSetMapper(new PlayerFieldSetMapper());
          }
        });
        reader.setLinesToSkip(1);
        reader.open(new ExecutionContext());
        organismeCSV = reader.read();
        reader.close();
        return organismeCSV;
      }
     
      public static class PlayerFieldSetMapper implements FieldSetMapper<OrganismeCsv> {
        public OrganismeCsv mapFieldSet(FieldSet fieldSet) {
     
          OrganismeCsv player = new OrganismeCsv();
     
          player.setOr_crc(Long.parseLong(fieldSet.readString(0)));
          player.setOr_nom(fieldSet.readString(1));
          player.setOr_id(Long.parseLong(fieldSet.readString(2)));
          player.setOr_dpt(Long.parseLong(fieldSet.readString(3)));
          player.setOr_nat(fieldSet.readString(4));
          player.setOr_typ(fieldSet.readString(5));
     
          return player;
        }
      }
     
    }
    le writer

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
     
    import org.springframework.batch.item.database.JpaItemWriter;
    import org.springframework.beans.factory.InitializingBean;
    import org.springframework.context.annotation.Bean;
     
    import fr.cc.suivireco.productionmanagement.dataaccess.api.OrganismeEntity;
     
    public class Writer extends JpaItemWriter<OrganismeEntity> implements InitializingBean {
     
      private static final String REQUEST_INSERT_PERSONNE =
          "insert into ORGANISME (ID,CRC_ARIANE,OR_ID_ARIANE,LIBELLE,NATURE_JURIDIQUE,DEPARTEMENT,LOI_NOTRE,ID_PRODUCTION,MODIFICATIONCOUNTER,TYPEORGANISME_ID) values (?,?,?,?,?,?,?,?,?,?)";
     
      public Writer() {
     
      }
     
      @Bean
      public JpaItemWriter<OrganismeEntity> jdbcBatchItemWriter() {
     
        // Instantiate to get the Entity Manager Factory
        BatchConfiguratioOrganisme batchConfiguratioOrganisme = new BatchConfiguratioOrganisme();
     
        JpaItemWriter<OrganismeEntity> itemWriter = new JpaItemWriter<OrganismeEntity>();
     
        // itemWriter.setEntityManagerFactory(batchConfiguratioOrganisme.getTransactionManager().getTransaction());
        return itemWriter;
      }
     
    }
    l'entite qui correcpond aux fichier csv

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
     
    public class OrganismeCsv {
     
      Long or_crc;
     
      String or_nom;
     
      Long or_id;
     
      Long or_dpt;
     
      String or_nat;
     
      String or_typ;
     
      /**
       * @return or_crc
       */
      public Long getOr_crc() {
     
        return this.or_crc;
      }
     
      /**
       * @param or_crc the or_crc to set
       */
      public void setOr_crc(Long or_crc) {
     
        this.or_crc = or_crc;
      }
     
      /**
       * @return or_nom
       */
      public String getOr_nom() {
     
        return this.or_nom;
      }
     
      /**
       * @param or_nom the or_nom to set
       */
      public void setOr_nom(String or_nom) {
     
        this.or_nom = or_nom;
      }
     
      /**
       * @return or_id
       */
      public Long getOr_id() {
     
        return this.or_id;
      }
     
      /**
       * @param or_id the or_id to set
       */
      public void setOr_id(Long or_id) {
     
        this.or_id = or_id;
      }
     
      /**
       * @return or_dpt
       */
      public Long getOr_dpt() {
     
        return this.or_dpt;
      }
     
      /**
       * @param or_dpt the or_dpt to set
       */
      public void setOr_dpt(Long or_dpt) {
     
        this.or_dpt = or_dpt;
      }
     
      /**
       * @return or_nat
       */
      public String getOr_nat() {
     
        return this.or_nat;
      }
     
      /**
       * @param or_nat the or_nat to set
       */
      public void setOr_nat(String or_nat) {
     
        this.or_nat = or_nat;
      }
     
      /**
       * @return or_typ
       */
      public String getOr_typ() {
     
        return this.or_typ;
      }
     
      /**
       * @param or_typ the or_typ to set
       */
      public void setOr_typ(String or_typ) {
     
        this.or_typ = or_typ;
      }
     
    }
    l'entité persistante

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
     
     
    /**
     * Ce type est l'entite permettant de gerer les donnees de referentiel
     *
     * @author gcartier
     */
    @Entity(name = "OrganismeEntity")
    @Table(name = "organisme")
    public class OrganismeEntity extends AbstractPersistenceEntity implements Organisme {
     
      private static final long serialVersionUID = 1L;
     
      private Long CRCAriane;
     
      private Long ORIDAriane;
     
      private String libelle;
     
      private String natureJuridique;
     
      private TypeOrganismeEntity typeOrganisme;
     
      private Long departement;
     
      private Character loiNotre;
     
      private String idProduction;
     
      /**
       * @return cRCAriane
       */
      @Column(name = "CRC_ARIANE")
      public Long getCRCAriane() {
     
        return this.CRCAriane;
      }
     
      /**
       * @param cRCAriane the cRCAriane to set
       */
     
      public void setCRCAriane(Long cRCAriane) {
     
        this.CRCAriane = cRCAriane;
      }
     
      /**
       * @return oRIDAriane
       */
      @Column(name = "OR_ID_ARIANE")
      public Long getORIDAriane() {
     
        return this.ORIDAriane;
      }
     
      /**
       * @param oRIDAriane the oRIDAriane to set
       */
     
      public void setORIDAriane(Long oRIDAriane) {
     
        this.ORIDAriane = oRIDAriane;
      }
     
      /**
       * @return libelle
       */
      @Column(name = "LIBELLE")
      public String getLibelle() {
     
        return this.libelle;
      }
     
      /**
       * @param libelle the libelle to set
       */
     
      public void setLibelle(String libelle) {
     
        this.libelle = libelle;
      }
     
      /**
       * @return natureJuridique
       */
      @Column(name = "NATURE_JURIDIQUE")
      public String getNatureJuridique() {
     
        return this.natureJuridique;
      }
     
      /**
       * @param natureJuridique the natureJuridique to set
       */
     
      public void setNatureJuridique(String natureJuridique) {
     
        this.natureJuridique = natureJuridique;
      }
     
      /**
       * @return type
       */
      @ManyToOne(fetch = FetchType.LAZY)
      public TypeOrganismeEntity getTypeOrganisme() {
     
        return this.typeOrganisme;
      }
     
      /**
       * @param type the type to set
       */
     
      public void setTypeOrganisme(TypeOrganismeEntity typeOrganisme) {
     
        this.typeOrganisme = typeOrganisme;
      }
     
      @Transient
      public Long getTypeOrganismeId() {
     
        if (this.typeOrganisme == null) {
          return null;
        }
        return this.typeOrganisme.getId();
      }
     
      /**
       * {@inheritDoc}
       */
      @Transient
      public void setTypeOrganismeId(Long typeorganismeId) {
     
        if (typeorganismeId == null) {
          this.typeOrganisme = null;
        } else {
          TypeOrganismeEntity typeOrganismeEntity = new TypeOrganismeEntity();
          typeOrganismeEntity.setId(typeorganismeId);
          this.typeOrganisme = typeOrganismeEntity;
        }
     
      }
     
      /**
       * @return departement
       */
      @Column(name = "DEPARTEMENT")
      public Long getDepartement() {
     
        return this.departement;
      }
     
      /**
       * @param departement the departement to set
       */
     
      public void setDepartement(Long departement) {
     
        this.departement = departement;
      }
     
      /**
       * @return loiNotre
       */
      @Column(name = "LOI_NOTRE")
      public Character getLoiNotre() {
     
        return this.loiNotre;
      }
     
      /**
       * @param loiNotre the loiNotre to set
       */
     
      public void setLoiNotre(Character loiNotre) {
     
        this.loiNotre = loiNotre;
      }
     
      /**
       * @return idProduction
       */
      @Column(name = "ID_PRODUCTION")
      public String getIdProduction() {
     
        return this.idProduction;
      }
     
      /**
       * @param idProduction the idProduction to set
       */
     
      public void setIdProduction(String idProduction) {
     
        this.idProduction = idProduction;
      }
     
    }
    le textes du fichier csv

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    or_crc||or_nom||or_id||or_dpt||or_nat||or_typ
    5||ASS ||6281||22||Association loi de 1913||Association
    5||AURAY||7381||56||EPL||communes
    Quand j’exécute le code, j’obtiens un null,
    quelqu'un peut il nous filer une idée ou une astuce pour balayer ça ?

    Merci à l'avance

  2. #2
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    Bonjour

    Si j'ai bien compris tu as des null dans ta base de données ?
    Est-ce que tu as des traces à nous fournir ? je n'en vois pas beaucoup dans le code fourni
    Là à part debugger cela va être difficile. Il faut mettre des logs dans les étapes importantes:
    - est-ce que ton fichier CSV est bien lu ?
    - est-ce qu'il est bien transformé en entité ?
    - est-ce que tu as autant de données null dans ta base que de ligne dans ton fichier ?

  3. #3
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    Bonjour<br><br>Si j'ai bien compris tu as des null dans ta base de données ? <br>Est-ce que tu as des traces à nous fournir ? je n'en vois pas beaucoup dans le code fourni<br>Là à part debugger cela va être difficile. Il faut mettre des logs dans les étapes importantes:<br>- est-ce que ton fichier CSV est bien lu ?<br>- est-ce qu'il est bien transformé en entité ?<br>- est-ce que tu as autant de données null dans ta base que de ligne dans ton fichier ?<br><br>

Discussions similaires

  1. Request.getParameter renvoie NULL
    Par the java lover dans le forum Servlets/JSP
    Réponses: 5
    Dernier message: 22/10/2006, 10h34
  2. [ppc] Malloc renvoie NULL !
    Par FamiDoo dans le forum C++
    Réponses: 4
    Dernier message: 18/08/2006, 10h01
  3. Operateur "new" renvoi NULL
    Par Demerzel_01 dans le forum C++
    Réponses: 25
    Dernier message: 07/07/2006, 09h43
  4. [SPL] Rewind() qui renvoie NULL
    Par fadeninev dans le forum Bibliothèques et frameworks
    Réponses: 6
    Dernier message: 06/06/2006, 15h44
  5. [JDBC]Un new qui renvoie null...
    Par Ditch dans le forum JDBC
    Réponses: 4
    Dernier message: 03/01/2005, 13h14

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo