I had configured the OpenSessionInViewFilter as expected and yet I was still encountering this error.
After much debugging and code tracing in hibernate and in spring, it boiled down to the spring class
SessionFactoryUtils requiring the the sessionFactory instance be the same in the DAOs and in the filter.
After dumping out the identity of the session factories using System.identityHashCode() method, I discovered that they were in fact different instances hence the:
"no session or session closed" error message!
Why do I have multiple session factories?
It's because in the web.xml and the spring XML configuration it was read twice!
See the following link for more details
http://forum.springsource.org/showthread.php?t=85782
Once I reconfigured spring to only load each configuration file only once, the error message went away!
Tips and experience about developing websites with various technologies
Monday, November 1, 2010
Wednesday, October 13, 2010
Windows 7 Wireless Crash
According to Microsoft:
“This issue tends to occur when you select a Wireless LAN from 5 or more access points. (…) This problem occurs because the message handling for Wireless connection is not fast enough and causes overflow in the message queue,”
Here is the official bug report on Microsoft's website:
http://support.microsoft.com/kb/979244/
However, they don't mention any realy solutions, other than to move your computer away from too many wireless access points. Not a real solution at all.
One user reported in detail the pain he went through and the solution he used to get it working:
http://blogs.techrepublic.com.com/window-on-windows/?p=2342
The solution?
Disable IPv6
“This issue tends to occur when you select a Wireless LAN from 5 or more access points. (…) This problem occurs because the message handling for Wireless connection is not fast enough and causes overflow in the message queue,”
Here is the official bug report on Microsoft's website:
http://support.microsoft.com/kb/979244/
However, they don't mention any realy solutions, other than to move your computer away from too many wireless access points. Not a real solution at all.
One user reported in detail the pain he went through and the solution he used to get it working:
http://blogs.techrepublic.com.com/window-on-windows/?p=2342
The solution?
Disable IPv6
Lazy Loading with Java's InvocationHandler
To make the most of performance, we typically don't want to eagerly load everything on a DAO Transfer object. We can use Java's InvocationHandler to proxy method calls. Here's a good read on how to do it:
http://blog.frankel.ch/the-power-of-proxies-in-java
http://blog.frankel.ch/the-power-of-proxies-in-java
Monday, October 11, 2010
Wednesday, October 6, 2010
AJAX and accessing DIV elements
In Firefox I encountered a strange problem when using AJAX to access DIV elements.
I was using a timer to repetitively access a DIV element as follows:
Javascript:
On the first timed interval, firefox has no problem finding the element and the alert identifies it as an HTMLElement object. But upon subsequent timed intervals, the alert begins to report the statusEl as null!! Very strange indeed.
The solution ended up being to change from <div id="status" />
to <div id="status"></div>
I was using a timer to repetitively access a DIV element as follows:
Javascript:
var statusEl = document.getElementById('status');HTML:
alert('statusEl'+statusEl);
<div id="status" />
On the first timed interval, firefox has no problem finding the element and the alert identifies it as an HTMLElement object. But upon subsequent timed intervals, the alert begins to report the statusEl as null!! Very strange indeed.
Solution:
The solution ended up being to change from <div id="status" />
to <div id="status"></div>
Tuesday, October 5, 2010
Differentiating objects in Java
Use System.identityHashCode(obj) to differentiate objects in java
Subscribe to:
Posts (Atom)