Re: [Resin-interest] database config shouldbeinitializedbeforeanysingleton beans
As you can see for yourself the bug is still marked as open in Mantis so it will probably/hopefully be fixed until next release. If you want to increase the chances of the bug being fixed soon (and have a workaround meanwhile), fix it yourself and attach your suggested patch to the bug report. /Mattias - Original Message - Subject: Re: [Resin-interest] config shouldbeinitializedbeforeanysingleton beans Date: Thu, 8 May 2008 01:30:35 +0800 From: wesley Hi Scott, Congratulations for the new release. It seems that 3.1.6 release does not have this bug fixed. It's really a stop bug for me and prevents the whole webapp from starting. -Wesley - Original Message - From: Scott Ferguson To: General Discussion for the Resin application server Sent: Monday, May 05, 2008 9:54 PM Subject: Re: [Resin-interest] config shouldbeinitializedbeforeany singleton beans On May 4, 2008, at 8:39 PM, wesley wrote: I've set logging to finer and found datasource being initialized after AmberContainer parsing persistence.xml. After some tracing, I think the issue is also an order problem. After resin server initialized, it began to init the webapp, at the order below: 1. Look at persistence.xml and try to init an AmberContainer. 2. Parse resin-web.xml to init DataSource, JCA connectors, EJBs and Singletons. Note, at the first step method getJtaDataSource() of com.caucho.amber.cfg.PersistenceUnitConfig will be called. It tried to find a DataSource in JNDI and failed, because a DataSource will be available in JNDI until the 2nd step finished. Ok. This use of PersistenceUnitConfig should be lazy. Resin can register the PersistenceUnit/PersistenceContext before initializing the provider. thanks, I'd missed that case. http://bugs.caucho.com/view.php?id=2648 I'm using hibernate persistence provider. Now I'm frustrated. How could we managed to garantee these init orders? 1. First of all, DataSource in resin-web.xml to make sure a DataSource being registered. 2. persisence.xml to make sure any @PersistenceUnit and @PersistenceContext injection available. * This would be split into two parts: registering the @PersistenceUnit and a later start() phase. 3. JCA connectors (if any) in resin-web.xml. * 4. EJBs in resin-web.xml (if any). Why should EJBs be initialized after persistence.xml? It may need to inject a @PersistenceUnit. EJBs also have a 2-phase init process, so the same idea applies. -- Scott 5. Singletons in resin-web.xml. * 2 3 may be reversed. Any ideas? -Wesley - Original Message - From: Scott Ferguson To: General Discussion for the Resin application server Sent: Monday, May 05, 2008 6:11 AM Subject: Re: [Resin-interest] config should beinitializedbeforeany singleton beans On May 4, 2008, at 1:17 PM, wesley wrote: Hi Scott, Is this issue resolved in snapshot0502? I've tried 0502 snapshot and found my singleton beans still throwing the same exception: java.lang.UnsupportedOperationException: The user must supply a JDBC connection I believe that the same problem still exists: DataSource SHOULD be initialized and be put in JNDI registry before the singletons try to find it. That should be a different issue. That stack trace is happening at the end of the initialization, so all the data sources would already be initialized. If you set the logging to finer do you see the database getting registered? -- Scott stacktrace at web-app initialing phase == [04:08:57.373] {resin-15} java.lang.UnsupportedOperationException: The user must supply a JDBC connection [04:08:57.373] {resin-15} at org .hibernate .connection .UserSuppliedConnectionProvider .getConnection(UserSuppliedConnectionProvider.java:30) [04:08:57.373] {resin-15} at org .hibernate .jdbc.ConnectionManager.openConnection(ConnectionManager.java:423) [04:08:57.373] {resin-15} at org .hibernate .jdbc.ConnectionManager.getConnection(ConnectionManager.java:144) [04:08:57.373] {resin-15} at org .hibernate .jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java: 139) [04:08:57.373] {resin-15} at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547) [04:08:57.373] {resin-15} at org.hibernate.loader.Loader.doQuery(Loader.java:673) [04:08:57.373] {resin-15} at org .hibernate .loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java: 236) [04:08:57.373] {resin-15} at org.hibernate.loader.Loader.doList(Loader.java:2213) [04:08:57.373] {resin-15} at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) [04:08:57.373] {resin-15} at org.hibernate.loader.Loader.list(Loader.java:2099) [04:08:57.373] {resin-15} at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378) [04:08:57.373]
Re: [Resin-interest] database config shouldbeinitializedbeforeanysingleton beans
This issue may be a little hard for me to fix due to the lazy loading of DataSource. I'll wait for the next release. :-) Thanks. -Wesley - Original Message - From: Mattias Jiderhamn [EMAIL PROTECTED] To: resin-interest@caucho.com Sent: Thursday, May 08, 2008 2:22 AM Subject: Re: [Resin-interest] database config shouldbeinitializedbeforeanysingleton beans As you can see for yourself the bug is still marked as open in Mantis so it will probably/hopefully be fixed until next release. If you want to increase the chances of the bug being fixed soon (and have a workaround meanwhile), fix it yourself and attach your suggested patch to the bug report. /Mattias - Original Message - Subject: Re: [Resin-interest] config shouldbeinitializedbeforeanysingleton beans Date: Thu, 8 May 2008 01:30:35 +0800 From: wesley Hi Scott, Congratulations for the new release. It seems that 3.1.6 release does not have this bug fixed. It's really a stop bug for me and prevents the whole webapp from starting. -Wesley - Original Message - From: Scott Ferguson To: General Discussion for the Resin application server Sent: Monday, May 05, 2008 9:54 PM Subject: Re: [Resin-interest] config shouldbeinitializedbeforeany singleton beans On May 4, 2008, at 8:39 PM, wesley wrote: I've set logging to finer and found datasource being initialized after AmberContainer parsing persistence.xml. After some tracing, I think the issue is also an order problem. After resin server initialized, it began to init the webapp, at the order below: 1. Look at persistence.xml and try to init an AmberContainer. 2. Parse resin-web.xml to init DataSource, JCA connectors, EJBs and Singletons. Note, at the first step method getJtaDataSource() of com.caucho.amber.cfg.PersistenceUnitConfig will be called. It tried to find a DataSource in JNDI and failed, because a DataSource will be available in JNDI until the 2nd step finished. Ok. This use of PersistenceUnitConfig should be lazy. Resin can register the PersistenceUnit/PersistenceContext before initializing the provider. thanks, I'd missed that case. http://bugs.caucho.com/view.php?id=2648 I'm using hibernate persistence provider. Now I'm frustrated. How could we managed to garantee these init orders? 1. First of all, DataSource in resin-web.xml to make sure a DataSource being registered. 2. persisence.xml to make sure any @PersistenceUnit and @PersistenceContext injection available. * This would be split into two parts: registering the @PersistenceUnit and a later start() phase. 3. JCA connectors (if any) in resin-web.xml. * 4. EJBs in resin-web.xml (if any). Why should EJBs be initialized after persistence.xml? It may need to inject a @PersistenceUnit. EJBs also have a 2-phase init process, so the same idea applies. -- Scott 5. Singletons in resin-web.xml. * 2 3 may be reversed. Any ideas? -Wesley - Original Message - From: Scott Ferguson To: General Discussion for the Resin application server Sent: Monday, May 05, 2008 6:11 AM Subject: Re: [Resin-interest] config should beinitializedbeforeany singleton beans On May 4, 2008, at 1:17 PM, wesley wrote: Hi Scott, Is this issue resolved in snapshot0502? I've tried 0502 snapshot and found my singleton beans still throwing the same exception: java.lang.UnsupportedOperationException: The user must supply a JDBC connection I believe that the same problem still exists: DataSource SHOULD be initialized and be put in JNDI registry before the singletons try to find it. That should be a different issue. That stack trace is happening at the end of the initialization, so all the data sources would already be initialized. If you set the logging to finer do you see the database getting registered? -- Scott stacktrace at web-app initialing phase == [04:08:57.373] {resin-15} java.lang.UnsupportedOperationException: The user must supply a JDBC connection [04:08:57.373] {resin-15} at org .hibernate .connection .UserSuppliedConnectionProvider .getConnection(UserSuppliedConnectionProvider.java:30) [04:08:57.373] {resin-15} at org .hibernate .jdbc.ConnectionManager.openConnection(ConnectionManager.java:423) [04:08:57.373] {resin-15} at org .hibernate .jdbc.ConnectionManager.getConnection(ConnectionManager.java:144) [04:08:57.373] {resin-15} at org .hibernate .jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java: 139) [04:08:57.373] {resin-15} at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547) [04:08:57.373] {resin-15} at org.hibernate.loader.Loader.doQuery(Loader.java:673) [04:08:57.373] {resin-15} at org .hibernate .loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java