Yea, it may not be "allowed", but it works anyway, and it's simple.
I don't know of a container that explicitly prevents it.
The biggest problem is managing any potential class loader shenanigans. If you have multiple deploy applications talking to the same singleton, you could easily have class and classloader issues. But even those can be mitigated.
But if you don't, it's a trivial and effective pattern to use. It won't work in a clustered environment either.
Otherwise, you're talking an external resource that has to manage all of those issue for you (whether something as simple as a shared DB or more complicated like a custom JCA component).
But if you want something simple, lightweight, and effective, then go for a singleton.
I tend to be pragmatic go for the simplest solution until it fails me, rather than overcomplicating something for a potentially never encountered edge case. But I don't know your environment, so...
[Message sent by forum member 'whartung' (whartung)]
http://forums.java.net/jive/thread.jspa?messageID=274395