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

Maven Java Discussion :

Un batch (de création d'un fichier .csv) non exécuté


Sujet :

Maven Java

  1. #1
    Membre confirmé
    Avatar de geforce
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    1 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2010
    Messages : 1 055
    Points : 559
    Points
    559
    Par défaut Un batch (de création d'un fichier .csv) non exécuté
    Bonjour,

    le même code dans un projet simple (sur netBeans) marche très bien, donc je suppose que j'ai une dépendance qui manque ou que un projet simple ajoute quelque chose que je ne voix pas. ?

    bien sûr je me suis assurais que c'est le bon chemin (path) et que le persistance.xml soit bien.

    voilà le code :
    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
     
    package dz.elit.sirh.model.batchs;
     
    import au.com.bytecode.opencsv.CSVReader;
    import dz.elit.sirh.model.entity.ga.EventCarrierePre;
    import dz.elit.sirh.model.manager.ga.EventCarrierePreManagerImpl;
    import dz.elit.utlis.JpaUtil;
    import java.io.FileReader;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityTransaction;
     
    /**
     *
     * @author PC
     */
    public class EventCarrierePreBatch {
     
        static String currentDir = System.getProperty("user.dir");
        private static final String eventCarrierePre_FILE = currentDir + "\\src\\main\\java\\dz\\elit\\sirh\\model\\batchs\\csv\\eventCarrierePre.csv";
        private static final int CODEVT = 0;
        private static final int LIBEVT = 1;
     
        /**
         * @param args the command line arguments
         */
        public static void batch(String path, EntityManager em) {
            try {
                // TODO code application logic here
                CSVReader reader = new CSVReader(new FileReader(eventCarrierePre_FILE), ';');
                String[] nextLine;
     
                EventCarrierePreManagerImpl eventCarrierePreManagerImpl = new ExtendEventCarrierePreManagerImpl(em);
     
                int first = 0;
                while ((nextLine = reader.readNext()) != null) {
     
                    if (first > 0) {
                        EventCarrierePre eventCarrierePre = new EventCarrierePre();
    //                    eventCarrierePre.setId(Long.valueOf(first));
                        eventCarrierePre.setCodeEventPre(nextLine[CODEVT]);
                        eventCarrierePre.setLibelleEvent(nextLine[LIBEVT]);
     
                        eventCarrierePreManagerImpl.create(eventCarrierePre);
                    }
                    first++;
     
                }
            } catch (Exception ex) {
                Logger.getLogger(EventCarrierePreBatch.class.getName()).log(Level.SEVERE, null, ex);
            }
        }// TODO code application logic here
     
        public static void main(String[] args) {
     
            EntityManager em = null;
            EntityTransaction utx = null;
            System.out.println("---path :---- : " + eventCarrierePre_FILE);
            em = JpaUtil.getEntityManager("LOCAL_PU");
            utx = em.getTransaction();
            utx.begin();
     
            batch(eventCarrierePre_FILE, em);
            utx.commit();
     
     
        }
    }
    ce code utilise cette classe dans le mains pour récupérais le em locale

    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
     
    package dz.elit.utlis;
     
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.Persistence;
    /*
     * Class pour créer EM , EMF utlisée pour executer les requetes JPA sur
     * une classe Main
     */
     
    public final class JpaUtil {
     
        public static EntityManagerFactory getEmf() {
            return emf;
        }
        private static EntityManagerFactory emf;
     
     
     
        public static EntityManager getEntityManager(String persistUnitString) {
            emf = Persistence.createEntityManagerFactory(persistUnitString);
            return emf.createEntityManager();
        }
    }
    et voilà mon pom.xml de mon ejb (tout en signalement que tout le projet compile parfaitement)
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
        <artifactId>GestionClient</artifactId>
        <groupId>dz.elit.sirh</groupId>
        <version>1.0-SNAPSHOT</version>
      </parent>
     
        <groupId>dz.elit.sirh</groupId>
        <artifactId>GestionClient-ejb</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>ejb</packaging>
     
        <name>GestionClient-ejb</name>
     
        <properties>
            <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
        </properties>
     
        <dependencies>
            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>eclipselink</artifactId>
                <version>2.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
                <version>2.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>ApiGestionClient</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>net.sf.opencsv</groupId>
                <artifactId>opencsv</artifactId>
                <version>2.3</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>6.0</version>
                <scope>provided</scope>
            </dependency>
     
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.8.2</version>
                <scope>test</scope>
            </dependency>
     
        </dependencies>
     
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                        <compilerArguments>
                            <endorseddirs>${endorsed.dir}</endorseddirs>
                        </compilerArguments>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-ejb-plugin</artifactId>
                    <version>2.3</version>
                    <configuration>
                        <ejbVersion>3.1</ejbVersion>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.1</version>
                    <executions>
                        <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>copy</goal>
                            </goals>
                            <configuration>
                                <outputDirectory>${endorsed.dir}</outputDirectory>
                                <silent>true</silent>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>javax</groupId>
                                        <artifactId>javaee-endorsed-api</artifactId>
                                        <version>6.0</version>
                                        <type>jar</type>
                                    </artifactItem>
                                </artifactItems>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
        <repositories>
            <repository>
                <id>EclipseLink Repo</id>
                <name>EclipseLink Repository</name>
                <url>http://linorg.usp.br/eclipse/rt/eclipselink/maven.repo/</url>
            </repository>
            <repository>
                <url>http://ftp.ing.umu.se/mirror/eclipse/rt/eclipselink/maven.repo/</url>
                <id>eclipselink</id>
                <layout>default</layout>
                <name>Repository for library Library[eclipselink]</name>
            </repository>
        </repositories>
    </project>
    aussi voilà le résulta de l'exécution:
    run:
    ---all path :---- : C:\Users\ordinateur\Documents\NetBeansProjects\GestionClient\GestionClient-ejb\src\main\java\dz\elit\sirh\model\batchs\csv\eventCarrierePre.csv
    Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at dz.elit.utlis.JpaUtil.getEntityManager(JpaUtil.java:23)
    at dz.elit.sirh.model.batchs.EventCarrierePreBatch.main(EventCarrierePreBatch.java:64)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)
    merci

  2. #2
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    le J2EE 6.0 fournit par java.net n'est qu'une api, pas une implémentation complète, vous ne pouvez pas l'utiliser pour exécuter du code, juste pour le compiler. Recommandations trouvées sur d'autre site, remplacer par

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <dependency>
     <groupId>javax.servlet</groupId>
     <artifactId>servlet-api</artifactId>
     <version>2.5</version>
     <scope>provided</scope>
     </dependency>
     <dependency>
     <groupId>javax.servlet</groupId>
     <artifactId>servlet-api</artifactId>
     <version>2.5</version>
     <scope>provided</scope>
     </dependency>

    et éventuellement
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     <dependency>
     <groupId>javax.persistence</groupId>
     <artifactId>persistence-api</artifactId>
     <version>1.0</version>
     </dependency>

    Si tu utilise le J2EE dans les unit test, il te faudra aussi fournir des implémentation (en scope test)

    Voir http://www.developpez.net/forums/d87...aux-acces-ejb/

  3. #3
    Membre confirmé
    Avatar de geforce
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    1 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2010
    Messages : 1 055
    Points : 559
    Points
    559
    Par défaut
    Oui,

    C’est exactement ce que tu a dit.
    Mais pour l'implémentation de la classe persistance est la même chose.
    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
     
    package javax.persistence;
     
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.util.Map;
    import java.util.Set;
    import java.util.regex.Pattern;
    import javax.persistence.spi.PersistenceProvider;
     
    public class Persistence {
     
        public static String PERSISTENCE_PROVIDER;
        protected static final Set<PersistenceProvider> providers;
        private static final Pattern nonCommentPattern;
     
        public Persistence() {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName) {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        private static void findAllProviders() throws IOException {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        private static Set<String> providerNamesFromReader(BufferedReader reader) throws IOException {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
    }
    où je peut trouvés l'implémentation de cette classe

    merci

  4. #4
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    tu as glassfish qui fournis une implémentation utilisable, par exemple

  5. #5
    Membre confirmé
    Avatar de geforce
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    1 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2010
    Messages : 1 055
    Points : 559
    Points
    559
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    tu as glassfish qui fournis une implémentation utilisable, par exemple
    pour lancer ce banche je n’utilise pas glassfish, il y que la JVM et les lib (mais quel librairie utiliser persistance.class)

  6. #6
    Membre confirmé
    Avatar de geforce
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    1 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2010
    Messages : 1 055
    Points : 559
    Points
    559
    Par défaut
    voici le message d'erreur complet

    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
    cd C:\Users\ordinateur\Documents\NetBeansProjects\jug\GestionClient\GestionClient-ejb; "JAVA_HOME=C:\\Program Files (x86)\\Java\\jdk1.6.0_24" "\"C:\\NetBeans 7.0.1\\java\\maven\\bin\\mvn.bat\"" -Dexec.classpathScope=runtime "-Dexec.args=-classpath %classpath dz.elit.sirh.model.batchs.EventCarrierePreBatch" -Dexec.executable=java process-classes org.codehaus.mojo:exec-maven-plugin:1.2:exec
    Scanning for projects...
     
    ------------------------------------------------------------------------
    Building GestionClient-ejb 1.0-SNAPSHOT
    ------------------------------------------------------------------------
    Downloading: http://linorg.usp.br/eclipse/rt/eclipselink/maven.repo/dz/elit/sirh/ApiGestionClient/1.0-SNAPSHOT/maven-metadata.xml
     
     
    [dependency:copy]
     
    [resources:resources]
    Using 'UTF-8' encoding to copy filtered resources.
    Copying 2 resources
     
    [compiler:compile]
    Nothing to compile - all classes are up to date
     
    [exec:exec]
    ---path :---- : C:\Users\ordinateur\Documents\NetBeansProjects\jug\GestionClient\GestionClient-ejb\src\main\java\dz\elit\sirh\model\batchs\csv\eventCarrierePre.csvException in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    	at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    	at dz.elit.utlis.JpaUtil.getEntityManager(JpaUtil.java:23)
    	at dz.elit.sirh.model.batchs.EventCarrierePreBatch.main(EventCarrierePreBatch.java:59)
     
    ------------------------------------------------------------------------
    BUILD FAILURE
    ------------------------------------------------------------------------
    Total time: 4.259s
    Finished at: Fri Feb 17 00:01:24 GMT+01:00 2012
    Final Memory: 5M/15M
    ------------------------------------------------------------------------
    Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (default-cli) on project GestionClient-ejb: Command execution failed. Process exited with an error: 1(Exit value: 1) -> [Help 1]
     
    To see the full stack trace of the errors, re-run Maven with the -e switch.
    Re-run Maven using the -X switch to enable full debug logging.
     
    For more information about the errors and possible solutions, please read the following articles:
    [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    j'ai toujours pas de solution, il doit bien avoir une !!

  7. #7
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    Comme déja dit, utilisez une implémentation pour vos tests, par exemple celle de glassfish. Qu'avez vous essayé comme implémentation qui ne vous conviens pas?

  8. #8
    Membre confirmé
    Avatar de geforce
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    1 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2010
    Messages : 1 055
    Points : 559
    Points
    559
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    Comme déja dit, utilisez une implémentation pour vos tests, par exemple celle de glassfish. Qu'avez vous essayé comme implémentation qui ne vous conviens pas?
    bonjour,

    voilà la lib de glassefish qui implémente la persistance
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
            <dependency>
                <groupId>net.java.dev.glassfish</groupId>
                <artifactId>glassfish-persistence-api</artifactId>
                <version>b32g</version>
            </dependency>
    aussi le contenu de la classe persistance
    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
    package javax.persistence;
     
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.util.Map;
    import java.util.Set;
    import java.util.regex.Pattern;
    import javax.persistence.spi.PersistenceProvider;
     
    public class Persistence {
     
        public static String PERSISTENCE_PROVIDER;
        protected static Set<PersistenceProvider> providers;
        private static final Pattern nonCommentPattern;
     
        public Persistence() {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName) {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        private static void findAllProviders() throws IOException {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
     
        private static Set<String> providerNamesFromReader(BufferedReader reader) throws IOException {
            //compiled code
            throw new RuntimeException("Compiled Code");
        }
    }
    bref même problème

  9. #9
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    T'as bien retiré l'ancien jar des dépendances (y compris les dépedances héritées)?

  10. #10
    Membre confirmé
    Avatar de geforce
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    1 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2010
    Messages : 1 055
    Points : 559
    Points
    559
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    T'as bien retiré l'ancien jar des dépendances (y compris les dépedances héritées)?
    oui comme tu dit.

    voilà une capture
    Images attachées Images attachées  

  11. #11
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    le jar javaee est toujours là (en provided). En unit - test, il sera utilisé dans le classpath et si il passe avant glassfish, ce seront les classes java qui déclenchent des erreurs qui seront instanciées. Il faut completement le retirer.

  12. #12
    Membre confirmé
    Avatar de geforce
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    1 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2010
    Messages : 1 055
    Points : 559
    Points
    559
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    le jar javaee est toujours là (en provided). En unit - test, il sera utilisé dans le classpath et si il passe avant glassfish, ce seront les classes java qui déclenchent des erreurs qui seront instanciées. Il faut completement le retirer.
    j'ai un autre message que voilà :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    ---path-: C:\Users\ordinateur\Documents\NetBeansProjects\jug\GestionClient\GestionClient-ejb\src\main\java\dz\elit\model\batchs\csv\DataClient.csv
    Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named LOCAL_PU
    	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:65)
    	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
    	at dz.elit.utlis.JpaUtil.getEntityManager(JpaUtil.java:23)
    	at dz.elit.model.batchs.ClientBatch.main(ClientBatch.java:71)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)
    j'ai fait ce que tu ma dit voilà ce qui me reste comme lib :
    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
        <dependencies>
            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>eclipselink</artifactId>
                <version>2.2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>net.java.dev.glassfish</groupId>
                <artifactId>glassfish-persistence-api</artifactId>
                <version>b32g</version>
            </dependency>
            <dependency>
                <groupId>net.sf.opencsv</groupId>
                <artifactId>opencsv</artifactId>
                <version>2.3</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>ApiJava</artifactId>
                <version>${project.version}</version>
            </dependency>
     
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.8.2</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    je reste a votre disposition si d'autre idée ou solution

Discussions similaires

  1. Réponses: 6
    Dernier message: 08/03/2012, 01h30
  2. Création d'un fichier CSV à partir d'un dictionnaire
    Par jouclar dans le forum Général Python
    Réponses: 3
    Dernier message: 04/03/2012, 10h38
  3. création d'un fichier CSV et téléchargement
    Par ryu20 dans le forum Langage
    Réponses: 2
    Dernier message: 16/09/2011, 08h51
  4. Création d'un fichier CSV pour Excel
    Par soso78 dans le forum ASP.NET
    Réponses: 1
    Dernier message: 03/04/2008, 15h25
  5. Réponses: 1
    Dernier message: 20/10/2005, 10h32

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