So singleton beans will also got a lazy load after DataSource, right? Thanks, Scott.
ps. Do you have time to look at my previous post about how to config jca connection pool max-active-time? ----- Original Message ----- From: "Scott Ferguson" <[EMAIL PROTECTED]> To: "General Discussion for the Resin application server" <[email protected]> Sent: Tuesday, April 22, 2008 10:35 PM Subject: Re: [Resin-interest] <database> config should be initialized beforeany singleton beans > > On Apr 22, 2008, at 2:45 AM, wesley wrote: > >> Hi Scott, >> >> I'm upgrading snap080331 to snap080417. I found my hibernate >> persistence unit not >> working, with no jta-data-source configured. >> I added 080417 src into my project and traced for a while and found >> the reason. > > This is something I worked on yesterday. The next snapshot should > have the fix. > > The fix involves making the persistence.xml lookup of the dataSource > lazy, so it only occurs using web-app start time, not at > persistence.xml start. > > -- Scott > >> >> >> I put an breakpoint at com.caucho.naming.Jndi.bindImpl(...) line:91 >> and recorded >> the jndi resources registered at order below: >> "java:comp/env/jmx/MBeanServer" ... >> "java:comp/env/jmx/GlobalMBeanServer" ... >> "java:comp/UserTransaction" ... >> "java:comp/TransactionManager" ... >> "java:/TransactionManager" ... >> "java:comp/ThreadPool" >> "java:comp/env/caucho/persistent-store" >> and then my singleton beans were then initialized, then >> "java:comp/env/jdbc/stock" // my <database> config in resin- >> web.xml >> "java:comp/env/activemq" // my <connection-factory> config >> in resin-web.xml >> >> Some of singleton beans need to access database by inject a EMF, so >> amber start to >> load persistence unit. During parsing the persistence.xml, the xml >> config will set the >> "jta-data-source" property of the >> com.caucho.amber.cfg.PersistenceUnitConfig object >> by reflection. Before doing it, it will call JNDI.lookup to find the >> DataSource with name >> specified in persistence.xml, of cource nothing found! It was not >> registered yet! >> >> I switched to snapshot080331 binary and still retained some src of >> 080417 (src package: >> com.caucho.amber, com.caucho.config, com.caucho.naming) then traced >> it again. >> This time I recored the the jndi resources registered at order below >> "java:comp/env/jmx/MBeanServer" ... >> "java:comp/env/jmx/GlobalMBeanServer" ... >> "java:comp/UserTransaction" ... >> "java:comp/TransactionManager" ... >> "java:/TransactionManager" ... >> "java:comp/ThreadPool" >> "java:comp/env/caucho/persistent-store" >> "java:comp/env/jdbc/stock" // my <database> config in resin- >> web.xml >> "java:comp/env/activemq" // my <connection-factory> config >> in resin-web.xml >> and then my singleton beans were then initialized. >> This is the right sequence. >> >> Though I didnot do further test, I think problem were not belonged >> to the three packages >> I retained during the two snapshot version switch. >> >> Suggestions are appreciated, thanks. >> >> -Wesley >> >> >> _______________________________________________ >> resin-interest mailing list >> [email protected] >> http://maillist.caucho.com/mailman/listinfo/resin-interest > > > > _______________________________________________ > resin-interest mailing list > [email protected] > http://maillist.caucho.com/mailman/listinfo/resin-interest > _______________________________________________ resin-interest mailing list [email protected] http://maillist.caucho.com/mailman/listinfo/resin-interest
