Olá pessoal!
Estou com um probleminha que não estou conseguindo resolver. De antemão, estou utilizando JSF 1.2, Tomcat 6.0, Hibernate 3.3.0, o MySQL 5.1 e o RichFaces 3.3.0. No meu projeto eu estou utlizando a JPA e o Hibernate Annotations 3.4.
Pronto, vamos ao problema. Eu tenho configurados um arquivo web.xml (como segue abaixo) e dentro dele eu tenho um Filter, chamado de HibernateSessionFilter (como segue abaixo também).
– [color=red]web.xml[/color]:
[code]<?xml version=“1.0” encoding=“UTF-8”?>
<web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns=“http://java.sun.com/xml/ns/javaee” xmlns:web=“http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” xsi:schemaLocation=“http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd” id=“WebApp_ID” version=“2.5”>
<display-name>Test</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<!-- Rich Faces -->
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>blueSky</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<!-- Filter Hibernate -->
<filter>
<filter-name>HibernateSessionFilter</filter-name>
<filter-class>##.###.######.#######.HibernateSessionFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>HibernateSessionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>[/code]
– [color=red]HibernateSessionFilter[/color] (fiz o comentário do HibernateUtil para poder testar pelo ManagedBean):
[code]package ##.###.######.#######.util;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class HibernateSessionFilter implements Filter {
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {
//HibernateUtil.openSession();
try{
//HibernateUtil.currentSession().beginTransaction();
filterChain.doFilter( request, response );
//HibernateUtil.currentSession().getTransaction().commit();
}catch (Exception e) {
throw new ServletException(e);
}finally{
//HibernateUtil.closeCurrentSession();
}
}
@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
}
[/code]
E dentro desse filtro eu faço uma chamada a uma outra classe chamada HibernateUtil, que segue abaixo.
– [color=red]HibernateUtil[/color]:
[code]package ##.###.######.#######.util;
import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
public class HibernateUtil {
private static Logger logger = Logger.getLogger(HibernateUtil.class);
private static SessionFactory sessionFactory;
private static ThreadLocal<Session> sessions = new ThreadLocal<Session>();
static{
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
}
public static Session openSession(){
if ( sessions.get() != null ) {
logger.error("There was a session for this thread already!!!");
//grave alguem não fechou uma ja aberta!
}
sessions.set( sessionFactory.openSession() );
return sessions.get();
}
public static void closeCurrentSession(){
sessions.get().close();
sessions.set( null );
}
public static Session currentSession(){
return sessions.get();
}
}
[/code]
Aí eu tenho o meu entity, chamado de Department (segue abaixo) e tenho o meu ManagedBean, chamado de DepartmentMB.
– [color=red]Department[/color]:
[code]package ##.###.######.#######.entity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Department implements Serializable {
private static final long serialVersionUID = -3457627102443272382L;
@Id
@GeneratedValue( strategy = GenerationType.AUTO )
private Long id;
@Column( unique = true, nullable = false, length = 50 )
private String description;
@Column( nullable = false )
private boolean status;
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the status
*/
public boolean isStatus() {
return status;
}
/**
* @param status the status to set
*/
public void setStatus(boolean status) {
this.status = status;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Department other = (Department) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
[/code]
– [color=red]DepartmentMB[/color]:
[code]package ##.###.######.#######.managedbeans;
import java.util.List;
import javax.faces.event.ActionEvent;
import org.hibernate.Session;
import ##.###.######.#######.dao.Dao;
import ##.###.######.#######.entity.Department;
import ##.###.######.#######.util.HibernateUtil;
public class DepartmentMB {
public Department department;
public DepartmentMB() {
department = new Department();
}
/**
* @return the department
*/
public Department getDepartment() {
return department;
}
/**
* @param department the department to set
*/
public void setDepartment(Department department) {
this.department = department;
}
public void save( ActionEvent event ) {
System.out.println( "Saving Department: " + department.getDescription() );
Session session = HibernateUtil.openSession();
HibernateUtil.currentSession().beginTransaction();
Dao<Department> departmentDao = new Dao<Department>( session, Department.class );
departmentDao.save( department );
HibernateUtil.currentSession().getTransaction().commit();
HibernateUtil.closeCurrentSession();
department = new Department();
}
public List<Department> getDepartments(){
System.out.println("Loading departments...");
Session session = HibernateUtil.openSession();
Dao<Department> dao = new Dao<Department>( session, Department.class );
return dao.list();
}
}
[/code]
Tenho, também, configurado o meu hibernate.cfg.xml e o meu faces-config.xml, que seguem abaixo.
– [color=red]hibernate.cfg.xml[/color]:
[code]<?xml version=‘1.0’ encoding=‘utf-8’?>
<!DOCTYPE hibernate-configuration PUBLIC
“-//Hibernate/Hibernate Configuration DTD 3.0//EN”
“http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”>
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/test?autoReconnect=true</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<!--<property name="hbm2ddl.auto">update</property>-->
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<!-- Configurando o c3p0 -->
<property name="c3p0.max_size">10</property>
<property name="c3p0.min_size">2</property>
<property name="c3p0.timeout">5000</property>
<property name="c3p0.max_statements">10</property>
<property name="c3p0.idle_test_period">3000</property>
<property name="c3p0.acquire_increment">2</property>
<!-- Configurando cache EhCache -->
<property name="hibernate.current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
<property name="cache.use_query_cache">true</property>
<!-- Configurando propriedades de debug -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="generate_statistics">true</property>
<property name="use_sql_comments">true</property>
<!-- Configurando as Classes -->
<mapping class="##.###.######.#######.entity.Department" />
</session-factory>
</hibernate-configuration>[/code]
– [color=red]faces-config.xml[/color]:
[code]<?xml version=“1.0” encoding=“UTF-8”?>
<faces-config version=“1.2” xmlns=“http://java.sun.com/xml/ns/javaee”
xmlns:xi=“http://www.w3.org/2001/XInclude”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd”>
<application>
<message-bundle>messages</message-bundle>
</application>
<managed-bean>
<managed-bean-name>departmentMB</managed-bean-name>
<managed-bean-class>##.###.######.#######.managedbeans.DepartmentMB</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>authenticator</managed-bean-name>
<managed-bean-class>##.###.######.#######.managedbeans.LoginHandler</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/login.jsp</from-view-id>
<navigation-case>
<from-outcome>sucesso</from-outcome>
<to-view-id>/department.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<navigation-case>
<from-outcome>logging</from-outcome>
<to-view-id>/login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<lifecycle>
<phase-listener>##.###.######.#######.listener.Authenticator</phase-listener>
</lifecycle>
</faces-config>[/code]
Aí eu criei uma classe para gerar o meu banco de dados a partir das anotações chamada de DatabaseGenerator.
– [color=red]DatabaseGenerator[/color]:
[code]/**
*
*/
package ##.###.######.#######.main;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class DatabaseGenerator {
/**
* @param args
*/
public static void main(String[] args) {
Configuration config = new AnnotationConfiguration();
config.configure();
SchemaExport se = new SchemaExport( config );
se.create( true, true );
}
}[/code]
E esta classe está funcionando perfeitamente. Consegui gerar uma tabela com o mesmo nome da entity.
E para testar a minha conexão com o banco de dados e as suas respectiva inserções e busca, eu criei uma classe chamada Stub. Executando esta classe, todas as informações funcionam, tanto a busca quanto a persistência.
– [color=red]Stub[/color]:
[code]package ##.###.######.#######.main;
import java.util.List;
import org.hibernate.Session;
import ##.###.######.#######.dao.Dao;
import ##.###.######.#######.entity.Department;
import ##.###.######.#######.managedbeans.DepartmentMB;
import ##.###.######.#######.util.HibernateUtil;
public class Stub {
/**
* @param args
*/
public static void main(String[] args) {
DepartmentMB depto = new DepartmentMB();
List<Department> listaDeptos = depto.getDepartments();
for (Department department : listaDeptos) {
System.out.println( department.getDescription() );
}
Department department = new Department();
department.setId( new Long( 2 ) );
department.setDescription( "Secretary" );
department.setStatus( false );
Session session = HibernateUtil.currentSession();
HibernateUtil.currentSession().beginTransaction();
Dao<Department> departmentDao = new Dao<Department>( session, Department.class );
departmentDao.merge( department );
HibernateUtil.currentSession().getTransaction().commit();
HibernateUtil.closeCurrentSession();
}
}[/code]
Ou seja, estou abrindo, nesse caso, a sessão do Hibernate na mão e fazendo o commit também na mão e tudo funciona perfeitamente. E abaixo tem o meu persistence.xml.
– [color=red]persistence.xml[/color]:
<?xml version="1.0" encoding="UTF-8"?>
<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="Test">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
</persistence-unit>
</persistence>
Então o grande problema é quando eu faço a chamada da minha página JSP para o meu ManagedBean (DepartmentMB) fazer a persistência do objeto Department, mais especificamente no método save, onde está estourando a exceção:
[quote]19/03/2009 10:11:12 javax.faces.event.MethodExpressionActionListener processAction
SEVERE: Received ‘org.hibernate.MappingException’ when invoking action listener ‘#{departmentMB.save}’ for component ‘j_id_jsp_290256474_10’
19/03/2009 10:11:12 javax.faces.event.MethodExpressionActionListener processAction
SEVERE: org.hibernate.MappingException: Unknown entity: br.com.monteirosti.guestcomment.entity.Department
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1365)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
at br.com.monteirosti.guestcomment.dao.Dao.save(Dao.java:33)
at br.com.monteirosti.guestcomment.managedbeans.DepartmentMB.save(DepartmentMB.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:99)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:771)
at javax.faces.component.UICommand.broadcast(UICommand.java:372)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:291)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:461)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
at org.ajax4jsf.Filter.doFilter(Filter.java:175)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at br.com.monteirosti.guestcomment.util.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
10:11:12,262 ERROR AjaxViewRoot:322 - Error processing faces event for the component register:j_id_jsp_290256474_10
javax.faces.event.AbortProcessingException: /department.jsp(34,3) ‘#{departmentMB.save}’ org.hibernate.MappingException: Unknown entity: br.com.monteirosti.guestcomment.entity.Department
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:118)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:771)
at javax.faces.component.UICommand.broadcast(UICommand.java:372)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:291)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:461)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
at org.ajax4jsf.Filter.doFilter(Filter.java:175)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at br.com.monteirosti.guestcomment.util.HibernateSessionFilter.doFilter(HibernateSessionFilter.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.MappingException: Unknown entity: br.com.monteirosti.guestcomment.entity.Department
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1365)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
at br.com.monteirosti.guestcomment.dao.Dao.save(Dao.java:33)
at br.com.monteirosti.guestcomment.managedbeans.DepartmentMB.save(DepartmentMB.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:99)
… 31 more[/quote]
Bem, acho que consegui mostrar todos os possíveis arquivos que possam estar com problemas. Se alguém tiver uma luz, eu agradeço. Já fiz alguns testes e nenhum resultado positivo.
O que é mais estranho é que a nível de aplicação “offline” tudo funciona, mas quando faço a aplicação rodar “online” está dando erros. Será que esse erro está acontecendo devido ao servidor de aplicação ser o Tomcat? Para rodar o Hibernate eu precisaria de um servidor de aplicação como o JBoss?
Enfim, estou meio perdido e não entendo porque não está funcionando.
Ficarei no aguardo.
Abraço e de antemão, obrigado!