错误:Initial SessionFactory creation failed.org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
2011-12-2 0:50:53 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet NewContactServlet threw exception
java.lang.NullPointerException我在网上查了很多,因为我的程序在改动之前是可以运行的,所以不存在少什么东西之类的,应该就是实体类中的XX属性和getXX方法对不上,这类的问题,但是我查了很久都不知道哪错了,再加上这块比较不熟……希望大家指正一下,最好能详细点,纯新手。谢谢PhoneNumber.hbp.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">
<hibernate-mapping package="domain">
<class name="PhoneNumber" table="PhoneNumber_Table">
<id name="id_phone">
<generator class="increment"/>
</id>
<property name="phoneKind" type="string"></property>
<property name="phoneNumber" type="string"></property>
<many-to-one name="contact" class ="Contact" column="ID_CONTACT"></many-to-one>
</class>
</hibernate-mapping>PhoneNumber.javapublic class PhoneNumber {
long id_phone;
String phoneKind;
String phoneNumber;
// String phoneKind2;
// String phoneNumber2;
// String phoneKind3;
// String phoneNumber3;
Contact contact;
public PhoneNumber(){
} public PhoneNumber(String phoneKind, String phoneNumber) {
super();
this.phoneKind = phoneKind;
this.phoneNumber = phoneNumber; } public long getid_phone() {
return id_phone;
} public void setid_phone(long id_phone) {
this.id_phone = id_phone;
} public String getPhoneKind() {
return phoneKind;
} public void setPhoneKind(String phoneKind1) {
this.phoneKind = phoneKind1;
// this.phoneKind2 = phoneKind2;
// this.phoneKind3 = phoneKind3;
} public String getPhoneNumber() {
return phoneNumber;
} public void setPhoneNumber(String phoneNumber1) {
this.phoneNumber = phoneNumber1;
// this.phoneNumber2 = phoneNumber2;
// this.phoneNumber3 = phoneNumber3;
}
public Contact getContact() {
return contact;
} public void setContact(Contact contact) {
this.contact = contact;
}
Contact.hbp.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">
<hibernate-mapping package="domain">
<class name="Contact" table="Contact_Table">
<id name="id_contact" type="long" column="ID_CONTACT" >
<generator class="increment"/>
</id>
<property name="firstName" column="FirstName" ></property>
<property name="lastName" column="LastName" ></property>
<property name="email" column="Email" ></property>
<many-to-one name="address" column="ID_ADD" unique="true"></many-to-one>
<set name="phonenumber" inverse="true" >
<key column="ID_CONTACT"></key>
<one-to-many class="PhoneNumber"/>
</set>
<set name="contactgroups" inverse="true" table="jointable">
<key column="ID_CONTACT"></key>
<many-to-many class="ContactGroup" column="ID_ContactGroup"></many-to-many>
</set>
</class>
</hibernate-mapping>
相关的问价大概就是这些……希望大家能抽时间看看,谢谢!
2011-12-2 0:50:53 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet NewContactServlet threw exception
java.lang.NullPointerException我在网上查了很多,因为我的程序在改动之前是可以运行的,所以不存在少什么东西之类的,应该就是实体类中的XX属性和getXX方法对不上,这类的问题,但是我查了很久都不知道哪错了,再加上这块比较不熟……希望大家指正一下,最好能详细点,纯新手。谢谢PhoneNumber.hbp.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">
<hibernate-mapping package="domain">
<class name="PhoneNumber" table="PhoneNumber_Table">
<id name="id_phone">
<generator class="increment"/>
</id>
<property name="phoneKind" type="string"></property>
<property name="phoneNumber" type="string"></property>
<many-to-one name="contact" class ="Contact" column="ID_CONTACT"></many-to-one>
</class>
</hibernate-mapping>PhoneNumber.javapublic class PhoneNumber {
long id_phone;
String phoneKind;
String phoneNumber;
// String phoneKind2;
// String phoneNumber2;
// String phoneKind3;
// String phoneNumber3;
Contact contact;
public PhoneNumber(){
} public PhoneNumber(String phoneKind, String phoneNumber) {
super();
this.phoneKind = phoneKind;
this.phoneNumber = phoneNumber; } public long getid_phone() {
return id_phone;
} public void setid_phone(long id_phone) {
this.id_phone = id_phone;
} public String getPhoneKind() {
return phoneKind;
} public void setPhoneKind(String phoneKind1) {
this.phoneKind = phoneKind1;
// this.phoneKind2 = phoneKind2;
// this.phoneKind3 = phoneKind3;
} public String getPhoneNumber() {
return phoneNumber;
} public void setPhoneNumber(String phoneNumber1) {
this.phoneNumber = phoneNumber1;
// this.phoneNumber2 = phoneNumber2;
// this.phoneNumber3 = phoneNumber3;
}
public Contact getContact() {
return contact;
} public void setContact(Contact contact) {
this.contact = contact;
}
Contact.hbp.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">
<hibernate-mapping package="domain">
<class name="Contact" table="Contact_Table">
<id name="id_contact" type="long" column="ID_CONTACT" >
<generator class="increment"/>
</id>
<property name="firstName" column="FirstName" ></property>
<property name="lastName" column="LastName" ></property>
<property name="email" column="Email" ></property>
<many-to-one name="address" column="ID_ADD" unique="true"></many-to-one>
<set name="phonenumber" inverse="true" >
<key column="ID_CONTACT"></key>
<one-to-many class="PhoneNumber"/>
</set>
<set name="contactgroups" inverse="true" table="jointable">
<key column="ID_CONTACT"></key>
<many-to-many class="ContactGroup" column="ID_ContactGroup"></many-to-many>
</set>
</class>
</hibernate-mapping>
相关的问价大概就是这些……希望大家能抽时间看看,谢谢!
解决方案 »
- poi 3.0支持 office2007么?
- 请教为什么序列化后2.2G的hashmap文件,无法读到jvm开到9G的内存中呢?
- tomcat5.5 目录和过滤器pattern冲突
- 我的webservice 返回xml 是返回Document吗
- 请教一个不知道算不算简单的问题。急用,希望高手帮忙!!
- hibernate的update问题问题
- 在eclipes中怎么象jbuilder中那样选择工程或者java文件build让他产生新的class文件啊?
- 请问EJB中怎么实现定时器功能,在每天的0:00执行一次操作。
- 用getHibernateTemplate方法查询数据报错 java.lang.NoSuchFieldError: MANUAL
- 几个面试题,求解释
- 怎么把一个字符串转换成一个字符串数组(要简便)!!!!!急急急!!!
- hibernate多表更新的问题
public long getid_phone() {}
public void setid_phone(long id_phone) {}至少应该是public long getId_phone() {}
public void setId_phone(long id_phone) {}去了解一下javaBean的规范吧如果在eclipse中,你完全可以用向导生成:在源代码文件中,右键->Source ->Generate getters and setters