Skip to content

Lazy initialization error with LOG4J turned on - failed to lazily initialize a collection of role: ...no session or session was closed [SPR-8342] #12990

Closed
@spring-projects-issues

Description

@spring-projects-issues

Sujith Radhakrishnan opened SPR-8342 and commented

With log4J set to DEBUG ALL, I get the following error when a client access the server via amf remote-messaging.

INFO: [ERROR,LazyInitializationException] failed to lazily initialize a collection of role: ...., no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.switchpt.tbm.entity.Projects.tbmJobDescs, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375)
at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:122)
at org.hibernate.collection.PersistentSet.size(PersistentSet.java:162)
at org.springframework.core.style.DefaultValueStyler.style(DefaultValueStyler.java:104)
at org.springframework.core.style.DefaultValueStyler.style(DefaultValueStyler.java:72)

It works fine if i disable the log.

Looks like the issue is caused by line# 159 in GenericConversionService.java:
156 public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
157 assertNotNull(sourceType, targetType);
158 if (logger.isDebugEnabled()) {
159 logger.debug("Converting value " + StylerUtils.style(source) + " of " + sourceType + " to " + targetType);
160 }
161 if (sourceType == TypeDescriptor.NULL) {

The log is trying to deserialize the data causing the issue...


Affects: 3.0.5

Issue Links:

2 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions