Problem lors de depoiement d'une application JEE
hoss
-
hoss -
hoss -
bonjour a tous,
j'arrive pas a déployer mon application chaque fois il me génère l'erreur suivant:
il dit qu'il n'arrive pas a trouver le chemin com.model.User et cette chemin bien existe dans mon projet donc je n'ai pas compris d'où vient cette erreur
aidez moi svp.
merci d'avance
j'arrive pas a déployer mon application chaque fois il me génère l'erreur suivant:
GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.lang.Class[]' for property 'annotatedClasses'; nested exception is java.lang.IllegalArgumentException: Cannot find class [com.model.User] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:717) Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.lang.Class[]' for property 'annotatedClasses'; nested exception is java.lang.IllegalArgumentException: Cannot find class [com.model.User] at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:490) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ... 21 more Caused by: java.lang.IllegalArgumentException: Cannot find class [com.model.User] at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:294) at org.springframework.beans.propertyeditors.ClassEditor.setAsText(ClassEditor.java:63) at org.springframework.beans.TypeConverterDelegate.doConvertTextValue(TypeConverterDelegate.java:434) at org.springframework.beans.TypeConverterDelegate.doConvertValue(TypeConverterDelegate.java:406) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:163) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:110) at org.springframework.beans.TypeConverterDelegate.convertToTypedArray(TypeConverterDelegate.java:445) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:175) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470) ... 27 more Caused by: java.lang.ClassNotFoundException: com.model.User at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558) at org.springframework.util.ClassUtils.forName(ClassUtils.java:258) at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:291) ... 35 more 11 mai 2014 12:13:40 com.sun.faces.config.ConfigureListener contextInitialized INFO: Initialisation de Mojarra 2.0.1 (FCS b02) pour le contexte '/ProjetMven' 11 mai 2014 12:13:40 com.sun.faces.spi.InjectionProviderFactory createInstance INFO: JSF1048 : Présence d''annotations PostConstruct/PreDestroy Les méthodes de beans gérés marquées avec ces annotations auront des annotations dites traitées. 11 mai 2014 12:13:41 org.primefaces.webapp.PostConstructApplicationEventListener processEvent INFO: Running on PrimeFaces 3.5 11 mai 2014 12:13:41 com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init> INFO: Monitoring jndi:/localhost/ProjetMven/WEB-INF/faces-config.xml for modifications 11 mai 2014 12:13:41 org.apache.catalina.core.StandardContext startInternal GRAVE: Error listenerStart 11 mai 2014 12:13:41 org.apache.catalina.core.StandardContext startInternal GRAVE: Erreur de démarrage du contexte [/ProjetMven] suite aux erreurs précédentes 11 mai 2014 12:13:41 org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext 11 mai 2014 12:13:41 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc GRAVE: The web application [/ProjetMven] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 11 mai 2014 12:13:41 org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-apr-8180"] 11 mai 2014 12:13:41 org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-apr-8109"] 11 mai 2014 12:13:41 org.apache.catalina.startup.Catalina start INFO: Server startup in 4636 ms
il dit qu'il n'arrive pas a trouver le chemin com.model.User et cette chemin bien existe dans mon projet donc je n'ai pas compris d'où vient cette erreur
aidez moi svp.
merci d'avance
A voir également:
- Problem lors de depoiement d'une application JEE
- Nommez une application d'appel vidéo ou de visioconférence - Guide
- Desinstaller une application sur windows - Guide
- Comment supprimer une application préinstallée sur android - Guide
- Windows application démarrage - Guide
- Application word et excel gratuit - Guide
3 réponses
est-ce qu'il est possible de voir ta class
com.model.User et ton fichier de conf applicationContext.xml?
ou sinon, il semble que tu veuilles caster un tableau []
en arraylist ce qui n'est pas permis.
com.model.User et ton fichier de conf applicationContext.xml?
ou sinon, il semble que tu veuilles caster un tableau []
en arraylist ce qui n'est pas permis.
bien sur ,
voici ma classe user:
package com.model;
// default package
// Generated 12 mai 2014 13:38:22 by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* User generated by hbm2java
*/
@Entity
@Table(name = "user", catalog = "fac_medecine")
public class User implements java.io.Serializable {
private Integer id;
private String login;
private String password;
public User() {
}
public User(String login, String password) {
this.login = login;
this.password = password;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "login", nullable = false, length = 50)
public String getLogin() {
return this.login;
}
public void setLogin(String login) {
this.login = login;
}
@Column(name = "password", nullable = false, length = 50)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
}
et voici fichier de config applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Data Source Declaration -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="url">
<value>jdbc:mysql://127.0.0.1:3306/projet?useUnicode=true&characterEncoding=UTF-8</value>
</property>
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value></value>
</property>
</bean>
<!-- Session Factory Declaration -->
<bean id="SessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.model.User</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
</bean>
<!-- Enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="txManager"/>
<!-- Transaction Manager is defined -->
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="SessionFactory"/>
</bean>
<!-- User Service Declaration -->
<bean id="indexService" class="com.service.IndexService">
<property name="indexDao" ref="indexDao" />
</bean>
<bean id="genericService" class="com.service.GenericService">
<property name="genericDao" ref="genericDao" />
</bean>
<!-- User DAO Declaration -->
<bean id="indexDao" class="com.dao.IndexDao">
<property name="sessionFactory" ref="SessionFactory"/>
</bean>
<bean id="genericDao" class="com.dao.GenericDao">
<property name="sessionFactory" ref="SessionFactory" />
</bean>
</beans>
et encore ceci ma classe bean
package com.bean;
import java.util.ArrayList;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.primefaces.component.datatable.DataTable;
import com.model.User;
import com.service.IGenericService;
import com.service.IIndexService;
import com.utils.ClassUtils;
@ManagedBean(name="userBean")
@SessionScoped
public class UserBean {
@ManagedProperty(value="#{genericService}")
IGenericService genericService;
//private List<User> users=new ArrayList<User>();
private DataTable usersTable;
private User user = new User();
private User addUser = new User();
private boolean connected = false;
private List<User> filteredCars;
@ManagedProperty(value="#{indexService}")
IIndexService indexService;
public String connect(){
// ClassUtils classUtils=new ClassUtils();
System.out.println(user.getLogin());
user.setPassword(ClassUtils.getEncodedPassword(user.getPassword()));
System.out.println(user.getPassword());
user = indexService.connect(user);
if(user!=null){
connected = true;
user.setPassword(null);
return ClassUtils.CONNECT;
}
else{
ClassUtils.messageError(FacesMessage.SEVERITY_INFO,"Error connexion!","",null);
user=new User();
return null;
}
}
/*
// pour affichier la liste des users
public String displayUsers() {
System.out.print("dans display users");
List<Object> objects = genericService.getAllObject(User.class);
users = new ArrayList<User>();
for(Object o : objects){
users.add((User) o);
}
//zoneDisplayBooks = true
return ClassUtils.LISTEUSERS;
}
//pour ajouter un user
public void saveUser(ActionEvent actionEvent){
if(addUser.getId()==0)
genericService.saveObject(addUser);
else
genericService.updateObject(addUser);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Utilisateur Bien Ajouter"));
addUser=new User();
//return null;
}
//action de navigation
public String ajoutMembre(){
System.out.print("voila");
return ClassUtils.AJOUTERMEMBRE;
}
public String listeUsers(){
System.out.print("voila");
return ClassUtils.LISTEUSERS;
}
public void test(){
System.out.print("test Action listenaire");
}
//edit popop pour la modification
public void editEvent(int id) {
user=(User) genericService.getObject(User.class,id);
}
//pour la mise a jour
public void edition(ActionEvent e){
genericService.updateObject(user);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Utilisateur mise à jour"));
int i=0;
for (User s : users) {
if (s.getId()==user.getId())
break;
i++;
}
users.set(i, user);
}
//pour la suppression
public void delet(User o) {
genericService.deleteObject(o);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Utilisateur Supprimer"));
int i=0;
for (User s : users) {
if (s.getId()==user.getId())
break;
i++;
}
users.remove(i);
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public void setIndexService(IIndexService indexService) {
this.indexService = indexService;
}
public boolean isConnected() {
return connected;
}
public void setConnected(boolean connected) {
this.connected = connected;
}
public IIndexService getIndexService() {
return indexService;
}
public IGenericService getGenericService() {
return genericService;
}
public void setGenericService(IGenericService genericService) {
this.genericService = genericService;
}
public User getAddUser() {
return addUser;
}
public void setAddUser(User addUser) {
this.addUser = addUser;
}
public List<User> getUsers() {
System.out.print("dans get users");
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
public DataTable getUsersTable() {
return usersTable;
}
public void setUsersTable(DataTable usersTable) {
this.usersTable = usersTable;
}
public List<User> getFilteredCars() {
this.displayUsers();
return filteredCars;
}
public void setFilteredCars(List<User> filteredCars) {
this.filteredCars = filteredCars;
}
*/
}
voici ma classe user:
package com.model;
// default package
// Generated 12 mai 2014 13:38:22 by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* User generated by hbm2java
*/
@Entity
@Table(name = "user", catalog = "fac_medecine")
public class User implements java.io.Serializable {
private Integer id;
private String login;
private String password;
public User() {
}
public User(String login, String password) {
this.login = login;
this.password = password;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "Id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "login", nullable = false, length = 50)
public String getLogin() {
return this.login;
}
public void setLogin(String login) {
this.login = login;
}
@Column(name = "password", nullable = false, length = 50)
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
}
et voici fichier de config applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- Data Source Declaration -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="url">
<value>jdbc:mysql://127.0.0.1:3306/projet?useUnicode=true&characterEncoding=UTF-8</value>
</property>
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value></value>
</property>
</bean>
<!-- Session Factory Declaration -->
<bean id="SessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.model.User</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
</bean>
<!-- Enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="txManager"/>
<!-- Transaction Manager is defined -->
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="SessionFactory"/>
</bean>
<!-- User Service Declaration -->
<bean id="indexService" class="com.service.IndexService">
<property name="indexDao" ref="indexDao" />
</bean>
<bean id="genericService" class="com.service.GenericService">
<property name="genericDao" ref="genericDao" />
</bean>
<!-- User DAO Declaration -->
<bean id="indexDao" class="com.dao.IndexDao">
<property name="sessionFactory" ref="SessionFactory"/>
</bean>
<bean id="genericDao" class="com.dao.GenericDao">
<property name="sessionFactory" ref="SessionFactory" />
</bean>
</beans>
et encore ceci ma classe bean
package com.bean;
import java.util.ArrayList;
import java.util.List;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.primefaces.component.datatable.DataTable;
import com.model.User;
import com.service.IGenericService;
import com.service.IIndexService;
import com.utils.ClassUtils;
@ManagedBean(name="userBean")
@SessionScoped
public class UserBean {
@ManagedProperty(value="#{genericService}")
IGenericService genericService;
//private List<User> users=new ArrayList<User>();
private DataTable usersTable;
private User user = new User();
private User addUser = new User();
private boolean connected = false;
private List<User> filteredCars;
@ManagedProperty(value="#{indexService}")
IIndexService indexService;
public String connect(){
// ClassUtils classUtils=new ClassUtils();
System.out.println(user.getLogin());
user.setPassword(ClassUtils.getEncodedPassword(user.getPassword()));
System.out.println(user.getPassword());
user = indexService.connect(user);
if(user!=null){
connected = true;
user.setPassword(null);
return ClassUtils.CONNECT;
}
else{
ClassUtils.messageError(FacesMessage.SEVERITY_INFO,"Error connexion!","",null);
user=new User();
return null;
}
}
/*
// pour affichier la liste des users
public String displayUsers() {
System.out.print("dans display users");
List<Object> objects = genericService.getAllObject(User.class);
users = new ArrayList<User>();
for(Object o : objects){
users.add((User) o);
}
//zoneDisplayBooks = true
return ClassUtils.LISTEUSERS;
}
//pour ajouter un user
public void saveUser(ActionEvent actionEvent){
if(addUser.getId()==0)
genericService.saveObject(addUser);
else
genericService.updateObject(addUser);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Utilisateur Bien Ajouter"));
addUser=new User();
//return null;
}
//action de navigation
public String ajoutMembre(){
System.out.print("voila");
return ClassUtils.AJOUTERMEMBRE;
}
public String listeUsers(){
System.out.print("voila");
return ClassUtils.LISTEUSERS;
}
public void test(){
System.out.print("test Action listenaire");
}
//edit popop pour la modification
public void editEvent(int id) {
user=(User) genericService.getObject(User.class,id);
}
//pour la mise a jour
public void edition(ActionEvent e){
genericService.updateObject(user);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Utilisateur mise à jour"));
int i=0;
for (User s : users) {
if (s.getId()==user.getId())
break;
i++;
}
users.set(i, user);
}
//pour la suppression
public void delet(User o) {
genericService.deleteObject(o);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Utilisateur Supprimer"));
int i=0;
for (User s : users) {
if (s.getId()==user.getId())
break;
i++;
}
users.remove(i);
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public void setIndexService(IIndexService indexService) {
this.indexService = indexService;
}
public boolean isConnected() {
return connected;
}
public void setConnected(boolean connected) {
this.connected = connected;
}
public IIndexService getIndexService() {
return indexService;
}
public IGenericService getGenericService() {
return genericService;
}
public void setGenericService(IGenericService genericService) {
this.genericService = genericService;
}
public User getAddUser() {
return addUser;
}
public void setAddUser(User addUser) {
this.addUser = addUser;
}
public List<User> getUsers() {
System.out.print("dans get users");
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
public DataTable getUsersTable() {
return usersTable;
}
public void setUsersTable(DataTable usersTable) {
this.usersTable = usersTable;
}
public List<User> getFilteredCars() {
this.displayUsers();
return filteredCars;
}
public void setFilteredCars(List<User> filteredCars) {
this.filteredCars = filteredCars;
}
*/
}