java.lang.NoClassDefFoundError:net/sf/hibernate/HibernateException
我正在用Hibernate开发一个JSFWebApp。我使用一个主类进行了测试,可以在数据库中插入,但无法将我的webapp部署到Glassfish。它总是错误与HTTP 500错误。这是我的密码:java.lang.NoClassDefFoundError:net/sf/hibernate/HibernateException,hibernate,jsf,Hibernate,Jsf,我正在用Hibernate开发一个JSFWebApp。我使用一个主类进行了测试,可以在数据库中插入,但无法将我的webapp部署到Glassfish。它总是错误与HTTP 500错误。这是我的密码: faces配置: <?xml version="1.0" encoding="UTF-8"?> <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w
faces配置
:
<?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>
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>
这是如何造成的,我如何解决它?看起来您正在使用Hibernate,但您的war中没有内置Hibernate jar和依赖项。确保所需的所有依赖项都已构建到war中的WEB-INF/lib目录中
这一过程将取决于您如何构建web应用程序。您似乎正在使用Hibernate,但war中没有内置Hibernate jar和依赖项。确保所需的所有依赖项都已构建到war中的WEB-INF/lib目录中
此过程将取决于您如何构建web应用程序。这是我的异常:.JasperException:/test.jsp(5,57)PWC6188:绝对uri:无法在web.xml或与此应用程序一起部署的jar文件中解析。在解决hibernate异常后,这是一个新问题吗?如果是这样(这个答案帮助您解决了Hibernate异常),请您将这个答案标记为已接受,以便将来搜索这个异常的人可以找到它。然后,您可以在一个新问题中发布您的新问题--这样网站就可以提供与特定问题相关的标题。这是我的例外:.JasperException:/test.jsp(5,57)PWC6188:绝对uri:无法在web.xml或与此应用程序一起部署的jar文件中解析这是解决hibernate异常后的新问题吗?如果是这样(这个答案帮助您解决了Hibernate异常),请您将这个答案标记为已接受,以便将来搜索这个异常的人可以找到它。然后你可以在一个新问题中发布你的新问题——这样网站就可以提供与特定问题相关的标题。
<%@ 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>
javax.servlet.ServletException: net/sf/hibernate/HibernateException
root cause: java.lang.NoClassDefFoundError: net/sf/hibernate/HibernateException