1

I am developing a JSF webapp with Hibernate. I tested with a main class and I can insert in database, but I can't deploy my webapp to Glassfish. It always errors with HTTP 500 error. Here is my code:

faces-config:

<?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> <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> </application> <managed-bean> <managed-bean-name>timesheetBean</managed-bean-name> <managed-bean-class>hibernate.timeBean.TimesheetBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> <navigation-rule> <from-view-id>/EditTimesheet.jsp</from-view-id> </navigation-rule> </faces-config> 

web.xml:

<?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>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</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> <context-param> <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <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>*.jsf</url-pattern> </servlet-mapping> <session-config> <session-timeout>30</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> 

EditTimesheet.jsp:

<%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSF 'EditDepartement.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <f:view> <h:form> <h:inputHidden id="id" value="#{timesheetBean.currentTimesheet.id}" /> <h:panelGrid columns="2" border="1"> <h:inputText value="#{timesheetBean.currentTimesheet.action}"> </h:inputText> <h:outputText value="heure:" /> <h:inputText value="#{timesheetBean.currentTimesheet.heure}"> </h:inputText> <h:outputText value="date:" /> <h:inputText value="#{timesheetBean.currentTimesheet.date}"> </h:inputText> </h:panelGrid> <h:commandButton value="Save" action="listeDepartements" actionListener="#{timesheetBean.saveTimesheet}" /> <h:commandButton value="Annuler" action="listeTimesheet"/> </h:form> </f:view> </body> </html> 

The exeception is:

javax.servlet.ServletException: net/sf/hibernate/HibernateException root cause: java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException 

How is this caused and how can I solve it?

1 Answer 1

1

It appears that you are utilizing Hibernate but don't have the Hibernate jar and dependencies built into your war. Make sure that all the dependencies you need are being built into the WEB-INF/lib directory inside your war.

The process for this would depend on how you are constructing your web application.

Sign up to request clarification or add additional context in comments.

2 Comments

this is my exception:.JasperException: /test.jsp(5,57) PWC6188: The absolute uri: richfaces.org/rich cannot be resolved in either web.xml or the jar files deployed with this application
is this a new issue after you resolved the hibernate exception? If so (and this answer helped your resolve the Hibernate exception), can you please mark this answer as accepted so that future persons searching for this exception can find it. Then you can post your new issue in a new question -- that way the site provides title relevance to specific issues.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.