복붙노트

[SPRING] 'sessionFactory'라는 이름으로 빈을 생성하는 중 오류가 발생했습니다. 기본 tuplizer를 인스턴스화 할 수 없습니다 [org.hibernate.tuple.entity.PojoEntityTuplizer]

SPRING

'sessionFactory'라는 이름으로 빈을 생성하는 중 오류가 발생했습니다. 기본 tuplizer를 인스턴스화 할 수 없습니다 [org.hibernate.tuple.entity.PojoEntityTuplizer]

나는 최대 절전 모드와 봄과 아파치 바람둥이로 응용 프로그램을 개발 중이다.

전체 스택 추적은 다음과 같습니다.

GRAVE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/HibernateSessionFactory.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1403)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:545)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:871)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:443)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:340)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:307)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:323)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:433)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:231)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1313)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:855)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:774)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1400)
... 28 more

내 Web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<description>Sample application</description>
<display-name>RichFaces 4</display-name>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>*.html</url-pattern>
</servlet-mapping>
</web-app>

내 spring-servlet.xml :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd


http://www.springframework.org/schema/context


http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan
    base-package="net.viralpatel.spring3.controller" />

<bean id="viewResolver"
    class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass"
        value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/site/" />
    <property name="suffix" value=".jsp" />
</bean>

<import resource="DataSource.xml"/>
<import resource="HibernateSessionFactory.xml"/>
<bean id="hibernatetransactionManager"

    class="org.springframework.orm.hibernate3.HibernateTransactionManager">

    <property name="sessionFactory" ref="sessionFactory" />

</bean>   
</beans>

내 Hibernate SessionFactory.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="sessionFactory" 
 class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="dataSource">
  <ref bean="dataSource"/>
</property>

<property name="hibernateProperties">
   <props>
     <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
     <prop key="hibernate.show_sql">true</prop>
     <prop key="hibernate.hbm2ddl.auto">update</prop>
   </props>
</property>

<property name="mappingResources">
<list>
      <value>Utilisateur.hbm.xml</value>

</list>
 </property>    

</bean>
</beans>

내 User.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 7 nov. 2013 17:56:05 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping package="model">
<class name="Utilisateur" table="UTILISATEUR">
    <id name="id" type="int">
        <column name="ID" />
        <generator class="assigned" />
    </id>
    <property name="nom" type="java.lang.String">
        <column name="NOM" />
    </property>
    <property name="prenom" type="java.lang.String">
        <column name="PRENOM" />
    </property>
    <property name="code" type="java.lang.String">
        <column name="CODE" />
    </property>
    <property name="sex" type="java.lang.String">
        <column name="SEX" />
    </property>
    <property name="telephone" type="java.lang.String">
        <column name="TELEPHONE" />
    </property>
    <property name="login" type="java.lang.String">
        <column name="LOGIN" />
    </property>
    <property name="password" type="java.lang.String">
        <column name="PASSWORD" />
    </property>

</class>
</hibernate-mapping>

내 Utilisateur.java

package model;

import java.util.Date;
import java.util.List;

public class Utilisateur {
private Integer id;
private String nom;
private String prenom;
private String code;
private String sex;
private String telephone;
private String login;
private String password;
public Utilisateur() {

}
public Integer getId() {
    return id;
}
public void setId(Integer id) {
    this.id = id;
}
public String getSex() {
    return sex;
}
public void setSex(String sex) {
    this.sex = sex;
}
public String getLogin() {
    return login;
}
public void setLogin(String login) {
    this.login = login;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}
public void setPrenom(String prenom) {
    this.prenom = prenom;
}
public String getPrenom() {
    return prenom;
}
public void setCode(String code) {
    this.code = code;
}
public String getCode() {
    return code;
}
public void setTelephone(String telephone) {
    this.telephone = telephone;
}
public String getTelephone() {
    return telephone;
}

/**
 * @param nom the nom to set
 */
public void setNom(String nom) {
    this.nom = nom;
}
/**
 * @return the nom
 */
public String getNom() {
    return nom;
}   
}

고맙습니다

해결법

  1. ==============================

    1.이 파일 Utilisateur.java와 Utilisateur.hbm.xml을 비교하십시오.

    이 파일 Utilisateur.java와 Utilisateur.hbm.xml을 비교하십시오.

    이 오류가 발생하면 기본 tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]를 인스턴스화 할 수 없습니다. 그것은 일반적인 메시지입니다. 따라서 오류의 원인이되는 마지막 줄을 살펴야합니다. 그것은 해결책이 될 수 있습니다.

  2. ==============================

    2.1 시간 전에 같은 문제가 있었는데 링크에서 언급 한 다음 팁을 사용하여 해결했습니다.

    1 시간 전에 같은 문제가 있었는데 링크에서 언급 한 다음 팁을 사용하여 해결했습니다.

    http://jonathan.lalou.free.fr/?p=2026

    문제는 asm jar가 hibernate 버전과 호환되지 않기 때문입니다. 그래서 당신이 그것을 바꾼다대로 문제는 해결 될 것입니다.

    의존성에서 속성 태그를 추가해야합니다. 또한 프로젝트를 정리하여 대상 폴더의 모든 것을 제거하십시오. 그런 다음 모든 호환 jar를 검색하기 위해 maven을 새로 설치하십시오.

  3. from https://stackoverflow.com/questions/20144975/error-creating-bean-with-name-sessionfactory-unable-to-instantiate-default-tup by cc-by-sa and MIT license