Hibernate引发java.lang.NoClassDefFoundError:org / hibernate / internal / CoreMessageLogger

鲍德里克

在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>
弗拉德·米哈西亚(Vlad Mihalcea)

此类是在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您有多少个版本以及其他哪些第三个oarty依赖项正在hibernate-core代表您添加
  3. hibernate-core从其他外部依赖项中排除传递性依赖项,仅依赖您的显式配置

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

jboss错误:java.lang.NoSuchMethodError:org.hibernate.internal.CoreMessageLogger.debugf(Ljava / lang / String; I)V

java.lang.NoClassDefFoundError:org / hibernate / cache / EntityRegion配置EHCache

java.lang.NoClassDefFoundError:org / hibernate / service / ServiceRegistry

Hibernate抛出java.lang.ClassNotFoundException:org.hibernate.internal.log.ConnectionPoolingLogger

由于在org.hibernate.internal.util.ConfigHelper.getResourceAsStream上的java.lang.NullPointerException,Hibernate 4.3.5 SessionFactory创建失败

java.lang.ClassNotFoundException:org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper

错误:java.lang.NoSuchMethodError:org.hibernate.integrator.internal.IntegratorServiceImpl。<init>

java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException

java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:未映射用户(来自User)

java.lang.ClassCastException:org.hibernate.hql.internal.ast.tree.SqlNode无法转换为org.hibernate.hql.internal.ast.tree.FromReferenceNode

java.lang.NoClassDefFoundError: org/springframework/orm/hibernate5/HibernateTransactionManager

java.lang.NoClassDefFoundError:org / hibernate / boot / registry / classloading / spi / ClassLoaderService

java.lang.NoClassDefFoundError:休眠5.3.1中的org / hibernate / cache / spi / TransactionalDataRegion

java.lang.NoClassDefFoundError:org / hibernate / metamodel / source / annotations / JPADotNames错误

异常:预期为<org.hibernate.exception.ConstraintViolationException>,但为<java.lang.NoClassDefFoundError>

如何在春季解决java.lang.NoClassDefFoundError:org / hibernate / QueryTimeoutException

java.lang.IllegalArgumentException:org.hibernate.QueryException:节点没有数据类型:org.hibernate.hql.internal.ast.tree.MethodNode

线程“主”中的异常java.lang.IllegalArgumentException:获得此示例的org.hibernate.hql.internal.ast.QuerySyntaxException

获取java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:运行查询后出现意外令牌

NoClassDefFoundError:org / hibernate / ejb / HibernatePersistence

oozie spark 2.0操作给出异常:java.lang.NoClassDefFoundError:org / apache / spark / internal / Logging

类型[未知]不存在原因:java.lang.NoClassDefFoundError:org / junit / internal / runners / TestClassRunner

PowerMockito无法正常工作:-java.lang.NoClassDefFoundError:org / mockito / internal / creation / CglibMockMaker

自动连接的依赖项注入失败;嵌套的异常是java.lang.NoClassDefFoundError:org / hibernate / cfg / Configuration

在一个简单的Maven休眠项目中得到错误“ java.lang.NoClassDefFoundError:org / hibernate / cfg / Mappings”

选择嵌套的Hibernate不可变对象会引发org.hibernate.hql.internal.ast.QuerySyntaxException:意外令牌:new

在GlassFish 4.1上部署Java EE 7应用程序时的java.lang.ClassNotFoundException:org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor

NoClassDefFoundError:org / hibernate / annotations / common / reflection / MetadataProvider

org.hibernate.console.HibernateConsoleRuntimeException:NoClassDefFoundError