javax.el.E​​LException:java.lang.NoClassDefFoundError:org / hibernate / HibernateException

时间:2015-10-05 06:11:28

标签: java hibernate maven

我遇到了这个问题!我已经在我的pom.xml文件中添加了所有依赖项,我没有看到需要将外部jar添加到WEB-INF文件夹中。请帮忙。 我的pom.xml是:

/* checkbox -*/
.radios label,
.radios input[type="radio"] + span,
.radios input[type="radio"] + span::before,
.checkboxes label,
.checkboxes input[type="checkbox"] + span,
.checkboxes input[type="checkbox"] + span::before {
    display:inline-block;
    vertical-align:middle
}
.radios,
.checkboxes {
    position:relative
}
.radios label *,
.checkboxes label * {
    cursor:pointer
}
.radios input[type="radio"],
.checkboxes input[type="checkbox"] {
    position:absolute;
    display:none
}
.radios input[type="radio"] + span,
.checkboxes input[type="checkbox"] + span {
    color:#333
}
.radios label:hover span,
.checkboxes label:hover span {
    color:#000
}
.radios input[type="radio"] + span::before,
.checkboxes input[type="checkbox"] + span::before {
    margin:0 4px 0 0;
    width:13px;
    height:13px;
    border:solid 2px #ccc;
    background-size:13px;
    content:"";
    text-align:center;
    line-height:17px
}
.checkboxes input[type="checkbox"] + span:hover:before {
    border:solid 2px #5a5a5a
}
.radios input[type="radio"]:checked + span::before,
.checkboxes input[type="checkbox"]:checked + span::before {
    width:13px;
    height:13px;
    border:solid 2px #ccc;
    background-color:#FFFFFF;
    color:#01A982;
    line-height:17px
}
.radios input[type="radio"]:disabled + span,
.checkboxes input[type="checkbox"]:disabled + span {
    opacity:.4;
    cursor:default
}
.checkboxes input[type="checkbox"] + span::before {
    border-radius:inherit;
}
.radios input[type="radio"]:checked + span::before {
    content:"\2022";
    font-size:24px
}
.checkboxes li{
    list-style: none;
}

:root .checkboxes input[type="checkbox"]:checked + span:before {
    content: "\2713"; 
    font-family: arial;
    font-size: 14px;
    font-weight: bold;
}
.checkboxes input[type="checkbox"]:checked + span::before {
    background-color: #FFFFFF;
    border: solid 2px #01A982;
    color: #01A982;
    line-height: 14px;
}
.checkboxes input[type="checkbox"]:checked + span::before {
    border: solid 2px #01A982;
}/* checkbox -*/

我还在Build路径中添加了<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ShopCart</groupId> <artifactId>ShopCart</artifactId> <version>0.0.1-SNAPSHOT</version> <name>ShopCart</name> <url>http://www.primefaces.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> <resource> <directory>src/main/webapp</directory> <includes> <include>**/web.xml</include> </includes> <filtering>true</filtering> </resource> </resources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.5</source> <target>1.5</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.11</version> <configuration> <excludes> <!-- Exclude integration tests within (unit) test phase. --> <exclude>**/integration/**/*.java</exclude> </excludes> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.0</version> <configuration> <webResources> <resource> <filtering>true</filtering> <directory>src/main/webapp</directory> <includes> <include>**/web.xml</include> </includes> </resource> </webResources> <warSourceDirectory>src/main/webapp</warSourceDirectory> <webXml>src/main/webapp/WEB-INF/web.xml</webXml> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.4</version> <configuration> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.9.v20130131</version> <configuration> <webAppConfig> <contextPath>/prime-showcase</contextPath> <overrideDescriptor>src/main/webapp/WEB-INF/web-overwrite.xml</overrideDescriptor> </webAppConfig> <webXml>${project.build.directory}/classes/WEB-INF/web.xml</webXml> <scanIntervalSeconds>5</scanIntervalSeconds> </configuration> </plugin> </plugins> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-ssh</artifactId> <version>1.0</version> </extension> </extensions> </build> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.3</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.7</version> </dependency> <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7</version> <exclusions> <exclusion> <groupId>bouncycastle</groupId> <artifactId>bcmail-jdk14</artifactId> </exclusion> <exclusion> <groupId>bouncycastle</groupId> <artifactId>bcprov-jdk14</artifactId> </exclusion> <exclusion> <groupId>org.bouncycastle</groupId> <artifactId>bctsp-jdk14</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>2.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>5.1.3.Final</version> </dependency> <!-- File Upload --> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <!-- FeedReader and Mobile News --> <dependency> <groupId>rome</groupId> <artifactId>rome</artifactId> <version>1.0</version> </dependency> <!-- Twitter API --> <dependency> <groupId>org.twitter4j</groupId> <artifactId>twitter4j-core</artifactId> <version>3.0.5</version> </dependency> <!-- Dynamic Image Examples --> <dependency> <groupId>net.sourceforge.barbecue</groupId> <artifactId>barbecue</artifactId> <version>1.5-beta1</version> </dependency> <dependency> <groupId>jfree</groupId> <artifactId>jfreechart</artifactId> <version>1.0.0</version> </dependency> <!-- Atmosphere --> <dependency> <groupId>org.atmosphere</groupId> <artifactId>atmosphere-runtime</artifactId> <version>2.1.3</version> </dependency> <dependency> <groupId>javax.inject</groupId> <artifactId>javax.inject</artifactId> <version>1</version> </dependency> <!-- Logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.6.1</version> </dependency> <!-- Themes --> <dependency> <groupId>org.primefaces.themes</groupId> <artifactId>all-themes</artifactId> <version>1.0.10</version> </dependency> <!-- TESTING --> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.19.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-all</artifactId> <version>1.1</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> <!--<dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.7.4</version> </dependency> --> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.10.Final</version> </dependency> <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.1-901.jdbc4</version> </dependency> <dependency> <groupId>org.hibernate.common</groupId> <artifactId>hibernate-commons-annotations</artifactId> <version>4.0.5.Final</version> </dependency> </dependencies> <repositories> <repository> <id>prime-repo</id> <name>PrimeFaces Maven Repository</name> <url>http://repository.primefaces.org</url> <releases> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </releases> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> <repository> <id>apache-snapshots</id> <name>apache-snapshots</name> <url>http://repository.apache.org/snapshots/</url> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> <repository> <id>jvnet-nexus-releases</id> <name>jvnet-nexus-releases</name> <url>https://maven.java.net/content/repositories/releases/</url> </repository> <repository> <id>repository.jboss.org</id> <name>JBoss Repository for Maven</name> <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url> </repository> <repository> <id>JBoss repository</id> <url>http://repository.jboss.com/maven2/</url> </repository> </repositories> <distributionManagement> <repository> <id>prime-repo</id> <name>PrimeFaces Maven Repository</name> <url>sftp://primefaces.org/var/www/repository</url> </repository> </distributionManagement> <profiles> <profile> <id>mojarra</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <jsfVersion>Mojarra-2.2.4</jsfVersion> <primefacesVersion>PrimeFaces-5.1-SNAPSHOT</primefacesVersion> <jsf-listener>com.sun.faces.config.ConfigureListener</jsf-listener> </properties> <dependencies> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>5.2</version> </dependency> <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.faces</artifactId> <version>2.2.5</version> </dependency> </dependencies> </profile> <profile> <id>mojarra-2.1</id> <properties> <jsfVersion>Mojarra-2.1.26</jsfVersion> <primefacesVersion>PrimeFaces-5.1-SNAPSHOT</primefacesVersion> <jsf-listener>com.sun.faces.config.ConfigureListener</jsf-listener> </properties> <dependencies> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>5.2</version> </dependency> <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.faces</artifactId> <version>2.1.26</version> </dependency> </dependencies> </profile> <profile> <id>mojarra-2.0</id> <properties> <jsfVersion>Mojarra-2.0.11</jsfVersion> <primefacesVersion>PrimeFaces-5.1-SNAPSHOT</primefacesVersion> <jsf-listener>com.sun.faces.config.ConfigureListener</jsf-listener> </properties> <dependencies> <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.faces</artifactId> <version>2.0.11</version> </dependency> </dependencies> </profile> <profile> <id>myfaces</id> <properties> <jsfVersion>MyFaces-2.2.3</jsfVersion> <primefacesVersion>PrimeFaces-5.1-SNAPSHOT</primefacesVersion> <jsf-listener>org.apache.myfaces.webapp.StartupServletContextListener</jsf-listener> </properties> <dependencies> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>5.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> <version>2.2.3</version> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-impl</artifactId> <version>2.2.3</version> </dependency> </dependencies> </profile> <profile> <id>myfaces-2.1</id> <properties> <jsfVersion>MyFaces-2.1.12</jsfVersion> <primefacesVersion>PrimeFaces-5.1-SNAPSHOT</primefacesVersion> <jsf-listener>org.apache.myfaces.webapp.StartupServletContextListener</jsf-listener> </properties> <dependencies> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>5.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces-mobile</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> <version>2.1.12</version> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-impl</artifactId> <version>2.1.12</version> </dependency> </dependencies> </profile> <profile> <id>myfaces-2.0</id> <properties> <jsfVersion>MyFaces-2.0.20</jsfVersion> <primefacesVersion>PrimeFaces-5.1-SNAPSHOT</primefacesVersion> <jsf-listener>org.apache.myfaces.webapp.StartupServletContextListener</jsf-listener> </properties> <dependencies> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces</artifactId> <version>5.1-SNAPSHOT</version> </dependency> <dependency> <groupId>org.primefaces</groupId> <artifactId>primefaces-mobile</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> <version>2.0.20</version> </dependency> <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-impl</artifactId> <version>2.0.20</version> </dependency> </dependencies> </profile> </profiles> </project> hibernate-core-4.2.3.final-sources个jar。

我的申请类是:

primefaces-5.0

当用户单击“保存”按钮时,它应该转到bean类中的saveOrder方法。请帮我解决这个问题。 提前致谢。

1 个答案:

答案 0 :(得分:1)

以下是一些可能的原因: -

  1. 您应该调用mvn package(或右键单击&gt; maven&gt;包) 获取战争文件 - <packaging>(在pom中)必须为war

    <packaging>war</packaging>
    
  2. 如果您在eclipse中的服务器上运行项目作为动态Web项目,那么您应该打开项目属性(右键单击&gt;属性)并选择&#34;部署程序集&#34;。点击&#34;添加&#34;,选择&#34;构建路径条目&#34;,然后选择&#34; maven依赖&#34;。这将指示WTP将maven依赖项发送到服务器目录。