当前位置: 首页 > 面试题库 >

Hibernate抛出java.lang.NoClassDefFoundError:org / hibernate / internal / CoreMessageLogger

干永丰
2023-03-14
问题内容

在tomcat 7中部署应用程序时,我从此pom.xml运行mvn
tomcat7:run时遇到此错误。在我的依赖项中,我想问题可能是由于相依软件包的混合版本引起的。

<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>

   <parent>
      <groupId>com.github.dandelion</groupId>
      <artifactId>dandelion-samples-parent</artifactId>
      <version>0.10.0</version>
      <relativePath>../../pom.xml</relativePath>
   </parent>

   <artifactId>datatables-jsp-ajax</artifactId>
   <packaging>war</packaging>

   <name>Dandelion :: Samples :: Datatables :: datatables-jsp-ajax</name>

   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>

   <dependencies>
      <!-- Dandelion-Datatables -->
      <dependency>
         <groupId>com.github.dandelion</groupId>
         <artifactId>datatables-jsp</artifactId>
      </dependency>
      <dependency>
         <groupId>com.github.dandelion</groupId>
         <artifactId>datatables-spring3</artifactId>
      </dependency>

      <!-- Spring + Jackson -->
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-web</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-webmvc</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-orm</artifactId>
      </dependency>
      <dependency>
         <groupId>org.codehaus.jackson</groupId>
         <artifactId>jackson-mapper-asl</artifactId>
      </dependency>

      <!-- JSTL -->
      <dependency>
         <groupId>jstl</groupId>
         <artifactId>jstl</artifactId>
      </dependency>

      <!-- Servlet -->
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>javax.servlet-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <!-- Tiles -->
      <dependency>
         <groupId>org.apache.tiles</groupId>
         <artifactId>tiles-jsp</artifactId>
      </dependency>

      <!-- Hibernate as JPA implementation -->
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
      </dependency>

      <!-- Database drivers -->
      <!-- H2 (local) -->
      <dependency>
         <groupId>com.h2database</groupId>
         <artifactId>h2</artifactId>
      </dependency>

      <!-- Logging -->
      <dependency>
         <groupId>ch.qos.logback</groupId>
         <artifactId>logback-classic</artifactId>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
         </plugin>
         <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
         </plugin>
         <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>
</project>

这是../../pom.xml:

<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>com.github.dandelion</groupId>
   <artifactId>dandelion-samples-parent</artifactId>
   <version>0.10.0</version>
   <packaging>pom</packaging>

   <name>Dandelion :: Samples :: Parent</name>
   <description>Parent of all Dandelion samples</description>

   <modules>
      <module>dandelion/dandelion-jsp-starter</module>
      <module>dandelion/dandelion-thymeleaf-starter</module>
      <module>datatables/datatables-jsp-starter</module>
      <module>datatables/datatables-jsp-themes</module>
      <module>datatables/datatables-jsp-plugins</module>
      <module>datatables/datatables-jsp-configuration-groups</module>
      <module>datatables/datatables-jsp-extension</module>
      <module>datatables/datatables-jsp-ajax</module>
      <module>datatables/datatables-jsp-i18n-struts1</module>
      <module>datatables/datatables-jsp-i18n-struts2</module>
      <module>datatables/datatables-jsp-export</module>
      <module>datatables/datatables-thymeleaf-starter</module>
      <module>datatables/datatables-thymeleaf-themes</module>
      <module>datatables/datatables-thymeleaf-plugins</module>
      <module>datatables/datatables-thymeleaf-configuration-groups</module>
      <module>datatables/datatables-thymeleaf-ajax</module>
      <module>datatables/datatables-thymeleaf-export</module>
      <module>datatables/datatables-thymeleaf-extension</module>
   </modules>

   <properties>
      <!-- Configuration -->
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

      <!-- Dependencies -->
      <dandelion.version>0.10.0</dandelion.version>
      <dandelion.datatables.version>0.10.0</dandelion.datatables.version>
      <jstl.version>1.2</jstl.version>
      <tiles.version>2.2.2</tiles.version>
      <servlet-api.version>3.0.1</servlet-api.version>
      <thymeleaf.version>2.1.3.RELEASE</thymeleaf.version>
      <thymeleaf.layout.version>1.2.4</thymeleaf.layout.version>
      <thymeleaf.tiles2.version>2.1.1.RELEASE</thymeleaf.tiles2.version>
      <spring.version>3.2.8.RELEASE</spring.version>
      <jackson.version>1.9.13</jackson.version>
      <struts1.version>1.3.10</struts1.version>
      <struts2.version>2.1.8</struts2.version>
      <hibernate.version>4.3.5.Final</hibernate.version>
      <slf4j-api.version>1.7.5</slf4j-api.version>
      <logback.version>1.1.2</logback.version>
      <h2.version>1.3.175</h2.version>

      <!-- Maven plugins -->
      <maven-compiler-plugin.version>3.0</maven-compiler-plugin.version>
      <tomcat7-maven-plugin.version>2.0</tomcat7-maven-plugin.version>
      <jetty-maven-plugin.version>8.1.8.v20121106</jetty-maven-plugin.version>
      <spring-boot-maven-plugin.version>1.0.2.RELEASE</spring-boot-maven-plugin.version>
   </properties>

   <dependencyManagement>
      <dependencies>
         <!-- Dandelion -->
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>dandelion-jsp</artifactId>
            <version>${dandelion.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>dandelion-thymeleaf</artifactId>
            <version>${dandelion.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>dandelion-spring3</artifactId>
            <version>${dandelion.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>dandelion-ehcache</artifactId>
            <version>${dandelion.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>dandelion-webjars</artifactId>
            <version>${dandelion.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>dandelion-yuicompressor</artifactId>
            <version>${dandelion.version}</version>
         </dependency>

         <!-- Dandelion-Datatables -->
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-jsp</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-thymeleaf</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-spring3</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-compression-yui</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-export-poi</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-export-poi-ooxml</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-export-itext</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-struts1</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>
         <dependency>
            <groupId>com.github.dandelion</groupId>
            <artifactId>datatables-struts2</artifactId>
            <version>${dandelion.datatables.version}</version>
         </dependency>

         <!-- Spring -->
         <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
         </dependency>
         <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
         </dependency>
         <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
         </dependency>

         <!-- Struts 1 -->
         <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-core</artifactId>
            <version>${struts1.version}</version>
         </dependency>
         <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-taglib</artifactId>
            <version>${struts1.version}</version>
         </dependency>
         <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-extras</artifactId>
            <version>${struts1.version}</version>
         </dependency>

         <!-- Struts 2 -->
         <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
         </dependency>

         <!-- JSTL -->
         <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl.version}</version>
         </dependency>

         <!-- Servlet -->
         <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet-api.version}</version>
            <scope>provided</scope>
         </dependency>

         <!-- Jackson -->
         <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>${jackson.version}</version>
         </dependency>

         <!-- Thymeleaf -->
         <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf</artifactId>
            <version>${thymeleaf.version}</version>
         </dependency>
         <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf-spring3</artifactId>
            <version>${thymeleaf.version}</version>
         </dependency>
         <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-tiles2</artifactId>
            <version>${thymeleaf.tiles2.version}</version>
         </dependency>
         <dependency>
            <groupId>nz.net.ultraq.thymeleaf</groupId>
            <artifactId>thymeleaf-layout-dialect</artifactId>
            <version>${thymeleaf.layout.version}</version>
         </dependency>

         <!-- Tiles -->
         <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <version>${tiles.version}</version>
         </dependency>
         <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <version>${tiles.version}</version>
         </dependency>
         <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>${tiles.version}</version>
         </dependency>
         <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-servlet</artifactId>
            <version>${tiles.version}</version>
         </dependency>

         <!-- Sitemesh -->
         <dependency>
            <groupId>org.sitemesh</groupId>
            <artifactId>sitemesh</artifactId>
            <version>${sitemesh3.version}</version>
         </dependency>

         <!-- Hibernate as JPA implementation -->
         <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
         </dependency>
         <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
         </dependency>

         <!-- Database drivers -->
         <!-- H2 (local) -->
         <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
         </dependency>

         <!-- Logging -->
         <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j-api.version}</version>
         </dependency>
         <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j-api.version}</version>
         </dependency>

         <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
         </dependency>
      </dependencies>
   </dependencyManagement>

   <build>
      <pluginManagement>
         <plugins>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <version>${maven-compiler-plugin.version}</version>
               <configuration>
                  <source>1.6</source>
                  <target>1.6</target>
               </configuration>
            </plugin>

            <!-- Jetty 8 -->
            <plugin>
               <groupId>org.mortbay.jetty</groupId>
               <artifactId>jetty-maven-plugin</artifactId>
               <version>${jetty-maven-plugin.version}</version>
               <configuration>
                  <connectors>
                     <connector
                        implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                        <port>9090</port>
                        <maxIdleTime>60000</maxIdleTime>
                     </connector>
                  </connectors>
                  <webAppConfig>
                     <contextPath>/${project.artifactId}</contextPath>
                  </webAppConfig>
               </configuration>
            </plugin>

            <!-- Tomcat 7 -->
            <plugin>
               <groupId>org.apache.tomcat.maven</groupId>
               <artifactId>tomcat7-maven-plugin</artifactId>
               <version>${tomcat7-maven-plugin.version}</version>
               <configuration>
                  <server>tomcat-development-server</server>
                  <port>9090</port>
                  <path>/${project.artifactId}</path>
               </configuration>
            </plugin>

            <!-- Spring Boot -->
            <plugin>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-maven-plugin</artifactId>
               <version>${spring-boot-maven-plugin.version}</version>
            </plugin>
         </plugins>
      </pluginManagement>
   </build>
</project>

问题答案:

此类是在4.xx版本中添加的,您将不会在Hibernate 3中找到它

hibernate-core-4.1.6.Final.jar\org\hibernate\internal\CoreMessageLogger.class

可能是hibernate-core您的Maven依赖关系树中有2个版本。

你需要:

  1. mvn dependency:tree
  2. 检查hibernate-core您有多少个版本以及哪些其他3rd oarty依赖项hibernate-core代表您添加了
  3. hibernate-core从其他外部依赖项中排除传递性依赖项,仅依赖您的显式配置


 类似资料:
  • 问题内容: 我正在尝试在Tomcat中进行部署时在Eclipse中使用Hibernate进行初始设置。 我遇到以下问题: 我已经在线浏览了我的问题,并且我知道这与项目类路径有关。 我已在我的项目中添加了一个用户库,其中包含hibernate下载中“必需”目录下的所有jars,但这似乎不起作用。 请在这里找到我的项目的屏幕截图: 问题答案: 您收到错误消息是因为hibernate库对Tomcat不可

  • 问题内容: 我想在我的存储库层中有一个选项来渴望加载实体,所以我尝试添加一种方法来渴望加载具有所有关系的问题实体,但是它会抛出MultipleBagFetchException。我怎样才能解决这个问题?我正在使用Hibernate 4.16。 我如何获得一个最初是延迟加载的问题对象,以期渴望加载所有关系? 问题答案: 在Hibernate和通常的ORM中,这是一个相当棘手的问题。 发生的情况是,许

  • 泛型方法 在控制器中获取列表 测试 测试 结果[java.lang.ClassCastException] 为什么该类强制执行异常,因为criteria.SetProjection(pl)返回条件,然后返回相同列表的条件。 如何对此进行动态控制? 更新我!

  • 问题内容: 我正在尝试将(v2.6.0)添加到我的项目中,但是存在一些配置问题。具体来说,当我尝试使用以下命令构建配置时,出现了:错误 这是我的 Maven 依赖关系… 这是我用来配置它的Java代码… 这是可怕的错误。我缺少什么配置? 问题答案: ehcache-core文件基本上是针对Hibernate 3.x的。Hibernate 4.x带有自己的ehcache实现。您无需在hibernat

  • 问题内容: 我有这种方法: 映射: Person.hbm.xml Cars.hbm.xml 此方法适用于单个线程,并且在多个线程上,给我一个错误: AOP交易: 注意:当我在更新后添加Thread.sleep(5000)时,就可以了。 但是这种解决方案并不干净。 问题答案: 我有汽车->(1-n)个地方。而且我在表位置(id_car)有一个外键。此外键没有索引。当我向该外键添加索引时,我的问题已解

  • 非常感谢您的帮助:)我将Spock0.6与Groovy1.8一起使用。