Java-由于堆空间而导致内存不足错误

时间:2020-07-30 05:04:44

标签: java spring hibernate out-of-memory heap-memory

下面是日志::::

[WorkManager.springBatch : 30] ERROR [SwiftSystemMessageMDB] - Failed onMessage
java.lang.OutOfMemoryError: Java heap space
    at org.hibernate.util.IdentityMap.get(IdentityMap.java:134) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.engine.StatefulPersistenceContext.getCollectionEntry(StatefulPersistenceContext.java:389) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.engine.Collections.processDereferencedCollection(Collections.java:48) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.engine.Collections.processUnreachableCollection(Collections.java:39) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.event.def.AbstractFlushingEventListener.flushCollections(AbstractFlushingEventListener.java:218) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:77) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1690) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811) ~[hibernate-3.2.5.ga-im.jar:3.2.5.ga]
    at com.im.pcam.jdbc.contractualsettlement.CsCaBasisRuleHibernate.searchCSCABasisRuleFromUI(CsCaBasisRuleHibernate.java:90) ~[PCAM-EJB-Client-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]

获取以上错误日志 下面是代码 我由于Java堆空间而出现内存不足错误,除了增加堆空间之外,我不知道该怎么办。调用唯一结果时出现错误,尽管我有对主键执行的查询,所以 只有一个结果。

 public CsCaBasisRule searchCSCABasisRuleFromUI(CsRulesSearchCriteria csRulesSearchCriteria) {
        CsCaBasisRule csCaBasisRule = null;
        Session session = InitSessionFactory.getInstance().getCurrentSession();
        Criteria crit = session.createCriteria(CsCaBasisRule.class);
        
        if (StringUtils.isNotBlank(csRulesSearchCriteria.getRuleBasisCd())) {
            crit.add(Expression.eq("csRuleSet.ruleSetId", csRulesSearchCriteria.getRuleSetId()));
        }
        if (csRulesSearchCriteria.getRuleId() != null) {
            crit.add(Expression.eq("ruleId", csRulesSearchCriteria.getRuleId()));
        }

        csCaBasisRule = (CsCaBasisRule) crit.uniqueResult();
        Object[] caFields = (Object[]) session
                .getNamedQuery("com.im.pcam.datatypes.contractualsettlement.CsCaBasisRule.selectCsCaBAsisRuleInfo")
                .setLong(0, csCaBasisRule.getRuleId()).uniqueResult();

0 个答案:

没有答案