All Products
Search
Document Center

Tablestore:What do I do if the "Unable to instantiate default tuplizer" error message is returned when I query data by using Hibernate to use the JDBC driver for Tablestore?

Last Updated:Jul 18, 2024

Problem description

When I query data by using Hibernate to use the Java Database Connectivity (JDBC) driver for Tablestore, the following error occurs:

Exception in thread "main" org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
  at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:108)
  at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:133)
  at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80)
  at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:322)
  at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:485)
  at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:133)
  at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
  at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:286)

Cause

The javassist-x.x.x.jar package is missing.

Solution

Install the javassist-x.x.x.jar package by using one of the following methods:

  • Install the javassist installation package javassist-x.x.x.jar and import the package to the project. For more information about the download path, see javassist installation package. In javassist-x.x.x.jar, x.x.x indicates the version number of javassist. Download a javassist installation package based on your business requirements.

  • Add dependencies to a Maven project.

    Add the corresponding dependencies to the pom.xml file in the Maven project. The following sample code shows how to add content to <dependencies>. In this example, the 3.15.0-GA version is used.

    <!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
    <dependency>
        <groupId>org.javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.15.0-GA</version>
    </dependency>