Spring Data JPA Join 关联查询

项目中有两个实体ApprovalFlow(审批),Rest(请假申请),

因为业务需求(多个实体的ID对应审批表的itemID),

两个实体没有做@OneToMany的关联,

现在需要通过 ApprovalFlow.itemId= Rest.id 进行关联查询。

我是用的CriteriaBuilder,Join等方法进行查询的,

想请问各位大神,这个关联如何写。

ApprovalFlow类

public class ApprovalFlow implements Serializable {

    private static final long serialVersionUID = 976152522309023013L;
    @Id
    @GeneratedValue(generator="uuid")
    @GenericGenerator(name="uuid", strategy="uuid")
    @Column(length = 32)
    private String id;
    /**
     * 审批项ID
     */
    private String itemId;
    /**
     * 对应审批流程
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn
    private ApprovalProcess approvalProcess;
    /**
     * 模块
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn
    @NotNull
    private Module module;
    /**
     * 审批人
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn
    private Account account;
    /**
     * 审批状态
     * 
     * 0:未审批
     * 1:公司内部审批中
     * 2:总公司审批中
     * 5:审批中止(拒绝)
     * 10:审批完成
     */
    private Integer status;
    /**
     * 备注
     */
    private String remark;

    // 省去getter setter

}

Rest类

public class Rest implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = -1900505784626965483L;

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid",    strategy = "uuid")
    private String id;

    /**
     * 请假开始日期
     */
    @Temporal(TemporalType.DATE)
    @JSONField(format = "yyyy-MM-dd")
    @NotNull
    private Date startDate;
    @Transient
    private Date startStartDate;
    @Transient
    private Date endStartDate;

    /*
     * 请假结束时间
     */
    @Temporal(TemporalType.DATE)
    @JSONField(format = "yyyy-MM-dd")
    @NotNull
    private Date endDate;
    @Transient
    private Date startEndDate;
    @Transient
    private Date endEndDate;

    /**
     * 请假理由
     */
    @Lob
    @NotEmpty(message = "请假理由不能为空!")
    @Column(columnDefinition="TEXT")
    private String reason;

    /**
     * 请假天数
     */
    @NotNull
    @Column(length = 3)
    private Integer dayNumber;

    /**
     * 账号信息
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "account_id")
    private Account account;

    // 省去getter setter
}

3个回答

这个我后来用视图解决了

同样遇到一样的问题,请问问题解决了吗

将你的持久化对象贴出来,应该更好描述一些吧。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Spring Data Jpa怎么多表join查询

也就是我们所说的做链接。 select * from friends f left JOIN users u on u.uid = f.userid

spring data jpa 多表联合查询 , 查询结果 List 为空无法映射

一方 package com.jpa.vo; import javax.persistence.*; import java.io.Serializable; @Entity @Table(name = "role") public class RoleVO implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "role_id") private Integer roleId; @Column(name = "role_name") private String roleName; @ManyToOne @JoinColumn(name="role_id",insertable = false , updatable = false) private UserVO userVO; } 多方 package com.jpa.vo; import javax.annotation.sql.DataSourceDefinition; import javax.persistence.*; import java.util.List; /** * 用户信息类 */ @Entity @Table(name="users") public class UserVO { @Column(name="role_id") private Integer roleId; @Id @Column(name = "user_id") @GeneratedValue private Integer userId; @Column( name="user_name") private String userName; @Column(name ="pass_word") private String password; @OneToMany( cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "userVO") List<RoleVO> roles; } spring data jpa 多表联合查询 , 查询结果 List 为空无法映射 { "roleId": 1, "userId": 1, "userName": "wuming", "password": "1234", "roles": [ {} ] }

spring data jpa 按条件分页查询问题

自定义分页查询方法,代码: ``` {"content":[],"totalPages":1,"totalElements":6,"last":true,"number":1,"size":10,"numberOfElements":0,"sort":null,"first":false} ``` totalElements 是6 但是content怎么是空的啊 ``` @Query("select t from TrainTeacher t where t.xm like %:xm%") Page<TrainTeacher> search(@Param("xm") String xm, Pageable pageable); ``` 返回结果

Spring data jpa 如何进行分页联表查询?

具体使用jpa方法:Page<T> findAll(Specification<T> spec, Pageable pageable); 查询语句:select t.vehicle_id,t.id_number,t.org_code,t.vehicleStatus,t4.TYPE_NAME,t1.TERMINAL_ID,t2.TTYPE_NAME,T3.SIM_NUM from V_VEHICLEINFO t left join T_TERMINALINFO t1 on t1.TERMINAL_ID=t.TERMINAL_ID left join T_TERMINALTYPE t2 on T2.TTYPE_ID=t1.TTYPE_ID left join T_SIMINFO t3 on t3.SIM_ID=t1.SIM_ID left join v_vehicletype t4 on T4.TYPE_ID=t.TYPE_ID;

spring data JPA 类型转换异常

工作中使用spring data jpa 遇到一个百思不得姐的问题,劳烦各位大佬帮忙指点迷津。,小老弟感激不尽!! DAO : package com.xhsceis.credit.repository.firstScreenRepository; import com.xhsceis.credit.entity.FsManageStatus; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; public interface FsManageStatusRepository extends JpaRepository<FsManageStatus,String> { @Query(value = "SELECT FS.changPing,FS.chaoYang FROM FsManageStatus FS") List<FsManageStatus> getFsManageStatus(); } SERVICE: List<FsManageStatus> fsManageStatusList = fsManageStatusRepository.getFsManageStatus(); for **(FsManageStatus fsManageStatus : fsManageStatusList)** { Map<String, Object> fsManage = Maps.newHashMap(); Map<String, Object> data = Maps.newHashMap(); data.put("changPing", fsManageStatus.getChangPing()); data.put("chaoYang", fsManageStatus.getChaoYang()); } ENTITY: @Entity @Table(name = "FS_MANAGE_STATUS") public class FsManageStatus { @Id @Column(name = "STATUS") private String status; @Column(name = "DONG_CHENG") private String dongCheng; @Column(name = "FENG_TAI") private String fengTai; @Column(name = "DA_XING") private String daXing; @Column(name = "MI_YUN") private String miYun; @Column(name = "PING_GU") private String pingGu; @Column(name = "YAN_QING") private String yanQing; @Column(name = "HUAI_ROU") private String huaiRou; @Column(name = "FANG_SHAN") private String fangShan; @Column(name = "CHANG_PING") private String changPing; @Column(name = "CHAO_YANG") private String chaoYang; @Column(name = "HAI_DIAN") private String haiDian; @Column(name = "SHI_JING_SHAN") private String shiJingShan; @Column(name = "XI_CHENG") private String xiCheng; @Column(name = "TONG_ZHOU") private String tongZhou; @Column(name = "MEN_TOU_GOU") private String menTouGou; @Column(name = "SHUN_YI") private String shunYi; @Column(name = "COUNT") private String count; 问题描述:service 查出来的数据对象集合,我遍历的时候,报错说类型转换异常 java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.xhsceis.credit.entity.FsManageStatus 我猜应该是jpa查到的数据没有给指定成集合对象来接收,而是自己默认为object存储的。这是我的猜想,最后,还是得麻烦大佬给解答一哈儿。

Spring data JPA使用CriteriaQuery进行不定条件查询时,发起了多次查询

//PlatformSecurityUser为账户信息实体,和用户基本信息platformSysUser存在一对一的映射关系,fetchType为lazy //在获取账户信息的同时,希望一次获取用户基本信息-platformSysUser import javax.persistence.*; import javax.persistence.criteria.*; import java.util.ArrayList; public class CustomPlatformSecurityUserDaoImpl implements CustomPlatformSecurityUserDao { @PersistenceContext EntityManager entityManager; @Override public Page<PlatformSecurityUser> dynamicQuery(PlatformSysUserAccountQueryConditionVO queryConditionVO, Pageable pageable) { CriteriaBuilder criteriaBuilder=entityManager.getCriteriaBuilder(); CriteriaQuery<PlatformSecurityUser> query=criteriaBuilder.createQuery(PlatformSecurityUser.class); Root< PlatformSecurityUser> root = query.from(PlatformSecurityUser.class); root.fetch("platformSysUser"); entityManager.createQuery(query).getResultList(); return null; } } 现在出现的问题是resultList里面有多少账户信息数据,就发起了多少次根据ID获取账户信息的查询,现在我希望只有一次查询,就是日志中的第一条SQL,请各位哥哥姐姐帮下忙。打印的日志如下(sql我进行过简化,把 里面的AS去掉了): Hibernate: select a.id, c.id, a.IS_DEL, a.CREATE_TIME, a.EFF_TIME, a.EXP_TIME, a.LAST_LOGIN_TIME, a.LOGIN_NAME, a.PASSWORD, a.PLATFORM_SYS_USER_ID, a.STATUS, a.TOKEN, c.IS_DEL, c.CREDENTIAL_NUMBER, c.CREDENTIAL_TYPE, c.EMAIL, c.MOBILE, c.NAME, c.SEX, c.USER_NUMBER, c.USER_TYPE from PLATFORM_SECURITY_USER a inner join PLATFORM_SYS_USER b on a.PLATFORM_SYS_USER_ID=b.id inner join PLATFORM_SYS_USER c on a.PLATFORM_SYS_USER_ID=c.id Hibernate: select a.id, a.IS_DEL, a.CREATE_TIME, a.EFF_TIME, a.EXP_TIME, a.LAST_LOGIN_TIME, a.LOGIN_NAME, a.PASSWORD, a.PLATFORM_SYS_USER_ID, a.STATUS, a.TOKEN from PLATFORM_SECURITY_USER a where a.PLATFORM_SYS_USER_ID=? Hibernate: select a.id, a.IS_DEL, a.CREATE_TIME, a.EFF_TIME, a.EXP_TIME, a.LAST_LOGIN_TIME, a.LOGIN_NAME, a.PASSWORD, a.PLATFORM_SYS_USER_ID, a.STATUS, a.TOKEN from PLATFORM_SECURITY_USER a where a.PLATFORM_SYS_USER_ID=? Hibernate: select a.id, a.IS_DEL, a.CREATE_TIME, a.EFF_TIME, a.EXP_TIME, a.LAST_LOGIN_TIME, a.LOGIN_NAME, a.PASSWORD, a.PLATFORM_SYS_USER_ID, a.STATUS, a.TOKEN from PLATFORM_SECURITY_USER a where a.PLATFORM_SYS_USER_ID=? Hibernate: select a.id, a.IS_DEL, a.CREATE_TIME, a.EFF_TIME, a.EXP_TIME, a.LAST_LOGIN_TIME, a.LOGIN_NAME, a.PASSWORD, a.PLATFORM_SYS_USER_ID, a.STATUS, a.TOKEN from PLATFORM_SECURITY_USER a where a.PLATFORM_SYS_USER_ID=?

spring data jpa 两张表 带条件 分页查询 如何查

![图片说明](https://img-ask.csdn.net/upload/201902/11/1549872937_437798.png) ![图片说明](https://img-ask.csdn.net/upload/201902/11/1549873147_755792.png) ![图片说明](https://img-ask.csdn.net/upload/201902/11/1549873200_94773.png) 两个实体类关联了 我应该 怎么 分页搜索 在按条件查询A 的时候把B 关联起来

请问 JPA 怎么使用左连接呀

需求是这样子的,例如user 有user_id,user__name字段,然后user表下有个子表叫,address,有address_id,user_id,address,三个字段.我想用user当主表left join 怎么用呢?好像是查不到的啊,因为user表中没有外键啊,用address可以,但是用address当主表的话那我只能看到有address的user啊,请问怎么弄呀,要死了

jpa使用left join的时候报错

springboot框架使用了jpa,写sql的时候使用了left join ,然后报错: 数据库是postgreSQL antlr.SemanticException: Path expected for join! at org.hibernate.hql.internal.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:385) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3903) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3689) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3567) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:708) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:564) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:278) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:206) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328) at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:347) at com.sun.proxy.$Proxy141.createQuery(Unknown Source) at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:298) at com.sun.proxy.$Proxy138.createQuery(Unknown Source) at com.ido85.party.education.common.base.BaseApplication.queryPageEntityCount(BaseApplication.java:86) ........ 图片说明](https://img-ask.csdn.net/upload/201705/17/1495015427_349234.png)

Spring boot 多表关联问题

有这样两张表,新闻表news、新闻追踪表tarcing_news(记录访问量) CREATE TABLE `news` ( `news_id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `content` text NOT NULL, PRIMARY KEY (`news_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `tracing_news` ( `tracing_id` int(11) NOT NULL AUTO_INCREMENT, `news_id` int(11) NOT NULL, PRIMARY KEY (`tracing_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 现使用spring data jpa实现查询新闻内容和其对应的阅读量,sql文如下: SELECT n.*, tt.count FROM news n, (SELECT t.news_id,COUNT(1) AS 'count' FROM tracing_news t GROUP BY news_id) tt WHERE n.news_id = tt.news_id 请问,如果是这样,实体和repository应该怎么写?

SpringBootJPA 多对多死循环

``` @DynamicInsert @DynamicUpdate @Builder @Entity @Data //生成getter,setter等函数 @AllArgsConstructor //生成全参数构造函数 @NoArgsConstructor //生成无参构造函数 @SuppressWarnings("unused")//去除黄色警告 @Table(name = "cs_album") public class CsAlbum { // 主键ID @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @ApiModelProperty(name = "id", value = "主键ID",hidden = true) private Long id; //用户id @Column(nullable=false,name="uId",columnDefinition="bigint COMMENT '用户id'") @ApiModelProperty(name = "uId", value = "用户id") private Long uId; @ManyToMany @JoinTable( //指定表名字 name = "cs_album_design_works", //配置维护放字段 joinColumns = @JoinColumn(name = "album_id",referencedColumnName = "id"), //配置被维护放字段 inverseJoinColumns = @JoinColumn(name = "design_works_id",referencedColumnName = "id") ) private List<CsDesignWorks> csDesignWorks = new ArrayList<>( ); } ``` 被维护表CsDesignWorks ``` @DynamicInsert @DynamicUpdate @Builder @Entity @Data //生成getter,setter等函数 @AllArgsConstructor //生成全参数构造函数 @NoArgsConstructor //生成无参构造函数 @SuppressWarnings("unused")//去除黄色警告 @Table(name = "cs_design_works") public class CsDesignWorks { // 主键ID @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @ApiModelProperty(name = "id", value = "主键ID",hidden = true) private Long id; @ManyToMany(mappedBy = "csDesignWorks") private List<CsAlbum> csAlbums = new ArrayList<>( ); } ``` Service类 ``` @Service @Transactional public class CsAlbumServiceImpl implements CsAlbumService { //根据id查询专辑内容 @Override public CsAlbum viewAlbum(Long id){ CsAlbum csAlbum = csAlbumRepository.findById( id ).get(); csAlbum.getCsDesignWorks(); return csAlbum; } } ``` 出现死循环为什么呢

询问关于最新版本这个的多表关联查询JoinType.INNER_JOIN该如何写,有类似的例子最好。

我写了这句会报错 Join<AppInfoPO, DictValuePO> appInfoJoin = Root.join( root.getModel().getSingularAttribute("dictValue", DictValuePO.class), JoinType.INNER_JOIN); 报出的异常如图所示,具体依赖版本为 compile 'org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE' ![图片说明](https://img-ask.csdn.net/upload/201612/29/1482996722_858309.png)

JPA的@JoinColumn 注解问题,提示外键列不能为空

源实体中使用@JoinColumn指定外键(为参考实体的主键): ``` @ManyToOne(cascade={CascadeType.REFRESH,CascadeType.DETACH}, optional=true, fetch = FetchType.LAZY) @JoinColumn(name="DD_TYPE_ID") private FieldDropdownType type; ``` 参考的FieldDropdownType 实体的主键: ``` @Id @Column(name="DD_TYPE_ID") @GeneratedValue(strategy = GenerationType.AUTO) private Long ddTypeId; ``` 问题: 浏览器端传递的json部分如下: ``` { "id": 10, ..., "type": { "ddTypeId": 1 }, ... } ``` 这是插入一条源实体的数据记录,id为源实体的主键值,type为@JoinColumn注解的属性,参考实体中存在ddTypeId为1的列。但请求时,服务端提示: ``` **[RMI TCP Connection(4)-192.168.2.37] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 1048, SQLState: 23000 [RMI TCP Connection(4)-192.168.2.37] ERROR org.hibernate.util.JDBCExceptionReporter - Column 'DD_TYPE_ID' cannot be null javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not insert: ** ``` 即DD_TYPE_ID列不能为空,但不是通过type属性传递了吗?如果不是这样传递,外键列的值应该是怎么设置的?

springData的JapRepository的SaveAndFlush返回值不唯一怎么办?

是这样的 我设计的表,插入数据库的时候主键是自动生成的,而这张表有2个外键 ``` Task task=new Task(); task.setStudent(student); task.setPosition(position); task.setEndTime(System.currentTimeMillis()+time*1000); //保存任务 taskService.save(task); ``` 第一次保存的时候没问题,但是第二次在保存的时候就有问题,我的student和position都是一样的, ``` Hibernate: insert into tasks (create_time, end_time, position_id, status, student_id) values (?, ?, ?, ?, ?) Hibernate: select task0_.id as id1_8_, task0_.create_time as create_t2_8_, task0_.end_date as end_date3_8_, task0_.end_time as end_time4_8_, task0_.position_id as position7_8_, task0_.start_date as start_da5_8_, task0_.status as status6_8_, task0_.student_id as student_8_8_ from tasks task0_ left outer join students student1_ on task0_.student_id=student1_.id left outer join positions position2_ on task0_.position_id=position2_.p_id where student1_.id=? and position2_.p_id=? ``` 他插入完数据库后 紧接着再select的时候查询条件是按照我这个student和position去查的 这肯定不唯一啊 然后就报错了:javax.persistence.NonUniqueResultException: result returns more than one elements 可是我又要保存多次相当于每次保存都要新增一条记录 明明我主键是自动生成的不唯一啊 怎么办啊

Hibernate通过@DynamicInsert注解实现动态插入不生效

插入和更新,对于空字段,生成的sql不想包含改字段,查了资料说使用这个的,但是,我的却没效果,和没使用是一样的,部分代码: import java.util.Date; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; /** * 系统用户表 添加动态插入和动态更新 */ @Entity @Table(name = "user", catalog = "showlove") @DynamicInsert(true) @DynamicUpdate(true) public class User extends BaseModel { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "userId", nullable = false) private Integer userId; /** * 角色Id,级联更新、刷新,懒加载 */ @ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.REFRESH,CascadeType.MERGE }) @JoinTable(name = "users_roles", joinColumns = @JoinColumn(name = "userId"), inverseJoinColumns = @JoinColumn(name = "roleId")) private Set<Role> roles; @Column(name = "username", length = 18, nullable = false) private String userName; @Column(name = "password", length = 18, nullable = false) private String password; @Column(name = "sex", length = 4, nullable = true) private String sex; @Column(name = "nickname", length = 16, nullable = true) …… 测试代码: @Test public void testUpdate(){ User user=new User(); user.setUserId(24); // Role role=new Role(); // role.setRoleId(1); user.setActivated(1); userService.update(user); } 生成的sql: update showlove.user set activated=?, age=?, createDate=?, email=?, nickname=?, password=?, phone=?, sex=?, username=? where userId=?

Spring 调用Repository的sava方法为什么会调用Entity的set方法?

Spring MVC + Spring Data Jpa + Spring Security + Tomcat,底层封装了hibernate 在我的Entity中有一个User类,User类里有一个密码的字段。 在 密码 的构造函数和set方法里面都对明文密码进行了加密操作。 问题出在我存入的时候。在Controller里面调用构造函数new了一个UserEntity, 然后调用一个Repository类的save方法。经过调试后我发现save方法会再调用我的 set方法,这就相当于在构造函数里加密了一次,又在set里加密了一次。 但是问题是前一阵用Spring-Boot学习也是在构造函数和set里面都对密码进行了加密。 但是并没有出现这样的问题。因此很好奇,求教各位大佬了。 代码贴在下面: 这是UserEntity的代码: ``` package com.carpool.domain; import com.carpool.website.service.EncryptionService; import javax.persistence.*; import java.io.Serializable; import java.util.Collection; /** * Created by qi on 2016/11/26. */ @Entity @Table public class UserEntity implements Serializable{ private String id; private String username; private String password; private byte gender; private double credit; private String alipay; private int coins; private Integer receivedComments; private Integer carpoolingCount; private String qqAccount; private String wechatAccount; private Collection<ChatRecordEntity> sendedChatRecord; private Collection<CommentEntity> commentsRecieved; private Collection<CommentEntity> commentsSended; private Collection<PaymentRecordEntity> paymentRecievedRecords; private Collection<PaymentRecordEntity> paymentSendRecords; private Collection<RoomEntity> ownRoom; private Collection<RoomEntity> hasPaysRoom; private Collection<RoomEntity> userParticipateRooms; public UserEntity() { } public UserEntity(String id, String username, String password, byte gender, double credit, String alipay, int coins, String qqAccount, String wechatAccount) { this.id = id; this.username = username; this.gender = gender; this.credit = credit; this.alipay = alipay; this.coins = coins; this.qqAccount = qqAccount; this.wechatAccount = wechatAccount; //pw encryption EncryptionService enp = new EncryptionService(); try{ this.password = enp.encipher(password) + enp.encipher(id); }catch(Exception e){ e.printStackTrace(); } } @Id @Column(name = "id", nullable = false, length = 10, unique = true) public String getId() { return id; } public void setId(String id) { this.id = id; } @Basic @Column(name = "username", nullable = false, length = 10) public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @Basic @Column(name = "password", nullable = false, length = 225) public String getPassword() { return password; } public void setPassword(String password) { EncryptionService enp = new EncryptionService(); try{ this.password = enp.encipher(password) + enp.encipher(id); }catch(Exception e){ e.printStackTrace(); } } @Basic @Column(name = "gender", nullable = false) public byte getGender() { return gender; } public void setGender(byte gender) { this.gender = gender; } @Basic @Column(name = "credit", nullable = false, precision = 0) public double getCredit() { return credit; } public void setCredit(double credit) { this.credit = credit; } @Basic @Column(name = "alipay", nullable = true, length = 20) public String getAlipay() { return alipay; } public void setAlipay(String alipay) { this.alipay = alipay; } @Basic @Column(name = "coins", nullable = false) public int getCoins() { return coins; } public void setCoins(int coins) { this.coins = coins; } @Basic @Column(name = "QQ_account", nullable = false, length = 20) public String getQqAccount() { return qqAccount; } public void setQqAccount(String qqAccount) { this.qqAccount = qqAccount; } @Basic @Column(name = "wechat_account", nullable = false, length = 20) public String getWechatAccount() { return wechatAccount; } public void setWechatAccount(String wechatAccount) { this.wechatAccount = wechatAccount; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserEntity that = (UserEntity) o; if (gender != that.gender) return false; if (Double.compare(that.credit, credit) != 0) return false; if (coins != that.coins) return false; if (id != null ? !id.equals(that.id) : that.id != null) return false; if (username != null ? !username.equals(that.username) : that.username != null) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false; if (alipay != null ? !alipay.equals(that.alipay) : that.alipay != null) return false; if (qqAccount != null ? !qqAccount.equals(that.qqAccount) : that.qqAccount != null) return false; if (wechatAccount != null ? !wechatAccount.equals(that.wechatAccount) : that.wechatAccount != null) return false; return true; } @Override public int hashCode() { int result; long temp; result = id != null ? id.hashCode() : 0; result = 31 * result + (username != null ? username.hashCode() : 0); result = 31 * result + (password != null ? password.hashCode() : 0); result = 31 * result + (int) gender; temp = Double.doubleToLongBits(credit); result = 31 * result + (int) (temp ^ (temp >>> 32)); result = 31 * result + (alipay != null ? alipay.hashCode() : 0); result = 31 * result + coins; result = 31 * result + (qqAccount != null ? qqAccount.hashCode() : 0); result = 31 * result + (wechatAccount != null ? wechatAccount.hashCode() : 0); return result; } @OneToMany(mappedBy = "sender") public Collection<ChatRecordEntity> getSendedChatRecord() { return sendedChatRecord; } public void setSendedChatRecord(Collection<ChatRecordEntity> chatrecordsById) { this.sendedChatRecord = chatrecordsById; } @OneToMany(mappedBy = "targetUser") public Collection<CommentEntity> getCommentsRecieved() { return commentsRecieved; } public void setCommentsRecieved(Collection<CommentEntity> commentsById) { this.commentsRecieved = commentsById; } @OneToMany(mappedBy = "sourceUser") public Collection<CommentEntity> getCommentsSended() { return commentsSended; } private void setCommentsSended(Collection<CommentEntity> commentsSended) { this.commentsSended = commentsSended; } @OneToMany(mappedBy = "targetUser") public Collection<PaymentRecordEntity> getPaymentRecievedRecords() { return paymentRecievedRecords; } public void setPaymentRecievedRecords(Collection<PaymentRecordEntity> paymentrecordsById) { this.paymentRecievedRecords = paymentrecordsById; } @OneToMany(mappedBy = "sourceUser") public Collection<PaymentRecordEntity> getPaymentSendRecords() { return paymentSendRecords; } public void setPaymentSendRecords(Collection<PaymentRecordEntity> paymentrecordsById_0) { this.paymentSendRecords = paymentrecordsById_0; } @OneToMany(mappedBy = "host") public Collection<RoomEntity> getOwnRoom() { return ownRoom; } public void setOwnRoom(Collection<RoomEntity> roomsById) { this.ownRoom = roomsById; } @OneToMany(mappedBy = "payer") public Collection<RoomEntity> getHasPaysRoom() { return hasPaysRoom; } public void setHasPaysRoom(Collection<RoomEntity> hasPaysRoom) { this.hasPaysRoom = hasPaysRoom; } @ManyToMany @JoinTable(name = "user_rooms", joinColumns = {@JoinColumn(name = "uid")}, inverseJoinColumns = {@JoinColumn(name = "rid")}) public Collection<RoomEntity> getUserParticipateRooms() { return userParticipateRooms; } public void setUserParticipateRooms(Collection<RoomEntity> userParticipateRooms) { this.userParticipateRooms = userParticipateRooms; } @Column(nullable = false) public Integer getReceivedComments() { return receivedComments; } public void setReceivedComments(Integer receivedComments) { this.receivedComments = receivedComments; } @Column public Integer getCarpoolingCount() { return carpoolingCount; } public void setCarpoolingCount(Integer carpoolingCount) { this.carpoolingCount = carpoolingCount; } } ``` 这是一个测试的TestContrller,主要看insertData方法: ``` package com.carpool.website.controller; import com.carpool.domain.UserEntity; import com.carpool.website.dao.UserEntityRepository; import com.carpool.website.service.ChatRecordService; import com.carpool.website.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; /** * Created by qi on 2016/11/26. */ @RestController @RequestMapping("/Test") public class TestController { @Autowired ChatRecordService chatRecordService; @Autowired UserService userService; @RequestMapping("/deleteChatRecord") String deleteChatRecordTest(){ try{ this.chatRecordService.deleteChatRecordById(10); return "True"; }catch(Exception e){ return "False"; } } @RequestMapping("/insert") boolean insertData(){ UserEntity userEntity = new UserEntity("12223","asssw","123456", (byte)2793314121856183",12,"123456","123456"); userEntity.setReceivedComments(0); try{ this.userService.saveStudent(userEntity); }catch(Exception e){ } return true; } } ```

spring加载错误,急求解!

加载ApplicationContext.xml>>>>>>>> 2009-08-14 10:48:54,875 [org.springframework.context.support.ClassPathXmlApplicationContext]-[INFO] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@c51355: display name [org.springframework.context.support.ClassPathXmlApplicationContext@c51355]; startup date [Fri Aug 14 10:48:54 PDT 2009]; root of context hierarchy 2009-08-14 10:48:54,968 [org.springframework.beans.factory.xml.XmlBeanDefinitionReader]-[INFO] Loading XML bean definitions from class path resource [applicationContext.xml] 2009-08-14 10:48:55,578 [org.springframework.context.support.ClassPathXmlApplicationContext]-[INFO] Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@c51355]: org.springframework.beans.factory.support.DefaultListableBeanFactory@e0b6f5 2009-08-14 10:48:55,609 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e0b6f5: defining beans [dataSource,sessionFactory,userdao,userbiz,test]; root of factory hierarchy 2009-08-14 10:48:55,734 [org.hibernate.cfg.Environment]-[INFO] Hibernate 3.3.1.GA 2009-08-14 10:48:55,734 [org.hibernate.cfg.Environment]-[INFO] hibernate.properties not found 2009-08-14 10:48:55,734 [org.hibernate.cfg.Environment]-[INFO] Bytecode provider name : javassist 2009-08-14 10:48:55,734 [org.hibernate.cfg.Environment]-[INFO] using JDK 1.4 java.sql.Timestamp handling 2009-08-14 10:48:55,953 [org.hibernate.cfg.HbmBinder]-[INFO] Mapping class: com.ext.portlet.spring.entity.User -> user 2009-08-14 10:48:55,968 [org.springframework.orm.hibernate3.LocalSessionFactoryBean]-[INFO] Building new Hibernate SessionFactory 2009-08-14 10:48:56,031 [org.hibernate.connection.ConnectionProviderFactory]-[INFO] Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider 2009-08-14 10:48:56,281 [org.hibernate.cfg.SettingsFactory]-[INFO] RDBMS: MySQL, version: 5.1.32-community 2009-08-14 10:48:56,281 [org.hibernate.cfg.SettingsFactory]-[INFO] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.7 ( $Date: 2007-03-09 22:13:57 +0100 (Fri, 09 Mar 2007) $, $Revision: 6341 $ ) 2009-08-14 10:48:56,296 [org.hibernate.dialect.Dialect]-[INFO] Using dialect: org.hibernate.dialect.MySQLDialect 2009-08-14 10:48:56,296 [org.hibernate.transaction.TransactionFactoryFactory]-[INFO] Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory 2009-08-14 10:48:56,296 [org.hibernate.transaction.TransactionManagerLookupFactory]-[INFO] No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Automatic flush during beforeCompletion(): disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Automatic session close at end of transaction: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] JDBC batch size: 15 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] JDBC batch updates for versioned data: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Scrollable result sets: enabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] JDBC3 getGeneratedKeys(): enabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Connection release mode: auto 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Maximum outer join fetch depth: 2 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Default batch fetch size: 1 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Generate SQL with comments: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Order SQL updates by primary key: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Order SQL inserts for batching: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 2009-08-14 10:48:56,296 [org.hibernate.hql.ast.ASTQueryTranslatorFactory]-[INFO] Using ASTQueryTranslatorFactory 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Query language substitutions: {} 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] JPA-QL strict compliance: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Second-level cache: enabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Query cache: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Optimize cache for minimal puts: disabled 2009-08-14 10:48:56,296 [org.hibernate.cfg.SettingsFactory]-[INFO] Structured second-level cache entries: disabled 2009-08-14 10:48:56,312 [org.hibernate.cfg.SettingsFactory]-[INFO] Statistics: disabled 2009-08-14 10:48:56,312 [org.hibernate.cfg.SettingsFactory]-[INFO] Deleted entity synthetic identifier rollback: disabled 2009-08-14 10:48:56,312 [org.hibernate.cfg.SettingsFactory]-[INFO] Default entity-mode: pojo 2009-08-14 10:48:56,312 [org.hibernate.cfg.SettingsFactory]-[INFO] Named query checking : enabled 2009-08-14 10:48:56,343 [org.hibernate.impl.SessionFactoryImpl]-[INFO] building session factory 2009-08-14 10:48:56,453 [org.springframework.beans.factory.support.DefaultListableBeanFactory]-[INFO] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@e0b6f5: defining beans [dataSource,sessionFactory,userdao,userbiz,test]; root of factory hierarchy Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at com.ext.portlet.spring.action.Test.main(Test.java:32) Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter at org.hibernate.bytecode.javassist.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:49) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:203) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:181) at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:158) at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:76) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:325) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:457) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:131) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 15 more

java内存溢出问题,不确定哪里出的问题

项目运行的时候出现了内存溢出情况,复现方式无法确定,大概出现了五六次,每次复现的方式都不一样,下面是我用MAT工具分析的dump文件 ![图片说明](https://img-ask.csdn.net/upload/202001/20/1579508231_612899.png) ![图片说明](https://img-ask.csdn.net/upload/202001/20/1579508244_502327.png) 除了hibernate里的那两个对象,其他的1000多万个对象里全是integer类型的对象 这是当时出现的时候产生的异常 ``` 2020-01-17 13:32:55 ERROR [DruidDataSource.java:2469] - create connection SQLException, url: jdbc:mysql://localhost:55060/mcs?useUnicode=true&characterEncoding=utf-8, errorCode 0, state 08S01 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 1 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3517) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3417) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3860) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:864) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1707) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1217) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.GeneratedConstructorAccessor118.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1513) at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1578) at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2466) Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2969) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3427) ... 19 more 2020-01-17 13:33:03 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_preset_rlat failed: java.lang.OutOfMemoryError: GC overhead limit exceeded at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.getBytes(MemoryEfficientByteArrayOutputStream.java:65) at net.sf.ehcache.util.MemoryEfficientByteArrayOutputStream.serialize(MemoryEfficientByteArrayOutputStream.java:99) at net.sf.ehcache.store.disk.DiskStorageFactory.serializeElement(DiskStorageFactory.java:405) at net.sf.ehcache.store.disk.DiskStorageFactory.write(DiskStorageFactory.java:384) at net.sf.ehcache.store.disk.DiskStorageFactory$DiskWriteTask.call(DiskStorageFactory.java:485) at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1088) at net.sf.ehcache.store.disk.DiskStorageFactory$PersistentDiskWriteTask.call(DiskStorageFactory.java:1072) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 2020-01-17 13:32:59 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:32:59 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:32:55 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:16 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:27 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:33:27 ERROR [SqlExceptionHelper.java:144] - wait millis 7401, active 16, maxActive 40, creating 1 2020-01-17 13:33:27 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:33:33 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:33 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:49 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:33:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:02 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:34:02 ERROR [SqlExceptionHelper.java:144] - wait millis 5503, active 18, maxActive 40, creating 1 2020-01-17 13:34:02 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:34:04 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:08 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:12 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:12 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:14 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:14 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:14 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:17 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:34:17 ERROR [SqlExceptionHelper.java:144] - wait millis 5485, active 19, maxActive 40, creating 1 2020-01-17 13:34:17 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; Could not open connection; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:34:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:27 INFO [DeviceCache.java:249] - 设备状态及报警维护过程中出现异常 2020-01-17 13:34:35 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:35 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:42 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:42 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:44 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:44 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:34:52 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:34:52 ERROR [SqlExceptionHelper.java:144] - wait millis 7301, active 22, maxActive 40, creating 1 2020-01-17 13:34:52 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-17 13:34:53 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:35:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_roll_preset failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-17 13:35:18 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:35:18 ERROR [SqlExceptionHelper.java:144] - Error 2020-01-17 13:35:50 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-17 13:35:50 ERROR [SqlExceptionHelper.java:144] - Error 2020-01-17 13:36:13 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:13 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-17 13:36:13 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:24 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-17 13:36:13 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:37:01 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-17 13:37:43 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-17 13:36:37 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:33 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-17 13:36:22 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 ``` 现在就是无法确定到底哪里导致的内存溢出? 这个是上次出现的异常和代码 ``` 2020-01-13 13:21:44 WARN [SqlExceptionHelper.java:143] - SQL Error: 1205, SQLState: 40001 2020-01-13 13:21:44 ERROR [SqlExceptionHelper.java:144] - Lock wait timeout exceeded; try restarting transaction 2020-01-13 13:23:55 INFO [MQTTProtocolHandler.java:283] - 接收到设备接入协议:{"topic":"info/deviceBaseInfo/BHIP118-S/00:00:01:A6:00:A2","reportTime":"256573751","decodeCapacity":{"totalLevel":2,"totalBlock":36,"totalPixel":16588800},"outputList":[{"status":"start","ratio":"UHD","pixel":"3840*2160","type":"UDP","url":"udp://231.0.100.80:7001"},{"status":"start","ratio":"HD","pixel":"960*540","type":"UDP","url":"udp://231.0.101.80:7001"},{"status":"start","ratio":"SD","pixel":"352*288","type":"UDP","url":"udp://231.0.102.80:7001"},{"status":"stop","ratio":"UHD","pixel":"3840*2160","type":"RTMP","url":"rtmp://192.168.15.80:1935/live/100"},{"status":"stop","ratio":"HD","pixel":"960*540","type":"RTMP","url":"rtmp://192.168.15.124:1935/live/101"},{"status":"stop","ratio":"SD","pixel":"352*288","type":"RTMP","url":"rtmp://192.168.15.80:1935/live/102"}],"baseInfo":{"deviceType":"BHIP118-S","code":"00:00:01:A6:00:A2","version":"v1.0.0.11","ip":"192.168.16.80"},"online":true} 2020-01-13 13:23:59 INFO [DeviceCache.java:127] - 接收到新增/更新设备信息:00:00:01:A6:00:A2 :BaseInfo [type=0,name=BHIP118-S,ip=192.168.16.80,port=0,code=00:00:01:A6:00:A2,groupCode=null,groupIndex=0,online=true,multiCastTime=0,ver=v1.0.0.11,channel=0,reserve=0,lockStatus=null,workMode=null,videoPixerls=null,kvmMode=null,serialNumber=null,sdipPortInfo is null,hdIpPortInfo is null,audioIpPortInfo is null,outputList[SourceOutput [ratio=UHD, url=udp://231.0.100.80:7001, pixel=3840*2160, channel=0, SourceOutput [ratio=HD, url=udp://231.0.101.80:7001, pixel=960*540, channel=0, SourceOutput [ratio=SD, url=udp://231.0.102.80:7001, pixel=352*288, channel=0, SourceOutput [ratio=UHD, url=rtmp://192.168.15.80:1935/live/100, pixel=3840*2160, channel=0, SourceOutput [ratio=HD, url=rtmp://192.168.15.124:1935/live/101, pixel=960*540, channel=0, SourceOutput [ratio=SD, url=rtmp://192.168.15.80:1935/live/102, pixel=352*288, channel=0],callStatus=null] 2020-01-13 13:24:06 INFO [MultiCastDeviceInfoHandler.java:229] - 更新视频合成器设备信息: Device [id=ff8080816f694555016f6a4bf61e158c, code=00:00:01:A6:00:A2, name=192.168.16.80, ip=192.168.16.80, port=0, status=0, type=BHIP118, deviceType=BHIP118-S, stamp=2020-01-03 15:26:00, abilityInfo=null, netCardInfo=null] 2020-01-13 13:24:53 INFO [MultiCastDeviceInfoHandler.java:364] - 更新解码器信息:Decoder [IP=192.168.16.80, Port=0, Channel=0, totalBlocks=36, totalLevel=2, uRefWidth=1920, uRefHeight=1080, audioPort=0, totalPixel=16588800, deviceTypeName=BHIP118-S, pixelsWidth=null, pixelsHeight=null] 2020-01-13 13:25:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:17 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:19 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:28 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:42 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-13 13:25:42 ERROR [SqlExceptionHelper.java:144] - wait millis 14463, active 11, maxActive 40, creating 1 2020-01-13 13:25:46 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_playback_task failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:25:48 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-13 13:25:50 ERROR [SqlExceptionHelper.java:144] - wait millis 18056, active 11, maxActive 40, creating 1 2020-01-13 13:25:50 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_source_volume failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:25:51 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:51 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:51 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [n/a]; SQL state [null]; error code [0]; Could not open connection; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-13 13:25:51 INFO [GetCWRCapHandler.java:114] - 解析录像服务器上报心跳协议过程中出现异常:org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection 2020-01-13 13:25:58 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_kvm failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:25:56 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:25:56 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:03 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_video_terminal failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_pic_layer failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_template failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:05 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_multicast_address failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_mass_source failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_pic_encoder_block failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_ipc_preset_group failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:08 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:13 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_video_terminal failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:17 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_record_layer_block failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:24 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_video_meeting failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_audio_preset_rlat failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_preset failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_layer_block failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:28 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:32 WARN [SqlExceptionHelper.java:143] - SQL Error: 0, SQLState: null 2020-01-13 13:26:32 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:32 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:32 ERROR [DiskStorageFactory.java:495] - Disk Write of mcs_encoder failed: java.lang.OutOfMemoryError: GC overhead limit exceeded 2020-01-13 13:26:52 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:27:07 ERROR [SqlExceptionHelper.java:144] - wait millis 20150, active 12, maxActive 40, creating 1 2020-01-13 13:26:50 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:46 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:46 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:41 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:41 ERROR [SqlExceptionHelper.java:144] - wait millis 23244, active 12, maxActive 40, creating 1 2020-01-13 13:26:41 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:26:41 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:29 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:25 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:07 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:07 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 2020-01-13 13:30:07 WARN [DruidDataSource.java:1258] - get connection timeout retry : 1 ``` 这个是组播上报的设备信息,因为组播是一秒钟上报了好几次,是不是这里一直占用着连接 ``` public void run() { try { ms = new MulticastSocket(multiCastPort);//建立组播套接字 ms.setReceiveBufferSize(65535); // ms.setNetworkInterface(NetworkInterface.getByInetAddress(localAddress)); ms.joinGroup(InetAddress.getByName(multiCastIP));//加入组播组 LogHome.getLog().info("正常启动监听" + localAddress.getHostAddress()); byte[] buffer = null; DatagramPacket dp = null; while (true) { try { if (IsStop) { break; } buffer = new byte[1400]; dp = new DatagramPacket(buffer, buffer.length); LogHome.getLog().debug("等待接受组播信息:"); ms.receive(dp); MultiCastInfoParser info = new MultiCastInfoParser(dp.getData()); DeviceCache.baseInfoOf1004Handler(info.parse()); } catch (Exception e) { if (IsStop) {// 如果换网卡可能会出问题 break; } else { if (ms.isClosed()) { ms = new MulticastSocket(multiCastPort); ms.setNetworkInterface(NetworkInterface.getByInetAddress(localAddress)); ms.joinGroup(InetAddress.getByName(multiCastIP)); } } LogHome.getLog().error("接受并设置组播信息失败",e); }finally{ Thread.sleep(1); } } } catch (Exception e) { e.printStackTrace(); try { if (listenerList.containsKey(localAddress.getHostAddress())) { listenerList.remove(localAddress.getHostAddress()); } } catch (Exception ex) { LogHome.getLog().error(ex); } } ```

纠结的了一上午ssh的问题

2010-6-6 11:05:07 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.19. 2010-6-6 11:05:07 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], rand om [true]. 2010-6-6 11:05:08 org.apache.coyote.http11.Http11AprProtocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2010-6-6 11:05:08 org.apache.coyote.ajp.AjpAprProtocol init 信息: Initializing Coyote AJP/1.3 on ajp-8009 2010-6-6 11:05:08 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 1494 ms 2010-6-6 11:05:08 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2010-6-6 11:05:08 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.24 2010-6-6 11:05:08 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deploying configuration descriptor host-manager.xml 2010-6-6 11:05:09 org.apache.catalina.startup.HostConfig deployDescriptor 信息: Deploying configuration descriptor manager.xml 2010-6-6 11:05:09 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory docs 2010-6-6 11:05:09 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory examples 2010-6-6 11:05:09 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 2010-6-6 11:05:09 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 2010-6-6 11:05:09 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory ROOT 2010-6-6 11:05:09 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory test_online 2010-6-6 11:05:11 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext 2010-06-06 11:05:11 Root WebApplicationContext: initialization started 2010-06-06 11:05:12 Refreshing org.springframework.web.context.support.XmlWebApp licationContext@8cd4db: display name [Root WebApplicationContext]; startup date [Sun Jun 06 11:05:12 CST 2010]; root of context hierarchy 2010-06-06 11:05:12 Looking for matching resources in directory tree [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\test_online\WEB-INF\classes ] 2010-06-06 11:05:12 Searching directory [C:\Program Files\Apache Software Founda tion\Tomcat 6.0\webapps\test_online\WEB-INF\classes] for files matching pattern [C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/test_online/WEB- INF/classes/bean-*.xml] 2010-06-06 11:05:12 Resolved location pattern [classpath:bean-*.xml] to resource s [file [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\test_onl ine\WEB-INF\classes\bean-action.xml], file [C:\Program Files\Apache Software Fou ndation\Tomcat 6.0\webapps\test_online\WEB-INF\classes\bean-hibernate.xml], file [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\test_online\WEB -INF\classes\bean-service.xml]] 2010-06-06 11:05:12 Loading XML bean definitions from file [C:\Program Files\Apa che Software Foundation\Tomcat 6.0\webapps\test_online\WEB-INF\classes\bean-acti on.xml] 2010-06-06 11:05:13 Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderF actoryImpl] 2010-06-06 11:05:14 Loading schema mappings from [META-INF/spring.schemas] 2010-06-06 11:05:14 Loaded schema mappings: {http://www.springframework.org/sche ma/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd , http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframe work/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema /context/spring-context-2.5.xsd=org/springframework/context/config/spring-contex t-2.5.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/ springframework/context/config/spring-context-2.5.xsd, http://www.springframewor k.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xs d, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springfram ework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/sche ma/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2. 5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springfram ework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schem a/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0 .xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframe work/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema /beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2 .0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/sprin gframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org /schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring- beans-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/ springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframewo rk.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-2.5.x sd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframewo rk/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/ tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http: //www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/ config/spring-jee-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop- 2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springfram ework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-ao p-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/spri ngframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema /lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.x sd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframewo rk/beans/factory/xml/spring-util-2.5.xsd} 2010-06-06 11:05:14 Found XML schema [http://www.springframework.org/schema/bean s/spring-beans-2.0.xsd] in classpath: org/springframework/beans/factory/xml/spri ng-beans-2.0.xsd 2010-06-06 11:05:14 Loading bean definitions 2010-06-06 11:05:14 No XML 'id' specified - using 'LoginAction' as bean name and [] as aliases 2010-06-06 11:05:14 No XML 'id' specified - using 'CheckAction' as bean name and [] as aliases 2010-06-06 11:05:14 Loading XML bean definitions from file [C:\Program Files\Apa che Software Foundation\Tomcat 6.0\webapps\test_online\WEB-INF\classes\bean-hibe rnate.xml] 2010-06-06 11:05:14 Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderF actoryImpl] 2010-06-06 11:05:14 Found XML schema [http://www.springframework.org/schema/bean s/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spri ng-beans-2.5.xsd 2010-06-06 11:05:14 Loading bean definitions 2010-06-06 11:05:14 Loading XML bean definitions from file [C:\Program Files\Apa che Software Foundation\Tomcat 6.0\webapps\test_online\WEB-INF\classes\bean-serv ice.xml] 2010-06-06 11:05:14 Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderF actoryImpl] 2010-06-06 11:05:14 Found XML schema [http://www.springframework.org/schema/bean s/spring-beans-2.0.xsd] in classpath: org/springframework/beans/factory/xml/spri ng-beans-2.0.xsd 2010-06-06 11:05:14 Loading bean definitions 2010-06-06 11:05:14 No XML 'id' specified - using 'UserCheckService' as bean nam e and [] as aliases 2010-06-06 11:05:14 No XML 'id' specified - using 'build' as bean name and [] as aliases 2010-06-06 11:05:14 Loaded 9 bean definitions from location pattern [classpath:b ean-*.xml] 2010-06-06 11:05:14 Bean factory for application context [org.springframework.we b.context.support.XmlWebApplicationContext@8cd4db]: org.springframework.beans.fa ctory.support.DefaultListableBeanFactory@3087f9 2010-06-06 11:05:14 9 beans defined in org.springframework.web.context.support.X mlWebApplicationContext@8cd4db: display name [Root WebApplicationContext]; start up date [Sun Jun 06 11:05:12 CST 2010]; root of context hierarchy 2010-06-06 11:05:15 Unable to locate MessageSource with name 'messageSource': us ing default [org.springframework.context.support.DelegatingMessageSource@137e2dc ] 2010-06-06 11:05:15 Unable to locate ApplicationEventMulticaster with name 'appl icationEventMulticaster': using default [org.springframework.context.event.Simpl eApplicationEventMulticaster@16e1111] 2010-06-06 11:05:15 Unable to locate ThemeSource with name 'themeSource': using default [org.springframework.ui.context.support.ResourceBundleThemeSource@5b5df0 ] 2010-06-06 11:05:15 Pre-instantiating singletons in org.springframework.beans.fa ctory.support.DefaultListableBeanFactory@3087f9: defining beans [LoginAction,Che ckAction,dataSource,sessionFactory,TestDAO,StudentsDAO,QuesttionDAO,UserCheckSer vice,build]; root of factory hierarchy 2010-06-06 11:05:15 Creating shared instance of singleton bean 'dataSource' 2010-06-06 11:05:15 Creating instance of bean 'dataSource' 2010-06-06 11:05:15 Eagerly caching bean 'dataSource' to allow for resolving pot ential circular references 2010-06-06 11:05:15 Finished creating instance of bean 'dataSource' 2010-06-06 11:05:15 Creating shared instance of singleton bean 'sessionFactory' 2010-06-06 11:05:15 Creating instance of bean 'sessionFactory' 2010-06-06 11:05:15 Eagerly caching bean 'sessionFactory' to allow for resolving potential circular references 2010-06-06 11:05:15 Returning cached instance of singleton bean 'dataSource' 2010-06-06 11:05:15 Invoking afterPropertiesSet() on bean with name 'sessionFact ory' 2010-06-06 11:05:15 Hibernate 3.2.7 2010-06-06 11:05:15 hibernate.properties not found 2010-06-06 11:05:15 Bytecode provider name : cglib 2010-06-06 11:05:15 using JDK 1.4 java.sql.Timestamp handling 2010-06-06 11:05:16 trying to resolve system-id [http://hibernate.sourceforge.ne t/hibernate-mapping-3.0.dtd] 2010-06-06 11:05:16 recognized hibernate namespace; attempting to resolve on cla sspath under org/hibernate/ 2010-06-06 11:05:16 located [http://hibernate.sourceforge.net/hibernate-mapping- 3.0.dtd] in classpath 2010-06-06 11:05:17 Mapping class: pro.ncbuct.bean.Questtion -> questtion 2010-06-06 11:05:17 Mapped property: id -> id 2010-06-06 11:05:17 Mapped property: title -> title 2010-06-06 11:05:17 Mapped property: score -> score 2010-06-06 11:05:17 Mapped property: answer -> answer 2010-06-06 11:05:17 Mapped property: option1 -> option1 2010-06-06 11:05:17 Mapped property: option2 -> option2 2010-06-06 11:05:17 Mapped property: option3 -> option3 2010-06-06 11:05:17 Mapped property: option4 -> option4 2010-06-06 11:05:17 trying to resolve system-id [http://hibernate.sourceforge.ne t/hibernate-mapping-3.0.dtd] 2010-06-06 11:05:17 recognized hibernate namespace; attempting to resolve on cla sspath under org/hibernate/ 2010-06-06 11:05:17 located [http://hibernate.sourceforge.net/hibernate-mapping- 3.0.dtd] in classpath 2010-06-06 11:05:17 Mapping class: pro.ncbuct.bean.Students -> students 2010-06-06 11:05:17 Mapped property: id -> id 2010-06-06 11:05:17 Mapped property: name -> name 2010-06-06 11:05:17 Mapped property: loginNum -> login_num 2010-06-06 11:05:17 Mapped property: num -> num 2010-06-06 11:05:17 trying to resolve system-id [http://hibernate.sourceforge.ne t/hibernate-mapping-3.0.dtd] 2010-06-06 11:05:17 recognized hibernate namespace; attempting to resolve on cla sspath under org/hibernate/ 2010-06-06 11:05:17 located [http://hibernate.sourceforge.net/hibernate-mapping- 3.0.dtd] in classpath 2010-06-06 11:05:17 Mapping class: pro.ncbuct.bean.Test -> test 2010-06-06 11:05:17 Mapped property: id -> id 2010-06-06 11:05:17 Mapped property: userId -> user_id 2010-06-06 11:05:17 Mapped property: questId -> quest_id 2010-06-06 11:05:17 Mapped property: SAns -> s_ans 2010-06-06 11:05:17 Mapped property: testScore -> test_score 2010-06-06 11:05:17 processing extends queue 2010-06-06 11:05:17 processing collection mappings 2010-06-06 11:05:17 processing native query and ResultSetMapping mappings 2010-06-06 11:05:17 processing association property references 2010-06-06 11:05:17 processing foreign key constraints 2010-06-06 11:05:17 Building new Hibernate SessionFactory 2010-06-06 11:05:17 Preparing to build session factory with filters : {} 2010-06-06 11:05:17 processing extends queue 2010-06-06 11:05:17 processing collection mappings 2010-06-06 11:05:17 processing native query and ResultSetMapping mappings 2010-06-06 11:05:17 processing association property references 2010-06-06 11:05:17 processing foreign key constraints 2010-06-06 11:05:17 Initializing connection provider: org.springframework.orm.hi bernate3.LocalDataSourceConnectionProvider 2010-06-06 11:05:18 RDBMS: MySQL, version: 5.1.45-community 2010-06-06 11:05:18 JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector- java-5.0.8 ( Revision: ${svn.Revision} ) 2010-06-06 11:05:18 Using dialect: org.hibernate.dialect.MySQLDialect 2010-06-06 11:05:18 Transaction strategy: org.springframework.orm.hibernate3.Spr ingTransactionFactory 2010-06-06 11:05:18 No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 2010-06-06 11:05:18 Automatic flush during beforeCompletion(): disabled 2010-06-06 11:05:18 Automatic session close at end of transaction: disabled 2010-06-06 11:05:18 JDBC batch size: 15 2010-06-06 11:05:18 JDBC batch updates for versioned data: disabled 2010-06-06 11:05:18 Scrollable result sets: enabled 2010-06-06 11:05:18 Wrap result sets: disabled 2010-06-06 11:05:18 JDBC3 getGeneratedKeys(): enabled 2010-06-06 11:05:18 Connection release mode: auto 2010-06-06 11:05:18 Maximum outer join fetch depth: 2 2010-06-06 11:05:18 Default batch fetch size: 1 2010-06-06 11:05:18 Generate SQL with comments: disabled 2010-06-06 11:05:18 Order SQL updates by primary key: disabled 2010-06-06 11:05:18 Order SQL inserts for batching: disabled 2010-06-06 11:05:18 Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFa ctory 2010-06-06 11:05:18 Using ASTQueryTranslatorFactory 2010-06-06 11:05:18 Query language substitutions: {} 2010-06-06 11:05:18 JPA-QL strict compliance: disabled 2010-06-06 11:05:18 Second-level cache: enabled 2010-06-06 11:05:18 Query cache: disabled 2010-06-06 11:05:18 Cache provider: org.hibernate.cache.NoCacheProvider 2010-06-06 11:05:18 Optimize cache for minimal puts: disabled 2010-06-06 11:05:18 Structured second-level cache entries: disabled 2010-06-06 11:05:18 Statistics: disabled 2010-06-06 11:05:18 Deleted entity synthetic identifier rollback: disabled 2010-06-06 11:05:18 Default entity-mode: pojo 2010-06-06 11:05:18 Named query checking : enabled 2010-06-06 11:05:18 building session factory 2010-06-06 11:05:18 Session factory constructed with filter configurations : {} 2010-06-06 11:05:18 instantiating session factory with properties: {java.runtime .name=Java(TM) SE Runtime Environment, sun.boot.library.path=C:\Program Files\Ja va\jdk1.6.0_18\jre\bin, java.vm.version=16.0-b13, shared.loader=, java.vm.vendor =Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, tomcat.util.buf.StringCache.byte.enable d=true, file.encoding.pkg=sun.io, user.country=CN, sun.java.launcher=SUN_STANDAR D, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specific ation, user.dir=C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin, java .runtime.version=1.6.0_18-b07, java.awt.graphicsenv=sun.awt.Win32GraphicsEnviron ment, hibernate.current_session_context_class=org.springframework.orm.hibernate3 .SpringSessionContext, java.endorsed.dirs=C:\Program Files\Apache Software Found ation\Tomcat 6.0/common/endorsed, os.arch=x86, java.io.tmpdir=C:\Program Files\A pache Software Foundation\Tomcat 6.0\temp, line.separator= , java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, java.naming .factory.url.pkgs=org.apache.naming, os.name=Windows 7, sun.jnu.encoding=GBK, ja va.library.path=C:\Program Files\Java\jdk1.6.0_18\bin;C:\Program Files\Apache So ftware Foundation\Tomcat 6.0\bin, java.specification.name=Java Platform API Spec ification, java.class.version=50.0, sun.management.compiler=HotSpot Client Compi ler, hibernate.transaction.factory_class=org.springframework.orm.hibernate3.Spri ngTransactionFactory, os.version=6.1, sun.io.useCanonCaches=false, user.home=C:\ Documents and Settings\Administrator, catalina.useNaming=true, user.timezone=Asi a/Shanghai, java.awt.printerjob=sun.awt.windows.WPrinterJob, java.specification. version=1.6, file.encoding=GBK, catalina.home=C:\Program Files\Apache Software F oundation\Tomcat 6.0, user.name=Administrator, java.class.path=C:\Program Files\ Apache Software Foundation\Tomcat 6.0/bin/bootstrap.jar;C:\Program Files\Java\jd k1.6.0_18/lib/tools.jar, hibernate.bytecode.use_reflection_optimizer=false, java .naming.factory.initial=org.apache.naming.java.javaURLContextFactory, package.de finition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,o rg.apache.jasper., java.vm.specification.version=1.0, sun.arch.data.model=32, ja va.home=C:\Program Files\Java\jdk1.6.0_18\jre, hibernate.dialect=org.hibernate.d ialect.MySQLDialect, java.specification.vendor=Sun Microsystems Inc., user.langu age=zh, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.vers ion=1.6.0_18, java.ext.dirs=C:\Program Files\Java\jdk1.6.0_18\jre\lib\ext;C:\Win dows\Sun\Java\lib\ext, sun.boot.class.path=C:\Program Files\Java\jdk1.6.0_18\jre \lib\resources.jar;C:\Program Files\Java\jdk1.6.0_18\jre\lib\rt.jar;C:\Program F iles\Java\jdk1.6.0_18\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.6.0_18\j re\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_18\jre\lib\jce.jar;C:\Program Fil es\Java\jdk1.6.0_18\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_18\jre\c lasses, java.vendor=Sun Microsystems Inc., server.loader=, catalina.base=C:\Prog ram Files\Apache Software Foundation\Tomcat 6.0, file.separator=\, java.vendor.u rl.bug=http://java.sun.com/cgi-bin/bugreport.cgi, hibernate.connection.provider_ class=org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider, comm on.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,$ {catalina.home}/lib/*.jar, sun.cpu.endian=little, sun.io.unicode.encoding=Unicod eLittle, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache. tomcat.,org.apache.jasper.,sun.beans., sun.desktop=windows, sun.cpu.isalist=pent ium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86} 2010-06-06 11:05:19 Destroying singletons in org.springframework.beans.factory.s upport.DefaultListableBeanFactory@3087f9: defining beans [LoginAction,CheckActio n,dataSource,sessionFactory,TestDAO,StudentsDAO,QuesttionDAO,UserCheckService,bu ild]; root of factory hierarchy 2010-06-06 11:05:19 Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean wit h name 'sessionFactory' defined in file [C:\Program Files\Apache Software Founda tion\Tomcat 6.0\webapps\test_online\WEB-INF\classes\bean-hibernate.xml]: Invocat ion of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTu plizer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory $1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab stractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSi ngleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abst ractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra ctBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra ctBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst antiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFac toryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(Abstr actApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(Co ntextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(Cont extLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(Con textLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java: 3972) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7 91) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964 ) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: org.hibernate.HibernateException: Unable to instantiate default tupli zer [org.hibernate.tuple.entity.PojoEntityTuplizer] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTup lizerFactory.java:110) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(En tityTuplizerFactory.java:135) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEn tityModeToTuplizerMapping.java:56) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:323) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntity Persister.java:433) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTable EntityPersister.java:109) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFacto ry.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:814) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFacto ry(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertie sSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 39 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces sorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc torAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTup lizerFactory.java:107) ... 52 more Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy .java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java: 216) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLaz yInitializer.java:117) at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyF actory.java:43) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTu plizer.java:188) at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTupli zer.java:128) at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java :78) ... 57 more Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.CodeVisitor at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1484) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1329) ... 70 more 2010-6-6 11:05:19 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class or g.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean wit h name 'sessionFactory' defined in file [C:\Program Files\Apache Software Founda tion\Tomcat 6.0\webapps\test_online\WEB-INF\classes\bean-hibernate.xml]: Invocat ion of init method failed; nested exception is org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTu plizer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .initializeBean(AbstractAutowireCapableBeanFactory.java:1338) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .doCreateBean(AbstractAutowireCapableBeanFactory.java:473) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory $1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Ab stractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSi ngleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abst ractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra ctBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(Abstra ctBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInst antiateSingletons(DefaultListableBeanFactory.java:423) at org.springframework.context.support.AbstractApplicationContext.finishBeanFac toryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refresh(Abstr actApplicationContext.java:380) at org.springframework.web.context.ContextLoader.createWebApplicationContext(Co ntextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(Cont extLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(Con textLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java: 3972) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7 91) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964 ) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:593) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: org.hibernate.HibernateException: Unable to instantiate default tupli zer [org.hibernate.tuple.entity.PojoEntityTuplizer] at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTup lizerFactory.java:110) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(En tityTuplizerFactory.java:135) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEn tityModeToTuplizerMapping.java:56) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:323) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntity Persister.java:433) at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTable EntityPersister.java:109) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFacto ry.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:814) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFacto ry(LocalSessionFactoryBean.java:732) at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertie sSet(AbstractSessionFactoryBean.java:211) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory .initializeBean(AbstractAutowireCapableBeanFactory.java:1335) ... 39 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces sorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc torAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTup lizerFactory.java:107) ... 52 more Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:165) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy .java:25) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java: 216) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69) at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLaz yInitializer.java:117) at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyF actory.java:43) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTu plizer.java:188) at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTupli zer.java:128) at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java :78) ... 57 more Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.CodeVisitor at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1484) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav a:1329) ... 70 more 2010-6-6 11:05:19 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2010-6-6 11:05:19 org.apache.catalina.core.StandardContext start 严重: Context [/test_online] startup failed due to previous errors 2010-6-6 11:05:19 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 2010-6-6 11:05:19 org.apache.catalina.loader.WebappClassLoader clearReferencesJd bc 严重: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but fai led to unregister it when the web application was stopped. To prevent a memory l eak, the JDBC Driver has been forcibly unregistered. 2010-6-6 11:05:19 org.apache.catalina.loader.WebappClassLoader clearReferencesTh reads 严重: A web application appears to have started a thread named [Timer-0] but has f ailed to stop it. This is very likely to create a memory leak. 2010-6-6 11:05:19 org.apache.catalina.loader.WebappClassLoader clearReferencesTh reads 严重: A web application appears to have started a thread named [MySQL Statement Ca ncellation Timer] but has failed to stop it. This is very likely to create a mem ory leak. 2010-6-6 11:05:19 org.apache.catalina.loader.WebappClassLoader clearThreadLocalM ap 严重: A web application created a ThreadLocal with key of type [null] (value [com. sun.faces.config.ConfigureListener$1@18c4d8e]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To preven t a memory leak, the ThreadLocal has been forcibly removed. 2010-6-6 11:05:19 org.apache.catalina.loader.WebappClassLoader clearThreadLocalM ap 严重: A web application created a ThreadLocal with key of type [org.springframewor k.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a v alue of type [null] (value [null]) but failed to remove it when the web applicat ion was stopped. To prevent a memory leak, the ThreadLocal has been forcibly rem oved.

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

ArrayList源码分析(入门篇)

ArrayList源码分析 前言: 写这篇博客的主要原因是,在我上一次参加千牵科技Java实习生面试时,有被面试官问到ArrayList为什么查找的速度较快,插入和删除的速度较慢?当时我回答得不好,很大的一部分原因是因为我没有阅读过ArrayList源码,虽然最后收到Offer了,但我拒绝了,打算寒假学得再深入些再广泛些,下学期开学后再去投递其他更好的公司。为了更加深入理解ArrayList,也为

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

玩转springboot启动banner定义所得

最近接手了一个springboot项目,不是不熟悉这个框架,启动时打印的信息吸引了我。 这不是我熟悉的常用springboot的打印信息啊,我打开自己的项目: 还真是的,不用默认的感觉也挺高大上的。一时兴起,就去研究了一下源代码,还正是有些收获,稍后我会总结一下。正常情况下做为一个老程序员,是不会对这种小儿科感兴趣的,不就是一个控制台打印嘛。哈哈! 于是出于最初的好奇,研究了项目的源代码。看到

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

立即提问
相关内容推荐