EDITED
Hi ek
I'm currently running into the exact same problem as you did. Doing a lookup for the Hibernate SessionFactory, the fscontext JNDI implementation returns null instead of the expected SessionFactory.
I did the same tests as you did :
- trying with a misspelled name returns NameNotFoundException instead of null
- I can bind and lookup with no problems some other test objects
- the .binding file is present on the file system where expected
It seams that other people have had great success with this approach as we can read here :
viewtopic.php?f=1&t=978070&p=2360776&hilit=standalone+JNDI+sessionfactory#p2360776and here
viewtopic.php?f=1&t=963485&hilit=standalone+jndi+sessionfactoryso I was wondering if you did find any solution to that strange problem that is getting on my nerves for a few days now.
Please let me know if you did succeed even if you don't remember how :)
Thanks a lot in advance.
EDITED:
Ok, so I guess we are in the 'I reply to myself' thread ;)
What you mean is that you have to configure hibernate (most probably with a different config, much simpler containing only the jndi stuf) BEFORE your lookup gets any chance to return a SessionFactory that's not null. So, no need to use a 'real' lookup just initialise your Hibernate with a config file that contains the JNDI name.
What i'm trying to do is this :
We have many users on one Windows server each running their own Eclipse RCP app in a different Windows session (via Terminal Server). Every time a user starts his app, the time needed to start the hibernate SessionFactory makes that our app is slow to start.
I figured that binding the SessionFactory to a JNDI context would do that the hibernate startup would be done once for all users speeding up every app startup. Just like we do in a application server environment. Not to mention the use of common and persistent caches (Queries, second level) for all users.
What i get now, is the exact same slow startup time because i still have to configure the hibernate SessionFactory. I don't even really know if the SessionFactory object i get is really the one bound in the JNDI context by my previous bind...
Maybe am I just misunderstanding something? Can anyone give me a hint ???
I would really, really appreciate that, thanks to all
My conf :
hibernate 3.3.0.SP1
fscontext 1.2 beta 3
windows XP pro SP3 in VMWare Player / XP pro SP3