Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

后端 未结 20 2347
南方客
南方客 2020-12-08 02:10

I am developing an application with Hibernate and I get an Exception when I connect with database. The exception is:

Unable to instantiate default tuplizer [         


        
相关标签:
20条回答
  • 2020-12-08 02:17

    Check your Hibernate mapping file *.hbm.xml and check the class with which you are creating the getter and setter methods. Every property in the mapping file should exist as getters and setters in the populating class. Once you fix that the error is solved.

    Also by reading the console, you can probably see the error mentioning a missing getter/setter.

    Hope this helps you.

    0 讨论(0)
  • 2020-12-08 02:18

    Add the following to your pom.xml and take out the dependency from asm jars from hibernate and add separate dependency to asm in a separate section. I did the same and it worked in one shot.

        <!-- Hibernate core -->
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate</artifactId>
          <version>3.2.7.ga</version>
    
       <exclusions>      
          <exclusion>
             <groupId>asm</groupId> 
               <artifactId>asm</artifactId>
             </exclusion>
          <exclusion>   
              <groupId>asm</groupId>
                <artifactId>asm-attrs</artifactId>
              </exclusion>
          </exclusions>
        </dependency>
    
    
        <dependency>
          <groupId>asm</groupId>
          <artifactId>asm</artifactId>
          <version>3.1</version>
    
    0 讨论(0)
  • 2020-12-08 02:18

    I had the same exception and I was excluding javassist because of its issue with powermock. Then I was adding it again as below but it was not working:

    <dependency>
       <groupId>org.powermock</groupId>
       <artifactId>powermock-module-junit4</artifactId>
       <version>1.7.0</version>
       <scope>test</scope>
       <exclusions>
          <exclusion>
             <groupId>org.javassist</groupId>
             <artifactId>javassist</artifactId>
          </exclusion>
       </exclusions>
    </dependency>
    
    <dependency>
       <groupId>org.javassist</groupId>
       <artifactId>javassist</artifactId>
       <version>3.20.0-GA</version>
       <scope>test</scope>
    </dependency>
    

    Finally I found out that I have to remove <scope>test</scope> from javassist dependency. Hope it helps someone.

    0 讨论(0)
  • 2020-12-08 02:23

    In my case I had a isSomething() boolean getter and got this error.

    I resolved it by annotating the method with the JPA @Transient annotation and find a confirmation in an answer to this SO question, so telling the provider not to persist the attribute.

    0 讨论(0)
  • 2020-12-08 02:24

    For me this was resolved by adding an explicit default constructor

    public MyClassName (){}
    
    0 讨论(0)
  • 2020-12-08 02:25

    In my case has helped to exclude javax.transaction.jta dependency from hibernate:

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate</artifactId>
      <version>3.2.7.ga</version>
      <exclusions>
        <exclusion>
          <groupId>javax.transaction</groupId>
          <artifactId>jta</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    
    0 讨论(0)
提交回复
热议问题