LazyInitializationException when accessing sample wiki pages that comes with Confluence
Asked by tmjee:

```
[net.sf.hibernate.LazyInitializationException] &lt;init&gt; Failed to lazily initialize a collection - no session or session was closed -- page: 98309 | contextPath: /confluence | action: viewpage
```

```
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed    at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209)    at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)    at net.sf.hibernate.collection.Bag.iterator(Bag.java:256)    at com.atlassian.confluence.util.LabelUtil.extractLabelsFromLabellings(LabelUtil.java:516)    at com.atlassian.confluence.core.AbstractLabelableEntityObject.getLabels(AbstractLabelableEntityObject.java:28)    at com.atlassian.confluence.labels.PermittedLabelView.getVisibleLabels(PermittedLabelView.java:62)    at com.atlassian.confluence.labels.PermittedLabelView.getLabels(PermittedLabelView.java:34)    at com.atlassian.confluence.core.AbstractLabelableEntityObject.getVisibleLabels(AbstractLabelableEntityObject.java:63)    at com.atlassian.confluence.pages.actions.AbstractPageAction.getLabels(AbstractPageAction.java:323)    at com.atlassian.confluence.pages.actions.AbstractPageAction.getNumberOfLabelsAsString(AbstractPageAction.java:333)    at com.atlassian.confluence.pages.actions.AbstractPageAction.getWebInterfaceContext(AbstractPageAction.java:308)    at com.atlassian.confluence.pages.actions.ViewPageAction.getWebInterfaceContext(ViewPageAction.java:734)    at sun.reflect.GeneratedMethodAccessor413.invoke(Unknown Source)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)    at java.lang.reflect.Method.invoke(Method.java:601)    at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:142)    at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:533)    at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:198)    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)    at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:507)    at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:155)    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)    at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:507)    at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:282)    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)    at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)    at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)    at org.apache.velocity.runtime.directive.Parse.render(Parse.java:263)    at com.atlassian.confluence.setup.velocity.ProfilingParseDirective.render(ProfilingParseDirective.java:24)    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)    at org.apache.velocity.Template.merge(Template.java:328)    at org.apache.velocity.Template.merge(Template.java:235)    at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:84)    at com.atlassian.confluence.util.velocity.VelocityUtils.renderTemplateWithoutSwallowingErrors(VelocityUtils.java:95)    at com.atlassian.confluence.util.velocity.VelocityUtils.getRenderedTemplateWithoutSwallowingErrors(VelocityUtils.java:73)    at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:182)    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)    at org.apache.velocity.runtime.directive.VelocimacroProxy.render(VelocimacroProxy.java:212)    at org.apache.velocity.runtime.directive.RuntimeMacro.render(RuntimeMacro.java:247)    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)....
```

Hi

```

```

```
On confluence 5.3, when installed with the sample wiki, accessing one of the sample wiki pages, i got this.
```

```
it might be when velocity rendering it somehow access a hibernate entity that when hibernate session is already out of scope.
```

```
From the wiki it says somehting like confluence only wrap transaction capabilities on manager, anyway anyone seeing
```

```
as well? or is it just me ....
```

```

```

```
Thanks in advance .
```


Answers:
author: hsuhailah
body: This sample page that you were referring to, is it coming from Demonstration Space? Usually this happened because there is a layout customization in place that's interfering with the process. can you check on the space level from the space setting if there's any layout customization in place? If there is, back it up, reset the setting back to default and see how it goes.