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

JPA Java Discussion :

persistance JPA hibernate Mysql primefaces


Sujet :

JPA Java

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2013
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2013
    Messages : 4
    Par défaut persistance JPA hibernate Mysql primefaces
    Bonjour,
    Je rencontre un problème de persistance en JPA sous Glassfish :

    javax.persistence.TransactionRequiredException

    log Glassfish :

    NFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.

    INFO: Current wizard step:personal
    INFO: Next step:identifiant

    INFO: Current wizard step:identifiant
    INFO: Next step:address

    INFO: Current wizard step:address
    INFO: Next step:contact

    INFO: Current wizard step:contact
    INFO: Next step:confirm

    WARNING: PWC4011: Unable to set request character encoding to utf-8 from context /Zeitjager, because request parameters have already been read, or ServletRequest.getReader() has already been called
    INFO: EXCEPTION CLASS NAME: javax.persistence.TransactionRequiredException
    SEVERE: Réception de 'java.lang.NullPointerException' lors de l'invocation du listener d'action '#{adherentEntryEJB.save}' du composant 'j_idt84'
    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
     
    AdherentEntryEJB :
     
    package com.zeitjager.ejb;
     
    import java.util.logging.Level;
    import java.util.logging.Logger;
     
    import javax.ejb.Stateless;
    import javax.faces.application.FacesMessage;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.SessionScoped;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
     
    import org.primefaces.event.FlowEvent;
     
    import com.zeitjager.entity.AdherentEntry;
     
    @ManagedBean
    @SessionScoped
    @Stateless
    public class AdherentEntryEJB {
    	@PersistenceContext(unitName = "defaultPersistenceUnit")
    	private EntityManager em;
    	private AdherentEntry user = new AdherentEntry();
     
    	private boolean skip;
     
    	private static Logger logger = Logger.getLogger(AdherentEntryEJB.class.getName());
     
    	public AdherentEntry getUser() {
    		return user;
    	}
     
    	public void setUser(AdherentEntry user) {
    		this.user = user;
    	}
     
    	public void save(ActionEvent actionEvent) {
    		FacesMessage msg = new FacesMessage("Successful", "Welcome :" + user.getFirstname());
    		FacesContext.getCurrentInstance().addMessage(null, msg);		
    		//Persist user
    		this.saveAdherentEntry(user);
    	}
     
    	public boolean isSkip() {
    		return skip;
    	}
     
    	public void setSkip(boolean skip) {
    		this.skip = skip;
    	}
     
    	public String onFlowProcess(FlowEvent event) {
    		logger.info("Current wizard step:" + event.getOldStep());
    		logger.info("Next step:" + event.getNewStep());
     
    		if(skip) {
    			skip = false;	//reset in case user goes back
    			return "confirm";
    		}
    		else {
    			return event.getNewStep();
    		}
    	}
     
    	public AdherentEntry saveAdherentEntry(AdherentEntry adherentEntry) {
    		try {
    		     em.persist(adherentEntry);
    		     } catch (javax.persistence.PersistenceException ex) {
    		         System.out.println("EXCEPTION CLASS NAME: " + ex.getClass().getName().toString());
    		         System.out.println("THROWABLE CLASS NAME: " + ex.getCause().getClass().getName().toString());
    		                Throwable th = ex.getCause();
    		         System.out.println("THROWABLE INFO: " + th.getCause().toString());
    		         Logger.getLogger(AdherentEntryEJB.class
    		              .getName()).log(Level.INFO, "adherentEntry Controller "
    		                  + "persistence exception "
    		                      + "EXCEPTION STRING: {0}", ex.toString());
    		         Logger.getLogger(AdherentEntryEJB.class
    		              .getName()).log(Level.INFO, "adherentEntry Controller "
    		                  + "persistence exception "
    		                      + "THROWABLE MESSAGE: {0}", th.getMessage());
    		         Logger.getLogger(AdherentEntryEJB.class
    		              .getName()).log(Level.INFO, "AdherentEntryEJB Controller "
    		                  + "persistence exceptions "
    		                      + "THROWABLE STRING: {0}", th.toString());
    		     }
    		return saveAdherentEntry(adherentEntry);
     
    	}
    }
    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
     
    AdherentEntryBean :
     
    package com.zeitjager.controller;
     
    import javax.enterprise.context.RequestScoped;
    import javax.inject.Inject;
    import javax.inject.Named;
    import com.zeitjager.ejb.AdherentEntryEJB;
    import com.zeitjager.entity.AdherentEntry;
     
    @Named(value = "adherentEntryBean")
    @RequestScoped
    public class AdherentEntryBean {
    	@Inject
    	private AdherentEntryEJB adherentEntryEJB;
     
    	private AdherentEntry adherentEntry = new AdherentEntry();
    	/**
             * @return the adherentEntry
             */
    	public AdherentEntry getAdherentEntry() {
    		return adherentEntry;
    	}
    	public String saveBlogEntry() {
    		adherentEntryEJB.saveAdherentEntry(adherentEntry);
    		return "success";
    	}
     
    	/**
             * @param adherent
             *            the adherent to set
             */
    	public void setAdherentEntry(AdherentEntry adherentEntry) {
    		this.adherentEntry = adherentEntry;
    	}
    }
    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
     
    AdherentEntry :
     
    package com.zeitjager.entity;
     
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import org.hibernate.validator.Min;
    import org.hibernate.validator.NotEmpty;
    import org.hibernate.validator.Size;
    import javax.persistence.TableGenerator;
    import javax.persistence.SequenceGenerator;
    import javax.validation.constraints.Pattern;
     
    @Entity
    @TableGenerator(name = "Adherent", table = "adherententity")
    @SequenceGenerator(name = "Adherent_sequence")
    public class AdherentEntry {
     
    	@Id
    	@GeneratedValue(strategy = GenerationType.AUTO)
    	private long id;
     
    	@Size(min = 3, max = 20)
    	@Column(name = "Identifiant", nullable = false, columnDefinition = "char(20)")
    	private String identifiant;
     
    	@Size(min = 3, max = 20)
    	@Column(name = "Firstname", nullable = false, columnDefinition = "char(20)")
    	private String firstname;
     
    	@Size(min = 3, max = 20)
    	@Column(name = "Lastname", nullable = false, columnDefinition = "char(20)")
    	private String lastname;
     
    	@Min(18)
    	@Column(name = "Age", nullable = false, columnDefinition = "int(2)")
    	private String age;
     
    	@Size(min = 3, max = 20)
    	@Column(name = "Password", nullable = false, columnDefinition = "char(20)")
    	@NotEmpty
    	private String password;
     
    	@Size(min = 3, max = 80)
    	@Column(name = "Street", nullable = false, columnDefinition = "char(20)")
    	private String street;
     
    	@Pattern(regexp = "[0-9]{5}")
    	@Column(name = "PostalCode", nullable = false, columnDefinition = "int(5)")
    	private String postalCode;
     
    	@Size(min = 3, max = 20)
    	@Column(name = "City", nullable = false, columnDefinition = "char(20)")
    	private String city;
     
    	@Size(max = 30)
    	@Column(name = "Email", nullable = false, columnDefinition = "char(20)")
    	private String email;
     
    	@Pattern(regexp = "[0-9]{10}")
    	@Column(name = "Phone", nullable = false, columnDefinition = "char(10)")
    	private String phone;
     
    	@Size(min = 10, max = 200)
    	@Column(name = "Info", nullable = false, columnDefinition = "char(200)")
    	private String info;
     
    	public long getId() {
    		return id;
    	}
     
    	public void setIdentifiant(String identifiant) {
    		this.identifiant = identifiant;
    	}
     
    	public String getIdentifiant() {
    		return identifiant;
    	}
     
    	public void setFirstname(String firstname) {
    		this.firstname = firstname;
    	}
     
    	public String getFirstname() {
    		return firstname;
    	}
     
    	public void setLastname(String lastname) {
    		this.lastname = lastname;
    	}
     
    	public String getLastname() {
    		return lastname;
    	}
     
    	public void setAge(String age) {
    		this.age = age;
    	}
     
    	public String getAge() {
    		return age;
    	}
     
    	public void setPassword(String password) {
    		this.password = password;
    	}
     
    	public String getPassword() {
    		return password;
    	}
     
    	public void setStreet(String street) {
    		this.street = street;
    	}
     
    	public String getStreet() {
    		return street;
    	}
     
    	public void setPostalCode(String postalCode) {
    		this.postalCode = postalCode;
    	}
     
    	public String getPostalCode() {
    		return postalCode;
    	}
     
    	public void setCity(String city) {
    		this.city = city;
    	}
     
    	public String getCity() {
    		return city;
    	}
     
    	public void setEmail(String email) {
    		this.email = email;
    	}
     
    	public String getEmail() {
    		return email;
    	}
     
    	public void setPhone(String phone) {
    		this.phone = phone;
    	}
     
    	public String getPhone() {
    		return phone;
    	}
     
    	public void setInfo(String info) {
    		this.info = info;
    	}
     
    	public String getInfo() {
    		return info;
    	}
     
    	/**
             * @param id
             *            the id to set
             */
    	public void setId(long id) {
    		this.id = id;
    	}
    }
    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
     
    Adherent.xhtml :
     
    <?xml version="1.0" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    	xmlns:f="http://java.sun.com/jsf/core"
    	xmlns:h="http://java.sun.com/jsf/html"
    	xmlns:p="http://primefaces.org/ui"
    	xmlns:ui="http://java.sun.com/jsf/facelets"
    	xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
    	<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    	<title>Zeitjäger</title>
    	<link rel="stylesheet" type="text/css" href="css/style.css" />
    	<style type="text/css">
    .ui-widget,.ui-widget .ui-widget {
    	font-size: 100% !important;
    }
    </style>
     
    </h:head>
     
    <ui:composition template="/Decorator.xhtml">
    	<ui:define name="title">
    		<h:outputText value="#{msg.listTitle}" />
    	</ui:define>
    	<ui:define name="heading">
    		<h:outputText value="#{msg.listHeading}" />
    	</ui:define>
    	<ui:define name="body">
    		<h:form>
     
    			<p:growl id="growl" sticky="true" showDetail="true" />
     
    			<p:wizard widgetVar="wiz"
    				flowListener="#{adherentEntryEJB.onFlowProcess}">
     
    				<p:tab id="personal" title="#{msg.personnel}">
     
    					<p:panel header="#{msg.information}">
     
    						<h:messages errorClass="error" />
     
    						<h:panelGrid columns="2" columnClasses="label, value"
    							styleClass="grid">
    							<h:outputText value="#{msg.prenom}" />
    							<p:inputText required="true" label="Firstname"
    								value="#{adherentEntryEJB.user.firstname}" />
     
    							<h:outputText value="#{msg.nom}" />
    							<p:inputText required="true" label="Lastname"
    								value="#{adherentEntryEJB.user.lastname}" />
     
    							<h:outputText value="#{msg.age}" />
    							<p:inputText value="#{adherentEntryEJB.user.age}" />
     
    							<h:outputText value="#{msg.skiplast}" />
    							<h:selectBooleanCheckbox value="#{adherentEntryEJB.skip}" />
    						</h:panelGrid>
    					</p:panel>
    				</p:tab>
    				<p:tab id="identifiant" title="#{msg.identifiant}">
    					<p:panel header="Identifiant Details">
     
    						<h:messages errorClass="error" />
     
    						<h:panelGrid columns="2" columnClasses="label, value">
    							<h:outputText value="#{msg.identifiantsaisie}" />
    							<p:inputText
    								value="#{adherentEntryEJB.user.identifiant}" />
     
    							<h:outputText value="#{msg.password}" id="Password" />
    							<p:inputText value="#{adherentEntryEJB.user.password}" />
     
    							<h:outputText value="#{msg.skiplast}" />
    							<h:selectBooleanCheckbox value="#{adherentEntryEJB.skip}" />
    							<p:tooltip for="Password" value="#{msg.messageinfo}"
    								showEffect="fade" hideEffect="fade" />
    						</h:panelGrid>
    					</p:panel>
    				</p:tab>
    				<p:tab id="address" title="#{msg.Adresse}">
    					<p:panel header="#{msg.Adressedetail}">
     
    						<h:messages errorClass="error" />
     
    						<h:panelGrid columns="2" columnClasses="label, value">
    							<h:outputText value="#{msg.rue}" />
    							<p:inputText value="#{adherentEntryEJB.user.street}" />
     
    							<h:outputText value="#{msg.codepostal}" id="postalCode" />
    							<p:inputText
    								value="#{adherentEntryEJB.user.postalCode}" />
     
    							<h:outputText value="#{msg.ville}" />
    							<p:inputText value="#{adherentEntryEJB.user.city}" />
     
    							<h:outputText value="#{msg.skiplast}" />
    							<h:selectBooleanCheckbox value="#{adherentEntryEJB.skip}" />
    							<p:tooltip for="postalCode" value="#{msg.messagepostalCode}"
    								showEffect="fade" hideEffect="fade" />
     
    						</h:panelGrid>
    					</p:panel>
    				</p:tab>
     
    				<p:tab id="contact" title="#{msg.contact}">
    					<p:panel header="#{msg.contactinformation}">
     
    						<h:messages errorClass="error" />
     
    						<h:panelGrid columns="2" columnClasses="label, value">
    							<h:outputText value="#{msg.email}" />
     
    							<p:inputText id="email" required="true" label="email" size="40"
    								requiredMessage="#{msg.saisieemail}"
    								validatorMessage="#{msg.invalidsaisieemail}"
    								value="#{adherentEntryEJB.user.email}">
     
    								<f:validateRegex
    									pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$" />
     
    							</p:inputText>
    							<p:watermark for="email" value="#{msg.watermarkemail}" />
    							<p:message for="email" />
    							<h:outputText value="#{msg.phone}" />
    							<p:inputText value="#{adherentEntryEJB.user.phone}" />
     
    							<h:outputText value="#{msg.informationcomplementaire}" />
    							<p:inputText value="#{adherentEntryEJB.user.info}"
    								size="60" />
    						</h:panelGrid>
    					</p:panel>
    				</p:tab>
     
    				<p:tab id="confirm" title="#{msg.confirmation}">
    					<p:panel header="#{msg.confirmation}">
     
    						<h:panelGrid id="confirmation" columns="2">
    							<h:outputText value="#{msg.prenom}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.firstname}" />
     
    							<h:outputText value="#{msg.nom}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.lastname}" />
     
    							<h:outputText value="#{msg.age}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.age}" />
     
    							<h:outputText value="#{msg.identifiantsaisie}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.identifiant}" />
     
    							<h:outputText value="#{msg.password}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.password}" />
     
    							<h:outputText value="#{msg.rue}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.street}" />
     
    							<h:outputText value="#{msg.codepostal}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.postalCode}" />
     
    							<h:outputText value="#{msg.ville}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.city}" />
     
    							<h:outputText value="#{msg.email}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.email}" />
     
    							<h:outputText value="#{msg.phone}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.phone}" />
     
    							<h:outputText value="#{msg.informationcomplementaire}" />
    							<h:outputText styleClass="outputLabel"
    								value="#{adherentEntryEJB.user.info}" />
    						<h:commandButton value="#{msg.validation}"  actionListener="#{adherentEntryEJB.save}"/>
    						</h:panelGrid>
    					</p:panel>
    				</p:tab>
     
    			</p:wizard>
     
    		</h:form>
    	</ui:define>
    </ui:composition>
     
    </html>
    persistence:

    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
     
    <?xml version="1.0" ?>
    <persistence version="1.0"
    	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    	<persistence-unit name="defaultPersistenceUnit"
    		transaction-type="JTA">
    		<description>Zeitjager -Time's Hunter - Chasseur de temps</description>
    		<provider>org.hibernate.ejb.HibernatePersistence</provider>
    		<jta-data-source>zeitjager</jta-data-source>
    		<class>com.zeitjager.entity.AdherentEntry</class>
    		<class>com.zeitjager.entity.DocumentEntry</class>
    		<class>com.zeitjager.entity.EpavetrouveEntry</class>
    		<exclude-unlisted-classes>true</exclude-unlisted-classes>
    		<properties>
    			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
    			<property name="hibernate.hbm2ddl.auto" value="create"/>
    			<property name="hibernate.show.sql" value="true" />
    			<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
    			<property name="hibernate.connection.username" value="zeitjager"/>
    			<property name="hibernate.connection.password" value="zeitjager"/>
    			<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/zeitjager"/>
    			<property name="hibernate.default_catalog" value="Zeitjager"/>
    		</properties>
    	</persistence-unit>
    </persistence>
    Probléme :
    Au moment d'invoquer adherentEntryEJB.save je prends une exception INFO: EXCEPTION CLASS NAME: javax.persistence.TransactionRequiredException

    je ne vois pas pourquoi , si vous pouvez m'aider merci beaucoup à vous

  2. #2
    Membre chevronné Avatar de ruscov
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Mars 2007
    Messages
    347
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Belgique

    Informations professionnelles :
    Activité : Architecte de système d'information

    Informations forums :
    Inscription : Mars 2007
    Messages : 347
    Par défaut
    met les balises code stp!

  3. #3
    Membre actif Avatar de gloax29
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2002
    Messages
    55
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2002
    Messages : 55
    Par défaut
    pourquoi tu rappelle saveAdherentEntry de façon récursive dans ta méthode ?
    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
     
     
    public AdherentEntry saveAdherentEntry(AdherentEntry adherentEntry) {
    try {
    em.persist(adherentEntry);
    } catch (javax.persistence.PersistenceException ex) {
    System.out.println("EXCEPTION CLASS NAME: " + ex.getClass().getName().toString());
    System.out.println("THROWABLE CLASS NAME: " + ex.getCause().getClass().getName().toString());
    Throwable th = ex.getCause();
    System.out.println("THROWABLE INFO: " + th.getCause().toString());
    Logger.getLogger(AdherentEntryEJB.class
    .getName()).log(Level.INFO, "adherentEntry Controller "
    + "persistence exception "
    + "EXCEPTION STRING: {0}", ex.toString());
    Logger.getLogger(AdherentEntryEJB.class
    .getName()).log(Level.INFO, "adherentEntry Controller "
    + "persistence exception "
    + "THROWABLE MESSAGE: {0}", th.getMessage());
    Logger.getLogger(AdherentEntryEJB.class
    .getName()).log(Level.INFO, "AdherentEntryEJB Controller "
    + "persistence exceptions "
    + "THROWABLE STRING: {0}", th.toString());
    }
    return saveAdherentEntry(adherentEntry);
     
    }
     
    // donc plutôt :
     
    public AdherentEntry saveAdherentEntry(AdherentEntry adherentEntry) {
    try {
    em.persist(adherentEntry);
    } catch (javax.persistence.PersistenceException ex) {
    System.out.println("EXCEPTION CLASS NAME: " + ex.getClass().getName().toString());
    System.out.println("THROWABLE CLASS NAME: " + ex.getCause().getClass().getName().toString());
    Throwable th = ex.getCause();
    System.out.println("THROWABLE INFO: " + th.getCause().toString());
    Logger.getLogger(AdherentEntryEJB.class
    .getName()).log(Level.INFO, "adherentEntry Controller "
    + "persistence exception "
    + "EXCEPTION STRING: {0}", ex.toString());
    Logger.getLogger(AdherentEntryEJB.class
    .getName()).log(Level.INFO, "adherentEntry Controller "
    + "persistence exception "
    + "THROWABLE MESSAGE: {0}", th.getMessage());
    Logger.getLogger(AdherentEntryEJB.class
    .getName()).log(Level.INFO, "AdherentEntryEJB Controller "
    + "persistence exceptions "
    + "THROWABLE STRING: {0}", th.toString());
    }
    return adherentEntry ;
     
    }

  4. #4
    Membre très actif Avatar de bruneltouopi
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

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

    Informations forums :
    Inscription : Janvier 2010
    Messages : 308
    Par défaut
    Ce code ne sert à rien vu que tu utilises JTA et que tu as déjà définie ces paramètres à travers ta datasource
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <property name="hibernate.connection.username" value="zeitjager"/>
    			<property name="hibernate.connection.password" value="zeitjager"/>
    			<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/zeitjager"/>
    			<property name="hibernate.default_catalog" value="Zeitjager"/>
    Ensuite pour ma part ce n'est pas une bonne pratique de mélanger un ManagedBean et une Session Bean en même temps
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    @ManagedBean
    @SessionScoped
    @Stateless
    public class AdherentEntryEJB
    Ensuite tu as une exception NullPointerException
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    SEVERE: Réception de 'java.lang.NullPointerException'
    Alors fais déjà un rectificatif puis tu peux signaler ce qui est null?

  5. #5
    Futur Membre du Club
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2013
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2013
    Messages : 4
    Par défaut JPA Persistence
    Merci à vous gloax29 et bruneltouopi ,

    J'ai fait la manip de gloax29 et j'ai supprimer dans le persistance les property superflus en revanche j'ai toujours le même problème et ne voit pas vraiment le probléme du null j'ai fait un print en mode debug , tout les champs sont alimentés au niveau de adherentEntry
    Images attachées Images attachées  

  6. #6
    Membre actif Avatar de gloax29
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2002
    Messages
    55
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2002
    Messages : 55
    Par défaut
    tu peut metre ton serveur en log DEBUG et nous montré les logs de la consol ou ce trouve le null?
    il parle de ta javax.persistence.TransactionRequiredException
    quelle version JPA? la 1.0

  7. #7
    Futur Membre du Club
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2013
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2013
    Messages : 4
    Par défaut java.lang.NullPointerException
    Bonsoir gloax29,
    Ci dessous la log du serveur Glassfish

    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
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
     
    15 mai 2013 22:17:27 com.sun.enterprise.admin.launcher.GFLauncherLogger info
    INFO: Successfully launched in 4*523 msec.
     
    INFO: Running GlassFish Version: GlassFish Server Open Source Edition 3.0.1 (build 22)
     
    INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
    INFO: Starting Grizzly Framework 1.9.18-o - Wed May 15 22:17:29 CEST 2013
    INFO: Grizzly Framework 1.9.18-o started in: 72ms listening on port 8080
    INFO: Grizzly Framework 1.9.18-o started in: 58ms listening on port 8181
    INFO: Grizzly Framework 1.9.18-o started in: 44ms listening on port 4848
    INFO: Starting Grizzly Framework 1.9.18-o - Wed May 15 22:17:29 CEST 2013
    INFO: Grizzly Framework 1.9.18-o started in: 26ms listening on port 3700
    INFO: Grizzly Framework 1.9.18-o started in: 7ms listening on port 7676
    INFO: The Admin Console is already installed, but not yet loaded.
    INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Felix(1831ms) startup services(511ms) total(2342ms)
     
    INFO: Binding RMI port to *:8686
    INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://Master-PC:8686/jndi/rmi://Master-PC:8686/jmxrmi
     
    INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
     
    INFO: SEC1002: Security Manager is OFF.
    INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
    INFO: Security startup service called
    INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.
    INFO: Realm admin-realm of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
    INFO: Realm file of classtype com.sun.enterprise.security.auth.realm.file.FileRealm successfully created.
    INFO: Realm certificate of classtype com.sun.enterprise.security.auth.realm.certificate.CertificateRealm successfully created.
    INFO: Security service(s) started successfully....
    INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfish3\glassfish\bin\glassfishv3\glassfish\modules\autostart, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\Master\AppData\Local\Temp\fileinstall-3857278027315846119, felix.fileinstall.filter = null}
    INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfish3\glassfish\bin\glassfishv3\glassfish\domains\domain1\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\Master\AppData\Local\Temp\fileinstall--948532615374133178, felix.fileinstall.filter = null}
    INFO: Started bundle: file:/C:/glassfish3/glassfish/bin/glassfishv3/glassfish/modules/autostart/org.apache.felix.scr.jar
     
    INFO: Created HTTP listener http-listener-1 on port 8080
    INFO: Created HTTP listener http-listener-2 on port 8181
    INFO: Created HTTP listener admin-listener on port 4848
    INFO: Created virtual server server
    INFO: Created virtual server __asadmin
    INFO: Created virtual server server
    INFO: Created virtual server __asadmin
    INFO: Virtual server server loaded system default web module
    INFO: Virtual server server loaded system default web module
     
    INFO: Virtual server server loaded system default web module
     
    INFO: Hibernate Validator bean-validator-3.0-JBoss-4.0.2
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
     
    INFO: Hibernate Annotations 3.5.0-Final
    INFO: Hibernate 3.5.0-Final
    INFO: hibernate.properties not found
    INFO: Bytecode provider name : javassist
    INFO: using JDK 1.4 java.sql.Timestamp handling
    INFO: Hibernate Commons Annotations 3.2.0.Final
    INFO: Hibernate EntityManager 3.5.0-Final
    INFO: Processing PersistenceUnitInfo [
    	name: defaultPersistenceUnit
    	...]
     
    INFO: Binding entity from annotated class: com.zeitjager.entity.AdherentEntry
    INFO: Bind entity com.zeitjager.entity.AdherentEntry on table AdherentEntry
    INFO: Binding entity from annotated class: com.zeitjager.entity.DocumentEntry
    INFO: Bind entity com.zeitjager.entity.DocumentEntry on table DocumentEntry
    INFO: Binding entity from annotated class: com.zeitjager.entity.EpavetrouveEntry
    INFO: Bind entity com.zeitjager.entity.EpavetrouveEntry on table EpavetrouveEntry
    INFO: Hibernate Validator 3.1.0.GA
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
    INFO: Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
    INFO: Using provided datasource
     
    INFO: Updating configuration from org.apache.felix.fileinstall-autodeploy-bundles.cfg
    INFO: Installed C:\glassfish3\glassfish\bin\glassfishv3\glassfish\modules\autostart\org.apache.felix.fileinstall-autodeploy-bundles.cfg
    INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfish3\glassfish\bin\glassfishv3\glassfish\domains\domain1\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\Master\AppData\Local\Temp\fileinstall--8062591167244442773, felix.fileinstall.filter = null}
    INFO: RDBMS: MySQL, version: 5.1.36-community-log
    INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.21 ( Revision: ${bzr.revision-id} )
    INFO: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
    INFO: Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
    INFO: instantiating TransactionManagerLookup: org.hibernate.transaction.SunONETransactionManagerLookup
    INFO: instantiated TransactionManagerLookup
    INFO: Automatic flush during beforeCompletion(): disabled
    INFO: Automatic session close at end of transaction: disabled
    INFO: JDBC batch size: 15
    INFO: JDBC batch updates for versioned data: disabled
    INFO: Scrollable result sets: enabled
    INFO: JDBC3 getGeneratedKeys(): enabled
    INFO: Connection release mode: auto
    INFO: Maximum outer join fetch depth: 2
    INFO: Default batch fetch size: 1
    INFO: Generate SQL with comments: disabled
    INFO: Order SQL updates by primary key: disabled
    INFO: Order SQL inserts for batching: disabled
    INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    INFO: Using ASTQueryTranslatorFactory
    INFO: Query language substitutions: {}
    INFO: JPA-QL strict compliance: enabled
    INFO: Second-level cache: enabled
    INFO: Query cache: disabled
    INFO: Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
    INFO: Optimize cache for minimal puts: disabled
    INFO: Structured second-level cache entries: disabled
    INFO: Statistics: disabled
    INFO: Deleted entity synthetic identifier rollback: disabled
    INFO: Default entity-mode: pojo
    INFO: Named query checking : enabled
    INFO: Check Nullability in Core (should be disabled when Bean Validation is on): disabled
    INFO: Hibernate Search 3.1.1.GA
     
    INFO: building session factory
    INFO: Not binding factory to JNDI, no JNDI name configured
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
    INFO: Running hbm2ddl schema export
    INFO: exporting generated schema to database
    SEVERE: Unsuccessful: create table AdherentEntry (id bigint not null auto_increment, Age int(2) not null check (Age>=18), City char(20) not null, Email char(20) not null, Firstname char(20) not null, Identifiant char(20) not null, Info char(200) not null, Lastname char(20) not null, Password char(20) not null, Phone char(10) not null, PostalCode int(5) not null, Street char(20) not null, primary key (id)) ENGINE=InnoDB
    SEVERE: Table 'adherententry' already exists
    SEVERE: Unsuccessful: create table DocumentEntry (id bigint not null auto_increment, document char(200) not null, information char(200) not null, typeDocument char(20) not null, primary key (id)) ENGINE=InnoDB
    SEVERE: Table 'documententry' already exists
    SEVERE: Unsuccessful: create table EpavetrouveEntry (id bigint not null auto_increment, anneeService char(50) not null, armementPresent char(50) not null, departement int(5) not null, escadron char(50) not null, etatAppareil char(50) not null, etatPieceZone char(50) not null, groupe char(50) not null, humainPresent char(50) not null, latitude char(50) not null, lieuGeographique char(50) not null, longitude char(50) not null, nationaliteAppareil char(50) not null, nationaliteEquipage char(50) not null, nbPieceZone char(50) not null, nbequipageActif char(50) not null, partageRecit char(50) not null, pays char(50) not null, recit char(50) not null, typeAppareil char(50) not null, typeMoteur char(50) not null, ville char(50) not null, primary key (id)) ENGINE=InnoDB
    SEVERE: Table 'epavetrouveentry' already exists
    INFO: schema export complete
    INFO: JNDI InitialContext properties:{}
     
    INFO: Portable JNDI names for EJB AdherentEntryEJB : [java:global/Zeitjager/AdherentEntryEJB, java:global/Zeitjager/AdherentEntryEJB!com.zeitjager.ejb.AdherentEntryEJB]
    INFO: Portable JNDI names for EJB DocumentEntryEJB : [java:global/Zeitjager/DocumentEntryEJB!com.zeitjager.ejb.DocumentEntryEJB, java:global/Zeitjager/DocumentEntryEJB]
    INFO: Portable JNDI names for EJB EpavetrouvetEntryEJB : [java:global/Zeitjager/EpavetrouvetEntryEJB!com.zeitjager.ejb.EpavetrouvetEntryEJB, java:global/Zeitjager/EpavetrouvetEntryEJB]
    INFO: WELD-000900 1.0.1 (SP3)
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
     
    INFO: Initialisation de Mojarra 2.0.2 (FCS b10) pour le contexte '/Zeitjager'
     
    WARNING: JSF1074 : Le bean géré nommé 'loginBean' a déjà été enregistré.  Remplacement du type de classe du bean géré existant org.zeitjager.domain.LoginBean par org.zeitjager.domain.LoginBean.
    WARNING: JSF1074 : Le bean géré nommé 'changeLocale' a déjà été enregistré.  Remplacement du type de classe du bean géré existant org.zeitjager.domain.ChangeLocale par org.zeitjager.domain.ChangeLocale.
     
    INFO: Running on PrimeFaces 3.5
    INFO: Loading application Zeitjager at /Zeitjager
    INFO: Loading application Zeitjager at /Zeitjager
    INFO: Loading application Zeitjager at /Zeitjager
    INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
     
    INFO: Zeitjager was successfully deployed in 20*679 milliseconds.
     
     
    INFO: Current wizard step:personal
    INFO: Next step:identifiant
     
    INFO: Current wizard step:identifiant
    INFO: Next step:address
     
    INFO: Current wizard step:address
    INFO: Next step:contact
     
    INFO: Current wizard step:contact
    INFO: Next step:confirm
     
    WARNING: PWC4011: Unable to set request character encoding to utf-8 from context /Zeitjager, because request parameters have already been read, or ServletRequest.getReader() has already been called
     
    INFO: EXCEPTION CLASS NAME: javax.persistence.TransactionRequiredException
     
    SEVERE: Réception de 'java.lang.NullPointerException' lors de l'invocation du listener d'action '#{adherentEntryEJB.save}' du composant 'j_idt84'
    SEVERE: java.lang.NullPointerException
    	at com.zeitjager.ejb.AdherentEntryEJB.saveAdherentEntry(AdherentEntryEJB.java:72)
    	at com.zeitjager.ejb.AdherentEntryEJB.save(AdherentEntryEJB.java:43)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
    	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
    	at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
    	at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:72)
    	at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
    	at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
    	at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    	at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:772)
    	at javax.faces.component.UICommand.broadcast(UICommand.java:300)
    	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
    	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
    	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
    	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
    	at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
    	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
    	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
    	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
    	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
    	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
    	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
    	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
    	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
    	at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
    	at java.lang.Thread.run(Thread.java:619)
     
    SEVERE: JSF1073 : javax.faces.event.AbortProcessingException intercepté durant le traitement de INVOKE_APPLICATION 5 : UIComponent-ClientId=formulaire:j_idt18:j_idt84, Message=/Adherent.xhtml @182,94 actionListener="#{adherentEntryEJB.save}": java.lang.NullPointerException
    SEVERE: /Adherent.xhtml @182,94 actionListener="#{adherentEntryEJB.save}": java.lang.NullPointerException
    javax.faces.event.AbortProcessingException: /Adherent.xhtml @182,94 actionListener="#{adherentEntryEJB.save}": java.lang.NullPointerException
    	at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:182)
    	at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    	at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:772)
    	at javax.faces.component.UICommand.broadcast(UICommand.java:300)
    	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
    	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
    	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    	at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
    	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
    	at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
    	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
    	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
    	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
    	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
    	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
    	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
    	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
    	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
    	at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.NullPointerException
    	at com.zeitjager.ejb.AdherentEntryEJB.saveAdherentEntry(AdherentEntryEJB.java:72)
    	at com.zeitjager.ejb.AdherentEntryEJB.save(AdherentEntryEJB.java:43)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
    	at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
    	at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:43)
    	at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:72)
    	at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
    	at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
    	... 38 more
    Pour la version JPA c'est 1.0 comme le montre le fichier joint
    Merci
    Images attachées Images attachées  

  8. #8
    Membre actif Avatar de gloax29
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2002
    Messages
    55
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2002
    Messages : 55
    Par défaut
    c'est ton em qui semble etre est null.
    dans ton glassfish, comment ta ressource JTA zeitjager est t'elle declaré?
    essai ca ;
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <jta-data-source>/zeitjager</jta-data-source>
    plutot que ca
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <jta-data-source>zeitjager</jta-data-source>

  9. #9
    Futur Membre du Club
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2013
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2013
    Messages : 4
    Par défaut not good
    j'ai fait la manip mais je prends une root exception :
    java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for '/zeitjager' in SerialContext [Root exception is javax.naming.NameNotFoundException: ]

    Je te propose de t'envoyer mon projet Zeitjager sur une adresse mail car là je ne peut pas te le transmettre , c'est un projet hibernate primefaces JPA Maven2 Glassfish ,là où sa déraille c'est dans connexion puis saisir n'importe quel identifiant mon de passe puis effectuer la saisie des différent onglet du wizard pour finir par la validation et le plantage , il faut juste définir sous glassfish le JNDI zeitjager avec un database zeitjager sous mysql
    Dans Glassfish admin définir un pool de connexion zeitjager je peux t’envoyer les hard copy d’écran pour la définition et là tu aura l'application web et le bug qui va bien , si cela te convient il me faut juste un boite pour déposer le zip, là je suis planté et je trouve pas
    Merci

  10. #10
    Membre actif Avatar de gloax29
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2002
    Messages
    55
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2002
    Messages : 55
    Par défaut
    OK

  11. #11
    Membre actif Avatar de gloax29
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2002
    Messages
    55
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2002
    Messages : 55
    Par défaut
    essai :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <jta-data-source>Zeitjager</jta-data-source>

  12. #12
    Membre très actif Avatar de bruneltouopi
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2010
    Messages
    308
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

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

    Informations forums :
    Inscription : Janvier 2010
    Messages : 308
    Par défaut
    SEVERE: java.lang.NullPointerException
    at com.zeitjager.ejb.AdherentEntryEJB.saveAdherentEntry(AdherentEntryEJB.java:72)
    Il parait que tu n'a pas de problème avec JNDI car tu as reussi à creer la database.J'espère que tu as enlevé les propriétés inutiles dans le fichier persistence.xml

    Mais bon à ce qui parait Soit ton EntityManager est null soit c'est ton entité AdherentEntryEJB.
    Il faut débugger pour voir.
    D'ailleurs à regarder ta stracktrace.Je voudrais savoir si c'est au déploiement ou bien lors de l'enregistrement de ton entité.Car là tu as tout balancer et on voit encore la trace du déploiement

Discussions similaires

  1. [Core] JPA/Hibernate/MySQL persistance données Excel (POI)
    Par high4life dans le forum Hibernate
    Réponses: 2
    Dernier message: 29/05/2012, 14h23
  2. JBoss + JPA + Hibernate + MySql
    Par Iori Yagami dans le forum Wildfly/JBoss
    Réponses: 4
    Dernier message: 17/11/2011, 09h36
  3. JPA Hibernate Index non crée dans Mysql
    Par fvisticot dans le forum JPA
    Réponses: 5
    Dernier message: 24/10/2010, 04h35
  4. erreur de persistence jpa/hibernate
    Par Jacobian dans le forum JPA
    Réponses: 6
    Dernier message: 08/01/2009, 17h28
  5. Réponses: 1
    Dernier message: 23/01/2008, 10h12

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