You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
(16) |
Apr
(18) |
May
(13) |
Jun
(100) |
Jul
(165) |
Aug
(53) |
Sep
(41) |
Oct
(84) |
Nov
(113) |
Dec
(171) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(84) |
Feb
(30) |
Mar
(75) |
Apr
(113) |
May
(87) |
Jun
(96) |
Jul
(127) |
Aug
(106) |
Sep
(191) |
Oct
(142) |
Nov
(106) |
Dec
(83) |
| 2010 |
Jan
(62) |
Feb
(93) |
Mar
(92) |
Apr
(58) |
May
(52) |
Jun
(104) |
Jul
(109) |
Aug
(94) |
Sep
(75) |
Oct
(54) |
Nov
(65) |
Dec
(38) |
| 2011 |
Jan
(53) |
Feb
(84) |
Mar
(95) |
Apr
(24) |
May
(10) |
Jun
(49) |
Jul
(74) |
Aug
(23) |
Sep
(67) |
Oct
(21) |
Nov
(62) |
Dec
(50) |
| 2012 |
Jan
(26) |
Feb
(7) |
Mar
(9) |
Apr
(5) |
May
(13) |
Jun
(7) |
Jul
(18) |
Aug
(48) |
Sep
(58) |
Oct
(79) |
Nov
(19) |
Dec
(15) |
| 2013 |
Jan
(33) |
Feb
(21) |
Mar
(10) |
Apr
(22) |
May
(39) |
Jun
(31) |
Jul
(15) |
Aug
(6) |
Sep
(8) |
Oct
(1) |
Nov
(4) |
Dec
(3) |
| 2014 |
Jan
(17) |
Feb
(18) |
Mar
(15) |
Apr
(12) |
May
(11) |
Jun
(3) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(4) |
Nov
(4) |
Dec
(1) |
| 2015 |
Jan
|
Feb
(6) |
Mar
(5) |
Apr
(13) |
May
(2) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(6) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
| 2016 |
Jan
(10) |
Feb
(3) |
Mar
(8) |
Apr
(4) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2017 |
Jan
(6) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Gendler, S. <Sam...@we...> - 2013-04-19 18:04:47
|
I was planning to test the post-merge codebase, but I am unable to build resteasy. If I skip tests, it fails with the following compiler error (Java 1.6.0_5 - not my fault, it's a work computer): [ERROR] \workspaces\src\spring-app\Resteasy\jaxrs\resteasy-client\src\main\java\org\jboss\resteasy\client\jaxrs\internal\ClientInvocationBuilder.java:[220,33] type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object And if I enable tests, I get many failures as a result of "Mime map can't be loaded" as reported in: https://issues.jboss.org/browse/RESTEASY-811 If anyone can talk me past those hurdles, I'm still happy to test, but I don't have cycles to try to fight through them on my own at the moment, sorry. I sent a sample project to the list yesterday, which manifests the bug, but it got sequestered due to message size. I'm not sure if it ever made it to the list (and then I sent my first attempt with this message as a reply to my previously oversized message, so I'm sending this again, this time without the attachment. Sorry for the duplication, folks). --sam -----Original Message----- From: Bill Burke [mailto:bb...@re...] Sent: Thursday, April 18, 2013 6:27 AM To: res...@li... Subject: Re: [Resteasy-developers] spring bean processor bug k, pull request merged. let me know how it goes On 4/18/2013 8:30 AM, Solomon Duskis wrote: > Samuel, > > I submitted a merge request for this. I think that there would be > great value if you (and others with the same problem) would test out the fix. > We have some excellent unit tests, but this problem relates to > subtleties in the Spring lifecycle and requires situation specific > testing. If your testing is successful, perhaps we can work on > creating an additional unit test for resteasy. > > -Solomon > > > On Wed, Apr 17, 2013 at 10:33 PM, Solomon Duskis <sd...@gm... > <mailto:sd...@gm...>> wrote: > > Thank you for the careful analysis. I'll see if I can work around > this issue using other approaches relating to the Spring lifecycle. > I fixed a similar issue a while back with @Providers, and might be > able to use the same approach for ResteasyRegistration. > > I hope to check in something tomorrow. Since this is a nuanced > issue, I think that this change would benefit from field testing. > Would you feel comfortable with being beta testers for this change? > > -Solomon > > > On Wed, Apr 17, 2013 at 7:37 PM, Gendler, Samuel > <Sam...@we... > <mailto:Sam...@we...>> wrote: > > So it proved to be even more subtle than just the existence of a > factory bean. It has to be a factory bean that doesn't declare > the type of objects it will create - which is probably limited > only to things like JndiObjectFactoryBean. The FactoryBean > interface declares a method called getObjectType() which is > explicitly supposed to return null if the type of the object is > not known in advance. The following is from the javadoc for > FactoryBean:____ > > __ __ > > Returns:____ > > the type of object that this FactoryBean creates, or null if not > known at the time of the call____ > > __ __ > > When I created a factory bean that specifies a type in > getObjectType(), the properties were not initialized during the > SpringBeanProcessor's call to getBeansOfType(). When I created > a factory bean that returns null, my properties get initialized > with the values before property placeholder has done its thing > because it actually asks the factory for the bean in order to > determine the type, so it must initialize it first. I'm not > quite sure what the fix to this would be, since the logic of > what is going on in SpringBeanProcessor isn't entirely clear to > me, but it does appear to be a bug on the resteasy side of > things. Somehow, this code needs to execute after property > placeholder replacement (this seems to be the case in resteast > 2.2.3.GA <http://2.2.3.GA>, which still contains calls to > getBeansOfType(), but doesn't trigger this bug, so something is > happening to change the order of events).____ > > __ __ > > *From:*Gendler, Samuel > *Sent:* Wednesday, April 17, 2013 4:05 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* RE: spring bean processor bug____ > > __ __ > > One further piece of info - the javadoc for getBeansOfType() > says that factories will be initialized in order to check the > type of returned objects. My jndiTemplate is referenced by a > bean created via a factory, and I suspect that this is why it is > causing the jndiTemplate to be initialized while beans that have > identical properties but are not used by factories are not > initialized until much later and only after property placeholder > replacement has occurred. I haven't actually verified this > hypothesis, but it seems likely. My factory beans are declared > as follows:____ > > __ __ > > <bean id="sonicJmsTradeConnectionFactory" > > class="org.springframework.jms.connection.UserCredentialsConnectionFac > toryAdapter">____ > > <property name="targetConnectionFactory">____ > > <bean > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" > />____ > > <property name="jndiName">____ > > <value>${jndi.ConnectionFactory}</value>____ > > </property>____ > > </bean>____ > > </property>____ > > <property name="username">____ > > <value>${jndi.user}</value>____ > > </property>____ > > <property name="password">____ > > <value>${jndi.password}</value>____ > > </property>____ > > </bean>____ > > __ __ > > <bean id="destination" > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" />____ > > <property name="jndiName">____ > > <value>${jndi.TopicName}</value>____ > > </property>____ > > </bean>____ > > __ __ > > My guess is that it is actually incorrect to utilize the > getBeansOfType() methods in an application context which is not > yet completely initialized. At the same time, I don't really > understand why setting the order to LOWEST_PRECEDENCE doesn't > fix the problem unless something internal to spring is ignoring > the suggested ordering.____ > > __ __ > > *From:*Gendler, Samuel [mailto:Sam...@we...] > *Sent:* Wednesday, April 17, 2013 3:36 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* [Resteasy-developers] spring bean processor bug____ > > __ __ > > I recently upgraded a project from 2.2.3.GA <http://2.2.3.GA> to > 2.3.6.FINAL and encountered a bug that appears to originate in > the SpringBeanProcessor and which breaks property placeholder > variable replacement in certain spring beans.____ > > __ __ > > I haven't completely unwound the bug to the root cause, but I've > gotten close enough to be confident that someone with more > resteasy knowledge can likely address it much more quickly than > I can.____ > > __ __ > > First, the symptoms:____ > > __ __ > > I have a bean of class org.springframework.jndi.JndiTemplate > declared as follows:____ > > __ __ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContext > Factory</prop>____ > > <prop > key="java.naming.provider.url">${jndi.url}</prop>____ > > <prop > key="java.naming.security.principal">${jndi.user}</prop>____ > > <prop > > key="java.naming.security.credentials">${jndi.password}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>____ > > <prop key="clientId">${jndi.clientId}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop> > ____ > > <prop key="timeToLive">${jndi.timeToLive}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>___ > _ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > I have a property placeholder that is most definitely > initialized with values for all of those properties. I can set > the same values in a test object and see that they are correctly > replaced. However, for reasons that I'll get into in a moment, > the jndiTemplate properties are NOT replaced and it receives the > raw ${...} strings instead. Needless to say, this breaks my > project. Switching back to 2.2.3.GA <http://2.2.3.GA> > definitely fixes it without making any other changes.____ > > __ __ > > What I've discovered so far about the cause:____ > > __ __ > > In SpringBeanProcessor.postProcessBeanFactory(), a method called > findResteasyRegistrations() is called. That method, in turn, > calls the following:____ > > __ __ > > beanFactory.getBeansOfType(ResteasyRegistration.class);____ > > __ __ > > That method call causes some beans (but not all beans) to be > instantiated, and any beans that are instantiated at that point > do not have property placeholder values replaced in them, > because the property placeholder processor has (apparently) not > yet executed. What I haven't figured out is why my jndiTemplate > bean is impacted by this, while another bean that I created > simply to test the creation of properties inside of a bean > definition is not. It is apparently skipped over by the > getBeansOfType(ResteasyRegistration.class) and property > replacement happens correctly in that case.____ > > __ __ > > Initially, I suspected that this was a problem with post > processor ordering. This was somewhat vexing as the > SpringBeanProcessor does implement the PriorityOrdered > interface, but exposes no mechanism for modifying the order > value. I created my own version of SpringContextLoaderListener > which forgoes the use of SpringContextLoaderSupport and performs > the same work, but also calls setOrder(x) on the > SpringBeanProcessor before adding it to the postprocessors and > application listeners. However, that didn't seem to have any > impact, no matter in which relative order I placed the property > placeholder and the spring bean processor.____ > > __ __ > > For one final data point, if I don't use a property placeholder, > but instead reference a properties object via Spring-EL in the > XML, then the values are correctly replaced, because the > spring-el is evaluated when the xml is parsed (I assume), while > property placeholders are definitely evaluated lazily, long > after the bean definitions are created by the xml parsing > process.____ > > __ __ > > <util:properties id="jmsProperties" > location="file:${catalina.base}/conf/jms.properties"/>____ > > ____ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContext > Factory____ > > </prop>____ > > <prop > > key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>____ > > <prop > > key="java.naming.security.principal">#{jmsProperties['jndi.user']}</pr > op>____ > > <prop > > key="java.naming.security.credentials">#{jmsProperties['jndi.password' > ]}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain'] > }</prop>____ > > <prop > key="clientId">#{jmsProperties['jndi.clientId']}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop> > ____ > > <prop > > key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.tim > eout']}</prop>____ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > This works, but is a kludge. I'd much prefer to have > property-placeholding actually functional, especially since it > is apparently impossible to predict which beans will fail to > have properties replaced. Looking at the sourec code to > jndiTemplate, I can see no obvious reason why it is treated > differently than my own test bean. Both have no annotations and > both receive a java.util.Properties object as a property. The > behavior is consistent no matter what order they appear in my > context xml file.____ > > __ __ > > I've attached my replacement SpringContextLoaderListener just > for reference, in case someone else wants to modify the ordering > of the placeholders while testing or fixing this. The relevant > web.xml entries are below:____ > > __ __ > > <context-param>____ > > <param-name>resteasy.postprocessor.order</param-name>____ > > <param-value>0</param-value>____ > > </context-param>____ > > __ __ > > <listener>____ > > <listener-class>____ > > > > org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener- > class>____ > > </listener>____ > > __ __ > > <listener>____ > > <!-- > > listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderLi > stener</listener-class-->____ > > <listener-class>____ > > > > com.westernasset.compliance.util.SpringContextLoaderListener____ > > </listener-class>____ > > </listener>____ > > __ __ > > ********************************************************************** > E-mail sent through the Internet is not secure. Western Asset > therefore recommends that you do not send any confidential or > sensitive information to us via electronic mail, including > social security numbers, account numbers, or personal > identification numbers. Delivery, and or timely delivery of > Internet mail is not guaranteed. Western Asset therefore > recommends that you do not send time sensitive or > action-oriented messages to us via electronic mail. > ********************************************************************** > ____ > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs > for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free > account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > <mailto:Res...@li...> > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > > > > ---------------------------------------------------------------------- > -------- Precog is a next-generation analytics platform capable of > advanced analytics on semi-structured data. The platform includes APIs > for building apps and a phenomenal toolset for data science. > Developers can use our toolset for easy data analysis & visualization. > Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Resteasy-developers mailing list Res...@li... https://lists.sourceforge.net/lists/listinfo/resteasy-developers |
|
From: Gendler, S. <Sam...@we...> - 2013-04-18 17:39:18
|
I'm planning to create a standalone test app that demonstrates the problem with minimum configuration, anyway, so I'll send that to the list. It should be sufficient to test this going forward. -----Original Message----- From: Bill Burke [mailto:bb...@re...] Sent: Thursday, April 18, 2013 6:27 AM To: res...@li... Subject: Re: [Resteasy-developers] spring bean processor bug k, pull request merged. let me know how it goes On 4/18/2013 8:30 AM, Solomon Duskis wrote: > Samuel, > > I submitted a merge request for this. I think that there would be > great value if you (and others with the same problem) would test out the fix. > We have some excellent unit tests, but this problem relates to > subtleties in the Spring lifecycle and requires situation specific > testing. If your testing is successful, perhaps we can work on > creating an additional unit test for resteasy. > > -Solomon > > > On Wed, Apr 17, 2013 at 10:33 PM, Solomon Duskis <sd...@gm... > <mailto:sd...@gm...>> wrote: > > Thank you for the careful analysis. I'll see if I can work around > this issue using other approaches relating to the Spring lifecycle. > I fixed a similar issue a while back with @Providers, and might be > able to use the same approach for ResteasyRegistration. > > I hope to check in something tomorrow. Since this is a nuanced > issue, I think that this change would benefit from field testing. > Would you feel comfortable with being beta testers for this change? > > -Solomon > > > On Wed, Apr 17, 2013 at 7:37 PM, Gendler, Samuel > <Sam...@we... > <mailto:Sam...@we...>> wrote: > > So it proved to be even more subtle than just the existence of a > factory bean. It has to be a factory bean that doesn't declare > the type of objects it will create - which is probably limited > only to things like JndiObjectFactoryBean. The FactoryBean > interface declares a method called getObjectType() which is > explicitly supposed to return null if the type of the object is > not known in advance. The following is from the javadoc for > FactoryBean:____ > > __ __ > > Returns:____ > > the type of object that this FactoryBean creates, or null if not > known at the time of the call____ > > __ __ > > When I created a factory bean that specifies a type in > getObjectType(), the properties were not initialized during the > SpringBeanProcessor's call to getBeansOfType(). When I created > a factory bean that returns null, my properties get initialized > with the values before property placeholder has done its thing > because it actually asks the factory for the bean in order to > determine the type, so it must initialize it first. I'm not > quite sure what the fix to this would be, since the logic of > what is going on in SpringBeanProcessor isn't entirely clear to > me, but it does appear to be a bug on the resteasy side of > things. Somehow, this code needs to execute after property > placeholder replacement (this seems to be the case in resteast > 2.2.3.GA <http://2.2.3.GA>, which still contains calls to > getBeansOfType(), but doesn't trigger this bug, so something is > happening to change the order of events).____ > > __ __ > > *From:*Gendler, Samuel > *Sent:* Wednesday, April 17, 2013 4:05 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* RE: spring bean processor bug____ > > __ __ > > One further piece of info - the javadoc for getBeansOfType() > says that factories will be initialized in order to check the > type of returned objects. My jndiTemplate is referenced by a > bean created via a factory, and I suspect that this is why it is > causing the jndiTemplate to be initialized while beans that have > identical properties but are not used by factories are not > initialized until much later and only after property placeholder > replacement has occurred. I haven't actually verified this > hypothesis, but it seems likely. My factory beans are declared > as follows:____ > > __ __ > > <bean id="sonicJmsTradeConnectionFactory" > > class="org.springframework.jms.connection.UserCredentialsConnectionFac > toryAdapter">____ > > <property name="targetConnectionFactory">____ > > <bean > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" > />____ > > <property name="jndiName">____ > > <value>${jndi.ConnectionFactory}</value>____ > > </property>____ > > </bean>____ > > </property>____ > > <property name="username">____ > > <value>${jndi.user}</value>____ > > </property>____ > > <property name="password">____ > > <value>${jndi.password}</value>____ > > </property>____ > > </bean>____ > > __ __ > > <bean id="destination" > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" />____ > > <property name="jndiName">____ > > <value>${jndi.TopicName}</value>____ > > </property>____ > > </bean>____ > > __ __ > > My guess is that it is actually incorrect to utilize the > getBeansOfType() methods in an application context which is not > yet completely initialized. At the same time, I don't really > understand why setting the order to LOWEST_PRECEDENCE doesn't > fix the problem unless something internal to spring is ignoring > the suggested ordering.____ > > __ __ > > *From:*Gendler, Samuel [mailto:Sam...@we...] > *Sent:* Wednesday, April 17, 2013 3:36 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* [Resteasy-developers] spring bean processor bug____ > > __ __ > > I recently upgraded a project from 2.2.3.GA <http://2.2.3.GA> to > 2.3.6.FINAL and encountered a bug that appears to originate in > the SpringBeanProcessor and which breaks property placeholder > variable replacement in certain spring beans.____ > > __ __ > > I haven't completely unwound the bug to the root cause, but I've > gotten close enough to be confident that someone with more > resteasy knowledge can likely address it much more quickly than > I can.____ > > __ __ > > First, the symptoms:____ > > __ __ > > I have a bean of class org.springframework.jndi.JndiTemplate > declared as follows:____ > > __ __ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContext > Factory</prop>____ > > <prop > key="java.naming.provider.url">${jndi.url}</prop>____ > > <prop > key="java.naming.security.principal">${jndi.user}</prop>____ > > <prop > > key="java.naming.security.credentials">${jndi.password}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>____ > > <prop key="clientId">${jndi.clientId}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop> > ____ > > <prop key="timeToLive">${jndi.timeToLive}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>___ > _ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > I have a property placeholder that is most definitely > initialized with values for all of those properties. I can set > the same values in a test object and see that they are correctly > replaced. However, for reasons that I'll get into in a moment, > the jndiTemplate properties are NOT replaced and it receives the > raw ${...} strings instead. Needless to say, this breaks my > project. Switching back to 2.2.3.GA <http://2.2.3.GA> > definitely fixes it without making any other changes.____ > > __ __ > > What I've discovered so far about the cause:____ > > __ __ > > In SpringBeanProcessor.postProcessBeanFactory(), a method called > findResteasyRegistrations() is called. That method, in turn, > calls the following:____ > > __ __ > > beanFactory.getBeansOfType(ResteasyRegistration.class);____ > > __ __ > > That method call causes some beans (but not all beans) to be > instantiated, and any beans that are instantiated at that point > do not have property placeholder values replaced in them, > because the property placeholder processor has (apparently) not > yet executed. What I haven't figured out is why my jndiTemplate > bean is impacted by this, while another bean that I created > simply to test the creation of properties inside of a bean > definition is not. It is apparently skipped over by the > getBeansOfType(ResteasyRegistration.class) and property > replacement happens correctly in that case.____ > > __ __ > > Initially, I suspected that this was a problem with post > processor ordering. This was somewhat vexing as the > SpringBeanProcessor does implement the PriorityOrdered > interface, but exposes no mechanism for modifying the order > value. I created my own version of SpringContextLoaderListener > which forgoes the use of SpringContextLoaderSupport and performs > the same work, but also calls setOrder(x) on the > SpringBeanProcessor before adding it to the postprocessors and > application listeners. However, that didn't seem to have any > impact, no matter in which relative order I placed the property > placeholder and the spring bean processor.____ > > __ __ > > For one final data point, if I don't use a property placeholder, > but instead reference a properties object via Spring-EL in the > XML, then the values are correctly replaced, because the > spring-el is evaluated when the xml is parsed (I assume), while > property placeholders are definitely evaluated lazily, long > after the bean definitions are created by the xml parsing > process.____ > > __ __ > > <util:properties id="jmsProperties" > location="file:${catalina.base}/conf/jms.properties"/>____ > > ____ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContext > Factory____ > > </prop>____ > > <prop > > key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>____ > > <prop > > key="java.naming.security.principal">#{jmsProperties['jndi.user']}</pr > op>____ > > <prop > > key="java.naming.security.credentials">#{jmsProperties['jndi.password' > ]}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain'] > }</prop>____ > > <prop > key="clientId">#{jmsProperties['jndi.clientId']}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop> > ____ > > <prop > > key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.tim > eout']}</prop>____ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > This works, but is a kludge. I'd much prefer to have > property-placeholding actually functional, especially since it > is apparently impossible to predict which beans will fail to > have properties replaced. Looking at the sourec code to > jndiTemplate, I can see no obvious reason why it is treated > differently than my own test bean. Both have no annotations and > both receive a java.util.Properties object as a property. The > behavior is consistent no matter what order they appear in my > context xml file.____ > > __ __ > > I've attached my replacement SpringContextLoaderListener just > for reference, in case someone else wants to modify the ordering > of the placeholders while testing or fixing this. The relevant > web.xml entries are below:____ > > __ __ > > <context-param>____ > > <param-name>resteasy.postprocessor.order</param-name>____ > > <param-value>0</param-value>____ > > </context-param>____ > > __ __ > > <listener>____ > > <listener-class>____ > > > > org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener- > class>____ > > </listener>____ > > __ __ > > <listener>____ > > <!-- > > listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderLi > stener</listener-class-->____ > > <listener-class>____ > > > > com.westernasset.compliance.util.SpringContextLoaderListener____ > > </listener-class>____ > > </listener>____ > > __ __ > > ********************************************************************** > E-mail sent through the Internet is not secure. Western Asset > therefore recommends that you do not send any confidential or > sensitive information to us via electronic mail, including > social security numbers, account numbers, or personal > identification numbers. Delivery, and or timely delivery of > Internet mail is not guaranteed. Western Asset therefore > recommends that you do not send time sensitive or > action-oriented messages to us via electronic mail. > ********************************************************************** > ____ > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs > for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free > account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > <mailto:Res...@li...> > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > > > > ---------------------------------------------------------------------- > -------- Precog is a next-generation analytics platform capable of > advanced analytics on semi-structured data. The platform includes APIs > for building apps and a phenomenal toolset for data science. > Developers can use our toolset for easy data analysis & visualization. > Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Resteasy-developers mailing list Res...@li... https://lists.sourceforge.net/lists/listinfo/resteasy-developers |
|
From: Gendler, S. <Sam...@we...> - 2013-04-18 17:37:45
|
I'll give it a whirl when I get a chance and post my results. Hopefully later today -----Original Message----- From: Bill Burke [mailto:bb...@re...] Sent: Thursday, April 18, 2013 6:27 AM To: res...@li... Subject: Re: [Resteasy-developers] spring bean processor bug k, pull request merged. let me know how it goes On 4/18/2013 8:30 AM, Solomon Duskis wrote: > Samuel, > > I submitted a merge request for this. I think that there would be > great value if you (and others with the same problem) would test out the fix. > We have some excellent unit tests, but this problem relates to > subtleties in the Spring lifecycle and requires situation specific > testing. If your testing is successful, perhaps we can work on > creating an additional unit test for resteasy. > > -Solomon > > > On Wed, Apr 17, 2013 at 10:33 PM, Solomon Duskis <sd...@gm... > <mailto:sd...@gm...>> wrote: > > Thank you for the careful analysis. I'll see if I can work around > this issue using other approaches relating to the Spring lifecycle. > I fixed a similar issue a while back with @Providers, and might be > able to use the same approach for ResteasyRegistration. > > I hope to check in something tomorrow. Since this is a nuanced > issue, I think that this change would benefit from field testing. > Would you feel comfortable with being beta testers for this change? > > -Solomon > > > On Wed, Apr 17, 2013 at 7:37 PM, Gendler, Samuel > <Sam...@we... > <mailto:Sam...@we...>> wrote: > > So it proved to be even more subtle than just the existence of a > factory bean. It has to be a factory bean that doesn't declare > the type of objects it will create - which is probably limited > only to things like JndiObjectFactoryBean. The FactoryBean > interface declares a method called getObjectType() which is > explicitly supposed to return null if the type of the object is > not known in advance. The following is from the javadoc for > FactoryBean:____ > > __ __ > > Returns:____ > > the type of object that this FactoryBean creates, or null if not > known at the time of the call____ > > __ __ > > When I created a factory bean that specifies a type in > getObjectType(), the properties were not initialized during the > SpringBeanProcessor's call to getBeansOfType(). When I created > a factory bean that returns null, my properties get initialized > with the values before property placeholder has done its thing > because it actually asks the factory for the bean in order to > determine the type, so it must initialize it first. I'm not > quite sure what the fix to this would be, since the logic of > what is going on in SpringBeanProcessor isn't entirely clear to > me, but it does appear to be a bug on the resteasy side of > things. Somehow, this code needs to execute after property > placeholder replacement (this seems to be the case in resteast > 2.2.3.GA <http://2.2.3.GA>, which still contains calls to > getBeansOfType(), but doesn't trigger this bug, so something is > happening to change the order of events).____ > > __ __ > > *From:*Gendler, Samuel > *Sent:* Wednesday, April 17, 2013 4:05 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* RE: spring bean processor bug____ > > __ __ > > One further piece of info - the javadoc for getBeansOfType() > says that factories will be initialized in order to check the > type of returned objects. My jndiTemplate is referenced by a > bean created via a factory, and I suspect that this is why it is > causing the jndiTemplate to be initialized while beans that have > identical properties but are not used by factories are not > initialized until much later and only after property placeholder > replacement has occurred. I haven't actually verified this > hypothesis, but it seems likely. My factory beans are declared > as follows:____ > > __ __ > > <bean id="sonicJmsTradeConnectionFactory" > > class="org.springframework.jms.connection.UserCredentialsConnectionFac > toryAdapter">____ > > <property name="targetConnectionFactory">____ > > <bean > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" > />____ > > <property name="jndiName">____ > > <value>${jndi.ConnectionFactory}</value>____ > > </property>____ > > </bean>____ > > </property>____ > > <property name="username">____ > > <value>${jndi.user}</value>____ > > </property>____ > > <property name="password">____ > > <value>${jndi.password}</value>____ > > </property>____ > > </bean>____ > > __ __ > > <bean id="destination" > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" />____ > > <property name="jndiName">____ > > <value>${jndi.TopicName}</value>____ > > </property>____ > > </bean>____ > > __ __ > > My guess is that it is actually incorrect to utilize the > getBeansOfType() methods in an application context which is not > yet completely initialized. At the same time, I don't really > understand why setting the order to LOWEST_PRECEDENCE doesn't > fix the problem unless something internal to spring is ignoring > the suggested ordering.____ > > __ __ > > *From:*Gendler, Samuel [mailto:Sam...@we...] > *Sent:* Wednesday, April 17, 2013 3:36 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* [Resteasy-developers] spring bean processor bug____ > > __ __ > > I recently upgraded a project from 2.2.3.GA <http://2.2.3.GA> to > 2.3.6.FINAL and encountered a bug that appears to originate in > the SpringBeanProcessor and which breaks property placeholder > variable replacement in certain spring beans.____ > > __ __ > > I haven't completely unwound the bug to the root cause, but I've > gotten close enough to be confident that someone with more > resteasy knowledge can likely address it much more quickly than > I can.____ > > __ __ > > First, the symptoms:____ > > __ __ > > I have a bean of class org.springframework.jndi.JndiTemplate > declared as follows:____ > > __ __ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContext > Factory</prop>____ > > <prop > key="java.naming.provider.url">${jndi.url}</prop>____ > > <prop > key="java.naming.security.principal">${jndi.user}</prop>____ > > <prop > > key="java.naming.security.credentials">${jndi.password}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>____ > > <prop key="clientId">${jndi.clientId}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop> > ____ > > <prop key="timeToLive">${jndi.timeToLive}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>___ > _ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > I have a property placeholder that is most definitely > initialized with values for all of those properties. I can set > the same values in a test object and see that they are correctly > replaced. However, for reasons that I'll get into in a moment, > the jndiTemplate properties are NOT replaced and it receives the > raw ${...} strings instead. Needless to say, this breaks my > project. Switching back to 2.2.3.GA <http://2.2.3.GA> > definitely fixes it without making any other changes.____ > > __ __ > > What I've discovered so far about the cause:____ > > __ __ > > In SpringBeanProcessor.postProcessBeanFactory(), a method called > findResteasyRegistrations() is called. That method, in turn, > calls the following:____ > > __ __ > > beanFactory.getBeansOfType(ResteasyRegistration.class);____ > > __ __ > > That method call causes some beans (but not all beans) to be > instantiated, and any beans that are instantiated at that point > do not have property placeholder values replaced in them, > because the property placeholder processor has (apparently) not > yet executed. What I haven't figured out is why my jndiTemplate > bean is impacted by this, while another bean that I created > simply to test the creation of properties inside of a bean > definition is not. It is apparently skipped over by the > getBeansOfType(ResteasyRegistration.class) and property > replacement happens correctly in that case.____ > > __ __ > > Initially, I suspected that this was a problem with post > processor ordering. This was somewhat vexing as the > SpringBeanProcessor does implement the PriorityOrdered > interface, but exposes no mechanism for modifying the order > value. I created my own version of SpringContextLoaderListener > which forgoes the use of SpringContextLoaderSupport and performs > the same work, but also calls setOrder(x) on the > SpringBeanProcessor before adding it to the postprocessors and > application listeners. However, that didn't seem to have any > impact, no matter in which relative order I placed the property > placeholder and the spring bean processor.____ > > __ __ > > For one final data point, if I don't use a property placeholder, > but instead reference a properties object via Spring-EL in the > XML, then the values are correctly replaced, because the > spring-el is evaluated when the xml is parsed (I assume), while > property placeholders are definitely evaluated lazily, long > after the bean definitions are created by the xml parsing > process.____ > > __ __ > > <util:properties id="jmsProperties" > location="file:${catalina.base}/conf/jms.properties"/>____ > > ____ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContext > Factory____ > > </prop>____ > > <prop > > key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>____ > > <prop > > key="java.naming.security.principal">#{jmsProperties['jndi.user']}</pr > op>____ > > <prop > > key="java.naming.security.credentials">#{jmsProperties['jndi.password' > ]}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain'] > }</prop>____ > > <prop > key="clientId">#{jmsProperties['jndi.clientId']}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop> > ____ > > <prop > > key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>____ > > <prop > > key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.tim > eout']}</prop>____ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > This works, but is a kludge. I'd much prefer to have > property-placeholding actually functional, especially since it > is apparently impossible to predict which beans will fail to > have properties replaced. Looking at the sourec code to > jndiTemplate, I can see no obvious reason why it is treated > differently than my own test bean. Both have no annotations and > both receive a java.util.Properties object as a property. The > behavior is consistent no matter what order they appear in my > context xml file.____ > > __ __ > > I've attached my replacement SpringContextLoaderListener just > for reference, in case someone else wants to modify the ordering > of the placeholders while testing or fixing this. The relevant > web.xml entries are below:____ > > __ __ > > <context-param>____ > > <param-name>resteasy.postprocessor.order</param-name>____ > > <param-value>0</param-value>____ > > </context-param>____ > > __ __ > > <listener>____ > > <listener-class>____ > > > > org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener- > class>____ > > </listener>____ > > __ __ > > <listener>____ > > <!-- > > listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderLi > stener</listener-class-->____ > > <listener-class>____ > > > > com.westernasset.compliance.util.SpringContextLoaderListener____ > > </listener-class>____ > > </listener>____ > > __ __ > > ********************************************************************** > E-mail sent through the Internet is not secure. Western Asset > therefore recommends that you do not send any confidential or > sensitive information to us via electronic mail, including > social security numbers, account numbers, or personal > identification numbers. Delivery, and or timely delivery of > Internet mail is not guaranteed. Western Asset therefore > recommends that you do not send time sensitive or > action-oriented messages to us via electronic mail. > ********************************************************************** > ____ > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs > for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free > account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > <mailto:Res...@li...> > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > > > > ---------------------------------------------------------------------- > -------- Precog is a next-generation analytics platform capable of > advanced analytics on semi-structured data. The platform includes APIs > for building apps and a phenomenal toolset for data science. > Developers can use our toolset for easy data analysis & visualization. > Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Resteasy-developers mailing list Res...@li... https://lists.sourceforge.net/lists/listinfo/resteasy-developers |
|
From: Bill B. <bb...@re...> - 2013-04-18 13:27:16
|
k, pull request merged. let me know how it goes On 4/18/2013 8:30 AM, Solomon Duskis wrote: > Samuel, > > I submitted a merge request for this. I think that there would be great > value if you (and others with the same problem) would test out the fix. > We have some excellent unit tests, but this problem relates to > subtleties in the Spring lifecycle and requires situation specific > testing. If your testing is successful, perhaps we can work on creating > an additional unit test for resteasy. > > -Solomon > > > On Wed, Apr 17, 2013 at 10:33 PM, Solomon Duskis <sd...@gm... > <mailto:sd...@gm...>> wrote: > > Thank you for the careful analysis. I'll see if I can work around > this issue using other approaches relating to the Spring lifecycle. > I fixed a similar issue a while back with @Providers, and might be > able to use the same approach for ResteasyRegistration. > > I hope to check in something tomorrow. Since this is a nuanced > issue, I think that this change would benefit from field testing. > Would you feel comfortable with being beta testers for this change? > > -Solomon > > > On Wed, Apr 17, 2013 at 7:37 PM, Gendler, Samuel > <Sam...@we... > <mailto:Sam...@we...>> wrote: > > So it proved to be even more subtle than just the existence of a > factory bean. It has to be a factory bean that doesn’t declare > the type of objects it will create – which is probably limited > only to things like JndiObjectFactoryBean. The FactoryBean > interface declares a method called getObjectType() which is > explicitly supposed to return null if the type of the object is > not known in advance. The following is from the javadoc for > FactoryBean:____ > > __ __ > > Returns:____ > > the type of object that this FactoryBean creates, or null if not > known at the time of the call____ > > __ __ > > When I created a factory bean that specifies a type in > getObjectType(), the properties were not initialized during the > SpringBeanProcessor’s call to getBeansOfType(). When I created > a factory bean that returns null, my properties get initialized > with the values before property placeholder has done its thing > because it actually asks the factory for the bean in order to > determine the type, so it must initialize it first. I’m not > quite sure what the fix to this would be, since the logic of > what is going on in SpringBeanProcessor isn’t entirely clear to > me, but it does appear to be a bug on the resteasy side of > things. Somehow, this code needs to execute after property > placeholder replacement (this seems to be the case in resteast > 2.2.3.GA <http://2.2.3.GA>, which still contains calls to > getBeansOfType(), but doesn’t trigger this bug, so something is > happening to change the order of events).____ > > __ __ > > *From:*Gendler, Samuel > *Sent:* Wednesday, April 17, 2013 4:05 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* RE: spring bean processor bug____ > > __ __ > > One further piece of info – the javadoc for getBeansOfType() > says that factories will be initialized in order to check the > type of returned objects. My jndiTemplate is referenced by a > bean created via a factory, and I suspect that this is why it is > causing the jndiTemplate to be initialized while beans that have > identical properties but are not used by factories are not > initialized until much later and only after property placeholder > replacement has occurred. I haven’t actually verified this > hypothesis, but it seems likely. My factory beans are declared > as follows:____ > > __ __ > > <bean id="sonicJmsTradeConnectionFactory" > class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">____ > > <property name="targetConnectionFactory">____ > > <bean > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" />____ > > <property name="jndiName">____ > > <value>${jndi.ConnectionFactory}</value>____ > > </property>____ > > </bean>____ > > </property>____ > > <property name="username">____ > > <value>${jndi.user}</value>____ > > </property>____ > > <property name="password">____ > > <value>${jndi.password}</value>____ > > </property>____ > > </bean>____ > > __ __ > > <bean id="destination" > class="org.springframework.jndi.JndiObjectFactoryBean">____ > > <property name="jndiTemplate" ref="jndiTemplate" />____ > > <property name="jndiName">____ > > <value>${jndi.TopicName}</value>____ > > </property>____ > > </bean>____ > > __ __ > > My guess is that it is actually incorrect to utilize the > getBeansOfType() methods in an application context which is not > yet completely initialized. At the same time, I don’t really > understand why setting the order to LOWEST_PRECEDENCE doesn’t > fix the problem unless something internal to spring is ignoring > the suggested ordering.____ > > __ __ > > *From:*Gendler, Samuel [mailto:Sam...@we...] > *Sent:* Wednesday, April 17, 2013 3:36 PM > *To:* 'res...@li... > <mailto:res...@li...>' > *Cc:* 'res...@li... > <mailto:res...@li...>' > *Subject:* [Resteasy-developers] spring bean processor bug____ > > __ __ > > I recently upgraded a project from 2.2.3.GA <http://2.2.3.GA> to > 2.3.6.FINAL and encountered a bug that appears to originate in > the SpringBeanProcessor and which breaks property placeholder > variable replacement in certain spring beans.____ > > __ __ > > I haven’t completely unwound the bug to the root cause, but I’ve > gotten close enough to be confident that someone with more > resteasy knowledge can likely address it much more quickly than > I can.____ > > __ __ > > First, the symptoms:____ > > __ __ > > I have a bean of class org.springframework.jndi.JndiTemplate > declared as follows:____ > > __ __ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory</prop>____ > > <prop key="java.naming.provider.url">${jndi.url}</prop>____ > > <prop > key="java.naming.security.principal">${jndi.user}</prop>____ > > <prop > key="java.naming.security.credentials">${jndi.password}</prop>____ > > <prop > key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>____ > > <prop key="clientId">${jndi.clientId}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop> > ____ > > <prop key="timeToLive">${jndi.timeToLive}</prop>____ > > <prop > key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>____ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > I have a property placeholder that is most definitely > initialized with values for all of those properties. I can set > the same values in a test object and see that they are correctly > replaced. However, for reasons that I’ll get into in a moment, > the jndiTemplate properties are NOT replaced and it receives the > raw ${…} strings instead. Needless to say, this breaks my > project. Switching back to 2.2.3.GA <http://2.2.3.GA> > definitely fixes it without making any other changes.____ > > __ __ > > What I’ve discovered so far about the cause:____ > > __ __ > > In SpringBeanProcessor.postProcessBeanFactory(), a method called > findResteasyRegistrations() is called. That method, in turn, > calls the following:____ > > __ __ > > beanFactory.getBeansOfType(ResteasyRegistration.class);____ > > __ __ > > That method call causes some beans (but not all beans) to be > instantiated, and any beans that are instantiated at that point > do not have property placeholder values replaced in them, > because the property placeholder processor has (apparently) not > yet executed. What I haven’t figured out is why my jndiTemplate > bean is impacted by this, while another bean that I created > simply to test the creation of properties inside of a bean > definition is not. It is apparently skipped over by the > getBeansOfType(ResteasyRegistration.class) and property > replacement happens correctly in that case.____ > > __ __ > > Initially, I suspected that this was a problem with post > processor ordering. This was somewhat vexing as the > SpringBeanProcessor does implement the PriorityOrdered > interface, but exposes no mechanism for modifying the order > value. I created my own version of SpringContextLoaderListener > which forgoes the use of SpringContextLoaderSupport and performs > the same work, but also calls setOrder(x) on the > SpringBeanProcessor before adding it to the postprocessors and > application listeners. However, that didn’t seem to have any > impact, no matter in which relative order I placed the property > placeholder and the spring bean processor.____ > > __ __ > > For one final data point, if I don’t use a property placeholder, > but instead reference a properties object via Spring-EL in the > XML, then the values are correctly replaced, because the > spring-el is evaluated when the xml is parsed (I assume), while > property placeholders are definitely evaluated lazily, long > after the bean definitions are created by the xml parsing > process.____ > > __ __ > > <util:properties id="jmsProperties" > location="file:${catalina.base}/conf/jms.properties"/>____ > > ____ > > <bean id="jndiTemplate" > class="org.springframework.jndi.JndiTemplate">____ > > <property name="environment">____ > > <props>____ > > <prop > key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory____ > > </prop>____ > > <prop > key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>____ > > <prop > key="java.naming.security.principal">#{jmsProperties['jndi.user']}</prop>____ > > <prop > key="java.naming.security.credentials">#{jmsProperties['jndi.password']}</prop>____ > > <prop > key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain']}</prop>____ > > <prop > key="clientId">#{jmsProperties['jndi.clientId']}</prop> ____ > > <prop key="subscriptionDurable">true</prop>____ > > <prop > key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop> > ____ > > <prop > key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>____ > > <prop > key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.timeout']}</prop>____ > > </props>____ > > </property>____ > > </bean>____ > > __ __ > > This works, but is a kludge. I’d much prefer to have > property-placeholding actually functional, especially since it > is apparently impossible to predict which beans will fail to > have properties replaced. Looking at the sourec code to > jndiTemplate, I can see no obvious reason why it is treated > differently than my own test bean. Both have no annotations and > both receive a java.util.Properties object as a property. The > behavior is consistent no matter what order they appear in my > context xml file.____ > > __ __ > > I’ve attached my replacement SpringContextLoaderListener just > for reference, in case someone else wants to modify the ordering > of the placeholders while testing or fixing this. The relevant > web.xml entries are below:____ > > __ __ > > <context-param>____ > > <param-name>resteasy.postprocessor.order</param-name>____ > > <param-value>0</param-value>____ > > </context-param>____ > > __ __ > > <listener>____ > > <listener-class>____ > > > org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>____ > > </listener>____ > > __ __ > > <listener>____ > > <!-- > listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class-->____ > > <listener-class>____ > > > com.westernasset.compliance.util.SpringContextLoaderListener____ > > </listener-class>____ > > </listener>____ > > __ __ > > ********************************************************************** > E-mail sent through the Internet is not secure. Western Asset > therefore recommends that you do not send any confidential or > sensitive information to us via electronic mail, including > social security numbers, account numbers, or personal > identification numbers. Delivery, and or timely delivery of > Internet mail is not guaranteed. Western Asset therefore > recommends that you do not send time sensitive or > action-oriented messages to us via electronic mail. > ********************************************************************** > ____ > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs > for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free > account! > http://www2.precog.com/precogplatform/slashdotnewsletter > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > <mailto:Res...@li...> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > > > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Solomon D. <sd...@gm...> - 2013-04-18 12:30:20
|
Samuel,
I submitted a merge request for this. I think that there would be great
value if you (and others with the same problem) would test out the fix. We
have some excellent unit tests, but this problem relates to subtleties in
the Spring lifecycle and requires situation specific testing. If your
testing is successful, perhaps we can work on creating an additional unit
test for resteasy.
-Solomon
On Wed, Apr 17, 2013 at 10:33 PM, Solomon Duskis <sd...@gm...> wrote:
> Thank you for the careful analysis. I'll see if I can work around this
> issue using other approaches relating to the Spring lifecycle. I fixed a
> similar issue a while back with @Providers, and might be able to use the
> same approach for ResteasyRegistration.
>
> I hope to check in something tomorrow. Since this is a nuanced issue, I
> think that this change would benefit from field testing. Would you feel
> comfortable with being beta testers for this change?
>
> -Solomon
>
>
> On Wed, Apr 17, 2013 at 7:37 PM, Gendler, Samuel <
> Sam...@we...> wrote:
>
>> So it proved to be even more subtle than just the existence of a factory
>> bean. It has to be a factory bean that doesn’t declare the type of objects
>> it will create – which is probably limited only to things like
>> JndiObjectFactoryBean. The FactoryBean interface declares a method called
>> getObjectType() which is explicitly supposed to return null if the type of
>> the object is not known in advance. The following is from the javadoc for
>> FactoryBean:****
>>
>> ** **
>>
>> Returns:****
>>
>> the type of object that this FactoryBean creates, or null if not known at
>> the time of the call****
>>
>> ** **
>>
>> When I created a factory bean that specifies a type in getObjectType(),
>> the properties were not initialized during the SpringBeanProcessor’s call
>> to getBeansOfType(). When I created a factory bean that returns null, my
>> properties get initialized with the values before property placeholder has
>> done its thing because it actually asks the factory for the bean in order
>> to determine the type, so it must initialize it first. I’m not quite sure
>> what the fix to this would be, since the logic of what is going on in
>> SpringBeanProcessor isn’t entirely clear to me, but it does appear to be a
>> bug on the resteasy side of things. Somehow, this code needs to execute
>> after property placeholder replacement (this seems to be the case in
>> resteast 2.2.3.GA, which still contains calls to getBeansOfType(), but
>> doesn’t trigger this bug, so something is happening to change the order of
>> events).****
>>
>> ** **
>>
>> *From:* Gendler, Samuel
>> *Sent:* Wednesday, April 17, 2013 4:05 PM
>> *To:* 'res...@li...'
>> *Cc:* 'res...@li...'
>> *Subject:* RE: spring bean processor bug****
>>
>> ** **
>>
>> One further piece of info – the javadoc for getBeansOfType() says that
>> factories will be initialized in order to check the type of returned
>> objects. My jndiTemplate is referenced by a bean created via a factory,
>> and I suspect that this is why it is causing the jndiTemplate to be
>> initialized while beans that have identical properties but are not used by
>> factories are not initialized until much later and only after property
>> placeholder replacement has occurred. I haven’t actually verified this
>> hypothesis, but it seems likely. My factory beans are declared as follows:
>> ****
>>
>> ** **
>>
>> <bean id="sonicJmsTradeConnectionFactory"
>> class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
>> ****
>>
>> <property name="targetConnectionFactory">****
>>
>> <bean class="org.springframework.jndi.JndiObjectFactoryBean">****
>>
>> <property name="jndiTemplate" ref="jndiTemplate" />****
>>
>> <property name="jndiName">****
>>
>> <value>${jndi.ConnectionFactory}</value>****
>>
>> </property>****
>>
>> </bean>****
>>
>> </property>****
>>
>> <property name="username">****
>>
>> <value>${jndi.user}</value>****
>>
>> </property>****
>>
>> <property name="password">****
>>
>> <value>${jndi.password}</value>****
>>
>> </property>****
>>
>> </bean>****
>>
>> ** **
>>
>> <bean id="destination"
>> class="org.springframework.jndi.JndiObjectFactoryBean">****
>>
>> <property name="jndiTemplate" ref="jndiTemplate" />****
>>
>> <property name="jndiName">****
>>
>> <value>${jndi.TopicName}</value>****
>>
>> </property>****
>>
>> </bean>****
>>
>> ** **
>>
>> My guess is that it is actually incorrect to utilize the getBeansOfType()
>> methods in an application context which is not yet completely initialized.
>> At the same time, I don’t really understand why setting the order to
>> LOWEST_PRECEDENCE doesn’t fix the problem unless something internal to
>> spring is ignoring the suggested ordering.****
>>
>> ** **
>>
>> *From:* Gendler, Samuel [mailto:Sam...@we...<Sam...@we...>]
>>
>> *Sent:* Wednesday, April 17, 2013 3:36 PM
>> *To:* 'res...@li...'
>> *Cc:* 'res...@li...'
>> *Subject:* [Resteasy-developers] spring bean processor bug****
>>
>> ** **
>>
>> I recently upgraded a project from 2.2.3.GA to 2.3.6.FINAL and
>> encountered a bug that appears to originate in the SpringBeanProcessor and
>> which breaks property placeholder variable replacement in certain spring
>> beans.****
>>
>> ** **
>>
>> I haven’t completely unwound the bug to the root cause, but I’ve gotten
>> close enough to be confident that someone with more resteasy knowledge can
>> likely address it much more quickly than I can.****
>>
>> ** **
>>
>> First, the symptoms:****
>>
>> ** **
>>
>> I have a bean of class org.springframework.jndi.JndiTemplate declared as
>> follows:****
>>
>> ** **
>>
>> <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">*
>> ***
>>
>> <property name="environment">****
>>
>> <props>****
>>
>> <prop
>> key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory</prop>
>> ****
>>
>> <prop key="java.naming.provider.url">${jndi.url}</prop>****
>>
>> <prop key="java.naming.security.principal">${jndi.user}</prop>***
>> *
>>
>> <prop
>> key="java.naming.security.credentials">${jndi.password}</prop>****
>>
>> <prop
>> key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>****
>>
>> <prop key="clientId">${jndi.clientId}</prop> ****
>>
>> <prop key="subscriptionDurable">true</prop>****
>>
>> <prop
>> key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop>
>> ****
>>
>> <prop key="timeToLive">${jndi.timeToLive}</prop>****
>>
>> <prop
>> key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>****
>>
>> </props>****
>>
>> </property>****
>>
>> </bean>****
>>
>> ** **
>>
>> I have a property placeholder that is most definitely initialized with
>> values for all of those properties. I can set the same values in a test
>> object and see that they are correctly replaced. However, for reasons that
>> I’ll get into in a moment, the jndiTemplate properties are NOT replaced and
>> it receives the raw ${…} strings instead. Needless to say, this breaks my
>> project. Switching back to 2.2.3.GA definitely fixes it without making
>> any other changes.****
>>
>> ** **
>>
>> What I’ve discovered so far about the cause:****
>>
>> ** **
>>
>> In SpringBeanProcessor.postProcessBeanFactory(), a method called
>> findResteasyRegistrations() is called. That method, in turn, calls the
>> following:****
>>
>> ** **
>>
>> beanFactory.getBeansOfType(ResteasyRegistration.class);****
>>
>> ** **
>>
>> That method call causes some beans (but not all beans) to be
>> instantiated, and any beans that are instantiated at that point do not have
>> property placeholder values replaced in them, because the property
>> placeholder processor has (apparently) not yet executed. What I haven’t
>> figured out is why my jndiTemplate bean is impacted by this, while another
>> bean that I created simply to test the creation of properties inside of a
>> bean definition is not. It is apparently skipped over by the
>> getBeansOfType(ResteasyRegistration.class) and property replacement happens
>> correctly in that case.****
>>
>> ** **
>>
>> Initially, I suspected that this was a problem with post processor
>> ordering. This was somewhat vexing as the SpringBeanProcessor does
>> implement the PriorityOrdered interface, but exposes no mechanism for
>> modifying the order value. I created my own version of
>> SpringContextLoaderListener which forgoes the use of
>> SpringContextLoaderSupport and performs the same work, but also calls
>> setOrder(x) on the SpringBeanProcessor before adding it to the
>> postprocessors and application listeners. However, that didn’t seem to
>> have any impact, no matter in which relative order I placed the property
>> placeholder and the spring bean processor.****
>>
>> ** **
>>
>> For one final data point, if I don’t use a property placeholder, but
>> instead reference a properties object via Spring-EL in the XML, then the
>> values are correctly replaced, because the spring-el is evaluated when the
>> xml is parsed (I assume), while property placeholders are definitely
>> evaluated lazily, long after the bean definitions are created by the xml
>> parsing process.****
>>
>> ** **
>>
>> <util:properties id="jmsProperties"
>> location="file:${catalina.base}/conf/jms.properties"/>****
>>
>> ****
>>
>> <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">*
>> ***
>>
>> <property name="environment">****
>>
>> <props>****
>>
>> <prop
>> key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory
>> ****
>>
>> </prop>****
>>
>> <prop
>> key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>****
>>
>> <prop
>> key="java.naming.security.principal">#{jmsProperties['jndi.user']}</prop>
>> ****
>>
>> <prop
>> key="java.naming.security.credentials">#{jmsProperties['jndi.password']}</prop>
>> ****
>>
>> <prop
>> key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain']}</prop>
>> ****
>>
>> <prop
>> key="clientId">#{jmsProperties['jndi.clientId']}</prop> ****
>>
>> <prop key="subscriptionDurable">true</prop>****
>>
>> <prop
>> key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop>
>> ****
>>
>> <prop key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>
>> ****
>>
>> <prop
>> key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.timeout']}</prop>
>> ****
>>
>> </props>****
>>
>> </property>****
>>
>> </bean>****
>>
>> ** **
>>
>> This works, but is a kludge. I’d much prefer to have
>> property-placeholding actually functional, especially since it is
>> apparently impossible to predict which beans will fail to have properties
>> replaced. Looking at the sourec code to jndiTemplate, I can see no obvious
>> reason why it is treated differently than my own test bean. Both have no
>> annotations and both receive a java.util.Properties object as a property.
>> The behavior is consistent no matter what order they appear in my context
>> xml file.****
>>
>> ** **
>>
>> I’ve attached my replacement SpringContextLoaderListener just for
>> reference, in case someone else wants to modify the ordering of the
>> placeholders while testing or fixing this. The relevant web.xml entries
>> are below:****
>>
>> ** **
>>
>> <context-param>****
>>
>> <param-name>resteasy.postprocessor.order</param-name>****
>>
>> <param-value>0</param-value>****
>>
>> </context-param>****
>>
>> ** **
>>
>> <listener>****
>>
>> <listener-class>****
>>
>>
>> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
>> ****
>>
>> </listener>****
>>
>> ** **
>>
>> <listener>****
>>
>> <!--
>> listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class-->
>> ****
>>
>> <listener-class>****
>>
>> com.westernasset.compliance.util.SpringContextLoaderListener****
>>
>> </listener-class>****
>>
>> </listener>****
>>
>> ** **
>>
>> **********************************************************************
>> E-mail sent through the Internet is not secure. Western Asset therefore
>> recommends that you do not send any confidential or sensitive information
>> to us via electronic mail, including social security numbers, account
>> numbers, or personal identification numbers. Delivery, and or timely
>> delivery of Internet mail is not guaranteed. Western Asset therefore
>> recommends that you do not send time sensitive or action-oriented messages
>> to us via electronic mail.
>> ********************************************************************** **
>> **
>>
>>
>> ------------------------------------------------------------------------------
>> Precog is a next-generation analytics platform capable of advanced
>> analytics on semi-structured data. The platform includes APIs for building
>> apps and a phenomenal toolset for data science. Developers can use
>> our toolset for easy data analysis & visualization. Get a free account!
>> http://www2.precog.com/precogplatform/slashdotnewsletter
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>>
>
|
|
From: Bill B. <bb...@re...> - 2013-04-18 11:29:49
|
I've been keeping in line with JBoss AS as far as version goes. I'm not forbidden, but it does keep thing easier. I don't know if 4.2.4 is backward compatible with Resteasy's client framework. On 4/18/2013 4:06 AM, Romain Sertelon wrote: > Hi list, > > Today, I tried to use Resteasy inside a project where I use fluent-hc > (apache http components) 4.2.4. When I run it, it complained about > missing classes, I didn't understand why until I realized that it was > also a dependency of Resteasy. Due to version conflicts, 4.1.2 was > chosen by maven, leading to class not found errors. > > I was wondering what is your policy for upgrading dependencies. I've > already submitted (very little) patches for Netty upgrade, but it was in > a single module, an extension. Here, this component seems to be used in > several modules. > > Do you plan to upgrade Resteasy's dependencies before the next Final > release, or do you have other contraints that forbid you to do so? > (Beign part of the Jboss AS for example ^^) > > Thanks ! > > -- > > Romain SERTELON > Blog <http://blog.bluepyth.fr/> ~@BluePyth <http://twitter.com/BluePyth> ~+BluePyth <https://plus.google.com/108216280996284757484> ~Github <https://github.com/BluePyth> ~LinkedIn <http://fr.linkedin.com/in/romainsertelon/> ~DoYouBuzz <http://www.doyoubuzz.com/romain-sertelon/> ~Lanyrd <http://lanyrd.com/profile/bluepyth> > > > > ------------------------------------------------------------------------------ > Precog is a next-generation analytics platform capable of advanced > analytics on semi-structured data. The platform includes APIs for building > apps and a phenomenal toolset for data science. Developers can use > our toolset for easy data analysis & visualization. Get a free account! > http://www2.precog.com/precogplatform/slashdotnewsletter > > > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Romain S. <ro...@se...> - 2013-04-18 08:23:31
|
Hi list, Today, I tried to use Resteasy inside a project where I use fluent-hc (apache http components) 4.2.4. When I run it, it complained about missing classes, I didn't understand why until I realized that it was also a dependency of Resteasy. Due to version conflicts, 4.1.2 was chosen by maven, leading to class not found errors. I was wondering what is your policy for upgrading dependencies. I've already submitted (very little) patches for Netty upgrade, but it was in a single module, an extension. Here, this component seems to be used in several modules. Do you plan to upgrade Resteasy's dependencies before the next Final release, or do you have other contraints that forbid you to do so? (Beign part of the Jboss AS for example ^^) Thanks ! -- Romain SERTELON Blog [1] ~ @BluePyth [2] ~ +BluePyth [3] ~ Github [4] ~ LinkedIn [5] ~ DoYouBuzz [6] ~ Lanyrd [7] Links: ------ [1] http://blog.bluepyth.fr/ [2] http://twitter.com/BluePyth [3] https://plus.google.com/108216280996284757484 [4] https://github.com/BluePyth [5] http://fr.linkedin.com/in/romainsertelon/ [6] http://www.doyoubuzz.com/romain-sertelon/ [7] http://lanyrd.com/profile/bluepyth |
|
From: Solomon D. <sd...@gm...> - 2013-04-18 02:33:27
|
Thank you for the careful analysis. I'll see if I can work around this
issue using other approaches relating to the Spring lifecycle. I fixed a
similar issue a while back with @Providers, and might be able to use the
same approach for ResteasyRegistration.
I hope to check in something tomorrow. Since this is a nuanced issue, I
think that this change would benefit from field testing. Would you feel
comfortable with being beta testers for this change?
-Solomon
On Wed, Apr 17, 2013 at 7:37 PM, Gendler, Samuel <
Sam...@we...> wrote:
> So it proved to be even more subtle than just the existence of a factory
> bean. It has to be a factory bean that doesn’t declare the type of objects
> it will create – which is probably limited only to things like
> JndiObjectFactoryBean. The FactoryBean interface declares a method called
> getObjectType() which is explicitly supposed to return null if the type of
> the object is not known in advance. The following is from the javadoc for
> FactoryBean:****
>
> ** **
>
> Returns:****
>
> the type of object that this FactoryBean creates, or null if not known at
> the time of the call****
>
> ** **
>
> When I created a factory bean that specifies a type in getObjectType(),
> the properties were not initialized during the SpringBeanProcessor’s call
> to getBeansOfType(). When I created a factory bean that returns null, my
> properties get initialized with the values before property placeholder has
> done its thing because it actually asks the factory for the bean in order
> to determine the type, so it must initialize it first. I’m not quite sure
> what the fix to this would be, since the logic of what is going on in
> SpringBeanProcessor isn’t entirely clear to me, but it does appear to be a
> bug on the resteasy side of things. Somehow, this code needs to execute
> after property placeholder replacement (this seems to be the case in
> resteast 2.2.3.GA, which still contains calls to getBeansOfType(), but
> doesn’t trigger this bug, so something is happening to change the order of
> events).****
>
> ** **
>
> *From:* Gendler, Samuel
> *Sent:* Wednesday, April 17, 2013 4:05 PM
> *To:* 'res...@li...'
> *Cc:* 'res...@li...'
> *Subject:* RE: spring bean processor bug****
>
> ** **
>
> One further piece of info – the javadoc for getBeansOfType() says that
> factories will be initialized in order to check the type of returned
> objects. My jndiTemplate is referenced by a bean created via a factory,
> and I suspect that this is why it is causing the jndiTemplate to be
> initialized while beans that have identical properties but are not used by
> factories are not initialized until much later and only after property
> placeholder replacement has occurred. I haven’t actually verified this
> hypothesis, but it seems likely. My factory beans are declared as follows:
> ****
>
> ** **
>
> <bean id="sonicJmsTradeConnectionFactory"
> class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
> ****
>
> <property name="targetConnectionFactory">****
>
> <bean class="org.springframework.jndi.JndiObjectFactoryBean">****
>
> <property name="jndiTemplate" ref="jndiTemplate" />****
>
> <property name="jndiName">****
>
> <value>${jndi.ConnectionFactory}</value>****
>
> </property>****
>
> </bean>****
>
> </property>****
>
> <property name="username">****
>
> <value>${jndi.user}</value>****
>
> </property>****
>
> <property name="password">****
>
> <value>${jndi.password}</value>****
>
> </property>****
>
> </bean>****
>
> ** **
>
> <bean id="destination"
> class="org.springframework.jndi.JndiObjectFactoryBean">****
>
> <property name="jndiTemplate" ref="jndiTemplate" />****
>
> <property name="jndiName">****
>
> <value>${jndi.TopicName}</value>****
>
> </property>****
>
> </bean>****
>
> ** **
>
> My guess is that it is actually incorrect to utilize the getBeansOfType()
> methods in an application context which is not yet completely initialized.
> At the same time, I don’t really understand why setting the order to
> LOWEST_PRECEDENCE doesn’t fix the problem unless something internal to
> spring is ignoring the suggested ordering.****
>
> ** **
>
> *From:* Gendler, Samuel [mailto:Sam...@we...<Sam...@we...>]
>
> *Sent:* Wednesday, April 17, 2013 3:36 PM
> *To:* 'res...@li...'
> *Cc:* 'res...@li...'
> *Subject:* [Resteasy-developers] spring bean processor bug****
>
> ** **
>
> I recently upgraded a project from 2.2.3.GA to 2.3.6.FINAL and
> encountered a bug that appears to originate in the SpringBeanProcessor and
> which breaks property placeholder variable replacement in certain spring
> beans.****
>
> ** **
>
> I haven’t completely unwound the bug to the root cause, but I’ve gotten
> close enough to be confident that someone with more resteasy knowledge can
> likely address it much more quickly than I can.****
>
> ** **
>
> First, the symptoms:****
>
> ** **
>
> I have a bean of class org.springframework.jndi.JndiTemplate declared as
> follows:****
>
> ** **
>
> <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">**
> **
>
> <property name="environment">****
>
> <props>****
>
> <prop
> key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory</prop>
> ****
>
> <prop key="java.naming.provider.url">${jndi.url}</prop>****
>
> <prop key="java.naming.security.principal">${jndi.user}</prop>****
>
> <prop
> key="java.naming.security.credentials">${jndi.password}</prop>****
>
> <prop key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>
> ****
>
> <prop key="clientId">${jndi.clientId}</prop> ****
>
> <prop key="subscriptionDurable">true</prop>****
>
> <prop
> key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop>
> ****
>
> <prop key="timeToLive">${jndi.timeToLive}</prop>****
>
> <prop
> key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>****
>
> </props>****
>
> </property>****
>
> </bean>****
>
> ** **
>
> I have a property placeholder that is most definitely initialized with
> values for all of those properties. I can set the same values in a test
> object and see that they are correctly replaced. However, for reasons that
> I’ll get into in a moment, the jndiTemplate properties are NOT replaced and
> it receives the raw ${…} strings instead. Needless to say, this breaks my
> project. Switching back to 2.2.3.GA definitely fixes it without making
> any other changes.****
>
> ** **
>
> What I’ve discovered so far about the cause:****
>
> ** **
>
> In SpringBeanProcessor.postProcessBeanFactory(), a method called
> findResteasyRegistrations() is called. That method, in turn, calls the
> following:****
>
> ** **
>
> beanFactory.getBeansOfType(ResteasyRegistration.class);****
>
> ** **
>
> That method call causes some beans (but not all beans) to be instantiated,
> and any beans that are instantiated at that point do not have property
> placeholder values replaced in them, because the property placeholder
> processor has (apparently) not yet executed. What I haven’t figured out is
> why my jndiTemplate bean is impacted by this, while another bean that I
> created simply to test the creation of properties inside of a bean
> definition is not. It is apparently skipped over by the
> getBeansOfType(ResteasyRegistration.class) and property replacement happens
> correctly in that case.****
>
> ** **
>
> Initially, I suspected that this was a problem with post processor
> ordering. This was somewhat vexing as the SpringBeanProcessor does
> implement the PriorityOrdered interface, but exposes no mechanism for
> modifying the order value. I created my own version of
> SpringContextLoaderListener which forgoes the use of
> SpringContextLoaderSupport and performs the same work, but also calls
> setOrder(x) on the SpringBeanProcessor before adding it to the
> postprocessors and application listeners. However, that didn’t seem to
> have any impact, no matter in which relative order I placed the property
> placeholder and the spring bean processor.****
>
> ** **
>
> For one final data point, if I don’t use a property placeholder, but
> instead reference a properties object via Spring-EL in the XML, then the
> values are correctly replaced, because the spring-el is evaluated when the
> xml is parsed (I assume), while property placeholders are definitely
> evaluated lazily, long after the bean definitions are created by the xml
> parsing process.****
>
> ** **
>
> <util:properties id="jmsProperties"
> location="file:${catalina.base}/conf/jms.properties"/>****
>
> ****
>
> <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">**
> **
>
> <property name="environment">****
>
> <props>****
>
> <prop
> key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory
> ****
>
> </prop>****
>
> <prop
> key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>****
>
> <prop
> key="java.naming.security.principal">#{jmsProperties['jndi.user']}</prop>*
> ***
>
> <prop
> key="java.naming.security.credentials">#{jmsProperties['jndi.password']}</prop>
> ****
>
> <prop
> key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain']}</prop>
> ****
>
> <prop
> key="clientId">#{jmsProperties['jndi.clientId']}</prop> ****
>
> <prop key="subscriptionDurable">true</prop>****
>
> <prop
> key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop>
> ****
>
> <prop key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>*
> ***
>
> <prop
> key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.timeout']}</prop>
> ****
>
> </props>****
>
> </property>****
>
> </bean>****
>
> ** **
>
> This works, but is a kludge. I’d much prefer to have
> property-placeholding actually functional, especially since it is
> apparently impossible to predict which beans will fail to have properties
> replaced. Looking at the sourec code to jndiTemplate, I can see no obvious
> reason why it is treated differently than my own test bean. Both have no
> annotations and both receive a java.util.Properties object as a property.
> The behavior is consistent no matter what order they appear in my context
> xml file.****
>
> ** **
>
> I’ve attached my replacement SpringContextLoaderListener just for
> reference, in case someone else wants to modify the ordering of the
> placeholders while testing or fixing this. The relevant web.xml entries
> are below:****
>
> ** **
>
> <context-param>****
>
> <param-name>resteasy.postprocessor.order</param-name>****
>
> <param-value>0</param-value>****
>
> </context-param>****
>
> ** **
>
> <listener>****
>
> <listener-class>****
>
>
> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
> ****
>
> </listener>****
>
> ** **
>
> <listener>****
>
> <!--
> listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class-->
> ****
>
> <listener-class>****
>
> com.westernasset.compliance.util.SpringContextLoaderListener****
>
> </listener-class>****
>
> </listener>****
>
> ** **
>
> **********************************************************************
> E-mail sent through the Internet is not secure. Western Asset therefore
> recommends that you do not send any confidential or sensitive information
> to us via electronic mail, including social security numbers, account
> numbers, or personal identification numbers. Delivery, and or timely
> delivery of Internet mail is not guaranteed. Western Asset therefore
> recommends that you do not send time sensitive or action-oriented messages
> to us via electronic mail.
> ********************************************************************** ***
> *
>
>
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
|
|
From: Gendler, S. <Sam...@we...> - 2013-04-17 23:37:53
|
So it proved to be even more subtle than just the existence of a factory bean. It has to be a factory bean that doesn't declare the type of objects it will create - which is probably limited only to things like JndiObjectFactoryBean. The FactoryBean interface declares a method called getObjectType() which is explicitly supposed to return null if the type of the object is not known in advance. The following is from the javadoc for FactoryBean:
Returns:
the type of object that this FactoryBean creates, or null if not known at the time of the call
When I created a factory bean that specifies a type in getObjectType(), the properties were not initialized during the SpringBeanProcessor's call to getBeansOfType(). When I created a factory bean that returns null, my properties get initialized with the values before property placeholder has done its thing because it actually asks the factory for the bean in order to determine the type, so it must initialize it first. I'm not quite sure what the fix to this would be, since the logic of what is going on in SpringBeanProcessor isn't entirely clear to me, but it does appear to be a bug on the resteasy side of things. Somehow, this code needs to execute after property placeholder replacement (this seems to be the case in resteast 2.2.3.GA, which still contains calls to getBeansOfType(), but doesn't trigger this bug, so something is happening to change the order of events).
From: Gendler, Samuel
Sent: Wednesday, April 17, 2013 4:05 PM
To: 'res...@li...'
Cc: 'res...@li...'
Subject: RE: spring bean processor bug
One further piece of info - the javadoc for getBeansOfType() says that factories will be initialized in order to check the type of returned objects. My jndiTemplate is referenced by a bean created via a factory, and I suspect that this is why it is causing the jndiTemplate to be initialized while beans that have identical properties but are not used by factories are not initialized until much later and only after property placeholder replacement has occurred. I haven't actually verified this hypothesis, but it seems likely. My factory beans are declared as follows:
<bean id="sonicJmsTradeConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="jndiName">
<value>${jndi.ConnectionFactory}</value>
</property>
</bean>
</property>
<property name="username">
<value>${jndi.user}</value>
</property>
<property name="password">
<value>${jndi.password}</value>
</property>
</bean>
<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="jndiName">
<value>${jndi.TopicName}</value>
</property>
</bean>
My guess is that it is actually incorrect to utilize the getBeansOfType() methods in an application context which is not yet completely initialized. At the same time, I don't really understand why setting the order to LOWEST_PRECEDENCE doesn't fix the problem unless something internal to spring is ignoring the suggested ordering.
From: Gendler, Samuel [mailto:Sam...@we...]
Sent: Wednesday, April 17, 2013 3:36 PM
To: 'res...@li...'
Cc: 'res...@li...'
Subject: [Resteasy-developers] spring bean processor bug
I recently upgraded a project from 2.2.3.GA to 2.3.6.FINAL and encountered a bug that appears to originate in the SpringBeanProcessor and which breaks property placeholder variable replacement in certain spring beans.
I haven't completely unwound the bug to the root cause, but I've gotten close enough to be confident that someone with more resteasy knowledge can likely address it much more quickly than I can.
First, the symptoms:
I have a bean of class org.springframework.jndi.JndiTemplate declared as follows:
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory</prop>
<prop key="java.naming.provider.url">${jndi.url}</prop>
<prop key="java.naming.security.principal">${jndi.user}</prop>
<prop key="java.naming.security.credentials">${jndi.password}</prop>
<prop key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>
<prop key="clientId">${jndi.clientId}</prop>
<prop key="subscriptionDurable">true</prop>
<prop key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop>
<prop key="timeToLive">${jndi.timeToLive}</prop>
<prop key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>
</props>
</property>
</bean>
I have a property placeholder that is most definitely initialized with values for all of those properties. I can set the same values in a test object and see that they are correctly replaced. However, for reasons that I'll get into in a moment, the jndiTemplate properties are NOT replaced and it receives the raw ${...} strings instead. Needless to say, this breaks my project. Switching back to 2.2.3.GA definitely fixes it without making any other changes.
What I've discovered so far about the cause:
In SpringBeanProcessor.postProcessBeanFactory(), a method called findResteasyRegistrations() is called. That method, in turn, calls the following:
beanFactory.getBeansOfType(ResteasyRegistration.class);
That method call causes some beans (but not all beans) to be instantiated, and any beans that are instantiated at that point do not have property placeholder values replaced in them, because the property placeholder processor has (apparently) not yet executed. What I haven't figured out is why my jndiTemplate bean is impacted by this, while another bean that I created simply to test the creation of properties inside of a bean definition is not. It is apparently skipped over by the getBeansOfType(ResteasyRegistration.class) and property replacement happens correctly in that case.
Initially, I suspected that this was a problem with post processor ordering. This was somewhat vexing as the SpringBeanProcessor does implement the PriorityOrdered interface, but exposes no mechanism for modifying the order value. I created my own version of SpringContextLoaderListener which forgoes the use of SpringContextLoaderSupport and performs the same work, but also calls setOrder(x) on the SpringBeanProcessor before adding it to the postprocessors and application listeners. However, that didn't seem to have any impact, no matter in which relative order I placed the property placeholder and the spring bean processor.
For one final data point, if I don't use a property placeholder, but instead reference a properties object via Spring-EL in the XML, then the values are correctly replaced, because the spring-el is evaluated when the xml is parsed (I assume), while property placeholders are definitely evaluated lazily, long after the bean definitions are created by the xml parsing process.
<util:properties id="jmsProperties" location="file:${catalina.base}/conf/jms.properties"/>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory
</prop>
<prop key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>
<prop key="java.naming.security.principal">#{jmsProperties['jndi.user']}</prop>
<prop key="java.naming.security.credentials">#{jmsProperties['jndi.password']}</prop>
<prop key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain']}</prop>
<prop key="clientId">#{jmsProperties['jndi.clientId']}</prop>
<prop key="subscriptionDurable">true</prop>
<prop key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop>
<prop key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>
<prop key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.timeout']}</prop>
</props>
</property>
</bean>
This works, but is a kludge. I'd much prefer to have property-placeholding actually functional, especially since it is apparently impossible to predict which beans will fail to have properties replaced. Looking at the sourec code to jndiTemplate, I can see no obvious reason why it is treated differently than my own test bean. Both have no annotations and both receive a java.util.Properties object as a property. The behavior is consistent no matter what order they appear in my context xml file.
I've attached my replacement SpringContextLoaderListener just for reference, in case someone else wants to modify the ordering of the placeholders while testing or fixing this. The relevant web.xml entries are below:
<context-param>
<param-name>resteasy.postprocessor.order</param-name>
<param-value>0</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<listener>
<!-- listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class-->
<listener-class>
com.westernasset.compliance.util.SpringContextLoaderListener
</listener-class>
</listener>
********************************************************************** E-mail sent through the Internet is not secure. Western Asset therefore recommends that you do not send any confidential or sensitive information to us via electronic mail, including social security numbers, account numbers, or personal identification numbers. Delivery, and or timely delivery of Internet mail is not guaranteed. Western Asset therefore recommends that you do not send time sensitive or action-oriented messages to us via electronic mail. **********************************************************************
|
|
From: Gendler, S. <Sam...@we...> - 2013-04-17 23:19:57
|
One further piece of info - the javadoc for getBeansOfType() says that factories will be initialized in order to check the type of returned objects. My jndiTemplate is referenced by a bean created via a factory, and I suspect that this is why it is causing the jndiTemplate to be initialized while beans that have identical properties but are not used by factories are not initialized until much later and only after property placeholder replacement has occurred. I haven't actually verified this hypothesis, but it seems likely. My factory beans are declared as follows:
<bean id="sonicJmsTradeConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="jndiName">
<value>${jndi.ConnectionFactory}</value>
</property>
</bean>
</property>
<property name="username">
<value>${jndi.user}</value>
</property>
<property name="password">
<value>${jndi.password}</value>
</property>
</bean>
<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="jndiName">
<value>${jndi.TopicName}</value>
</property>
</bean>
My guess is that it is actually incorrect to utilize the getBeansOfType() methods in an application context which is not yet completely initialized. At the same time, I don't really understand why setting the order to LOWEST_PRECEDENCE doesn't fix the problem unless something internal to spring is ignoring the suggested ordering.
From: Gendler, Samuel [mailto:Sam...@we...]
Sent: Wednesday, April 17, 2013 3:36 PM
To: 'res...@li...'
Cc: 'res...@li...'
Subject: [Resteasy-developers] spring bean processor bug
I recently upgraded a project from 2.2.3.GA to 2.3.6.FINAL and encountered a bug that appears to originate in the SpringBeanProcessor and which breaks property placeholder variable replacement in certain spring beans.
I haven't completely unwound the bug to the root cause, but I've gotten close enough to be confident that someone with more resteasy knowledge can likely address it much more quickly than I can.
First, the symptoms:
I have a bean of class org.springframework.jndi.JndiTemplate declared as follows:
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory</prop>
<prop key="java.naming.provider.url">${jndi.url}</prop>
<prop key="java.naming.security.principal">${jndi.user}</prop>
<prop key="java.naming.security.credentials">${jndi.password}</prop>
<prop key="com.sonicsw.jndi.mfcontext.domain">${jndi.domain}</prop>
<prop key="clientId">${jndi.clientId}</prop>
<prop key="subscriptionDurable">true</prop>
<prop key="durableSubscriptionName">${jndi.durableSubscriptionName}</prop>
<prop key="timeToLive">${jndi.timeToLive}</prop>
<prop key="com.sonicsw.jndi.mfcontext.idleTimeout">${jndi.timeout}</prop>
</props>
</property>
</bean>
I have a property placeholder that is most definitely initialized with values for all of those properties. I can set the same values in a test object and see that they are correctly replaced. However, for reasons that I'll get into in a moment, the jndiTemplate properties are NOT replaced and it receives the raw ${...} strings instead. Needless to say, this breaks my project. Switching back to 2.2.3.GA definitely fixes it without making any other changes.
What I've discovered so far about the cause:
In SpringBeanProcessor.postProcessBeanFactory(), a method called findResteasyRegistrations() is called. That method, in turn, calls the following:
beanFactory.getBeansOfType(ResteasyRegistration.class);
That method call causes some beans (but not all beans) to be instantiated, and any beans that are instantiated at that point do not have property placeholder values replaced in them, because the property placeholder processor has (apparently) not yet executed. What I haven't figured out is why my jndiTemplate bean is impacted by this, while another bean that I created simply to test the creation of properties inside of a bean definition is not. It is apparently skipped over by the getBeansOfType(ResteasyRegistration.class) and property replacement happens correctly in that case.
Initially, I suspected that this was a problem with post processor ordering. This was somewhat vexing as the SpringBeanProcessor does implement the PriorityOrdered interface, but exposes no mechanism for modifying the order value. I created my own version of SpringContextLoaderListener which forgoes the use of SpringContextLoaderSupport and performs the same work, but also calls setOrder(x) on the SpringBeanProcessor before adding it to the postprocessors and application listeners. However, that didn't seem to have any impact, no matter in which relative order I placed the property placeholder and the spring bean processor.
For one final data point, if I don't use a property placeholder, but instead reference a properties object via Spring-EL in the XML, then the values are correctly replaced, because the spring-el is evaluated when the xml is parsed (I assume), while property placeholders are definitely evaluated lazily, long after the bean definitions are created by the xml parsing process.
<util:properties id="jmsProperties" location="file:${catalina.base}/conf/jms.properties"/>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.sonicsw.jndi.mfcontext.MFContextFactory
</prop>
<prop key="java.naming.provider.url">#{jmsProperties['jndi.url']}</prop>
<prop key="java.naming.security.principal">#{jmsProperties['jndi.user']}</prop>
<prop key="java.naming.security.credentials">#{jmsProperties['jndi.password']}</prop>
<prop key="com.sonicsw.jndi.mfcontext.domain">#{jmsProperties['jndi.domain']}</prop>
<prop key="clientId">#{jmsProperties['jndi.clientId']}</prop>
<prop key="subscriptionDurable">true</prop>
<prop key="durableSubscriptionName">#{jmsProperties['jndi.durableSubscriptionName']}</prop>
<prop key="timeToLive">#{jmsProperties['jndi.timeToLive']}</prop>
<prop key="com.sonicsw.jndi.mfcontext.idleTimeout">#{jmsProperties['jndi.timeout']}</prop>
</props>
</property>
</bean>
This works, but is a kludge. I'd much prefer to have property-placeholding actually functional, especially since it is apparently impossible to predict which beans will fail to have properties replaced. Looking at the sourec code to jndiTemplate, I can see no obvious reason why it is treated differently than my own test bean. Both have no annotations and both receive a java.util.Properties object as a property. The behavior is consistent no matter what order they appear in my context xml file.
I've attached my replacement SpringContextLoaderListener just for reference, in case someone else wants to modify the ordering of the placeholders while testing or fixing this. The relevant web.xml entries are below:
<context-param>
<param-name>resteasy.postprocessor.order</param-name>
<param-value>0</param-value>
</context-param>
<listener>
<listener-class>
org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<listener>
<!-- listener-class>org.jboss.resteasy.plugins.spring.SpringContextLoaderListener</listener-class-->
<listener-class>
com.westernasset.compliance.util.SpringContextLoaderListener
</listener-class>
</listener>
********************************************************************** E-mail sent through the Internet is not secure. Western Asset therefore recommends that you do not send any confidential or sensitive information to us via electronic mail, including social security numbers, account numbers, or personal identification numbers. Delivery, and or timely delivery of Internet mail is not guaranteed. Western Asset therefore recommends that you do not send time sensitive or action-oriented messages to us via electronic mail. **********************************************************************
|
|
From: Ron S. <rs...@re...> - 2013-04-13 17:49:19
|
Test. |
|
From: Bill B. <bb...@re...> - 2013-04-10 14:22:51
|
See jboss.org/resteasy for relevant links for downloads/documentation. 3.0-beta-4 is our last beta! JAX-RS 2.0 Final is being voted on for JCP. We'll be obtaining the TCK soon and starting work on getting certified. There's also some architectural work that needs to be finished for 3.0. We'll have a short RC release sometime in May, then a 3.0 Final Release early June. 2.3.6 is just a maintenance release. -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Bill B. <bb...@re...> - 2013-04-09 14:38:52
|
fyi -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Weinan Li <we...@re...> - 2013-03-26 10:55:16
|
Hi Michael, Next release of RESTEasy 3.x will include it(3.0-beta-4). It will not supported in 2.3.6.Final(next release of 2.3.x) because it breaks the @NoJackson support. For 3.x the jettison support will be removed soon so we don't have to consider the backward compatibility. - Weinan Li JBoss, Redhat On Mar 26, 2013, at 4:25 PM, Michael Pasternak <mpa...@re...> wrote: > > > Hi Guys, > > i see RESTEasy-795 is closed, in what upstream/downstream version this change > will be available? > > (btw thanks for fixing this) > > On 02/27/2013 03:44 AM, Weinan Li wrote: >> >> - Weinan Li >> JBoss, Redhat >> >> >> On Feb 26, 2013, at 11:37 PM, Bill Burke <bb...@re... <mailto:bb...@re...>> wrote: >> >>> We could also retire Jettison support in Resteasy 3.0. In my book revision I'm removing the section on Jettision and replacing it with Jackson. >> >> Cool! If Jettison is no longer supported, then seems my previous patch is fine to use, and I will also remove the @NoJackson support and resubmit the pull request. Does >> that sound reasonable ? >> >>> >>> On 2/26/2013 4:11 AM, Weinan Li wrote: >>>> Hi Bill, >>>> >>>> Currently I'm working on RESTEASY-795: Add Jackson JAXB support to RESTEasy >>>> >>>> Ron has helped me find out the problem of my previous patch[1] is that >>>> it will cause compatiblity problem if Jettison and Jackson co-exists in >>>> a project. We are not sure if this is the backward compatibility you >>>> were referring to, could you please help to confirm this? >>>> >>>> Here is my solution to fix this: Add a @UseJackson annotation for user >>>> to annotate on JAXB annotated resources. If the JAXB resource is >>>> annotated by it, RESTEasy will use Jackson to deal with it, otherwise it >>>> will use Jettison. And we'll make sure @UseJackson and @NoJackson cannot >>>> be used at same time. Do you like this idea? If it's okay I'll start >>>> coding. >>>> >>>> [1] >>>> https://github.com/resteasy/Resteasy/commit/6c1f9bd07e9b31d9b73746cad2f6a0b6846f42e6 >>>> >>>> - Weinan Li >>>> JBoss, Redhat >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> -- >>> Bill Burke >>> JBoss, a division of Red Hat >>> http://bill.burkecentral.com >> > > > -- > > Michael Pasternak > RedHat, ENG-Virtualization R&D |
|
From: Michael M. <mic...@ga...> - 2013-03-26 08:21:44
|
Hi all, I'm using the new JAX-RS 2 client API to communicate with a system that has an interesting take on response codes, which basically means it will return 200 for everything and the body will include a fault element to indicate something has gone wrong. As an example, given an XML response from a POST to create a pet I might get: <pet><name>Fido</name></pet> Or I might get <fault><error-code>3423423</error-code></fault> My take on this is that I should provide an interceptor/filter to look at the message body response, determine if there is a fault in there, and throw a WebApplicationException, or at the very least change the status code so that a WebApplicationException is thrown further down the line.. My questions are, which filter or interceptor is correct in this use case? I would imagine where I want it to kick in is at the point where it has the response body but hasn't tried to marshall it. The second question was, am I right to register it at the point I build my client, e.g. ClientBuilder.newBuilder().register(new MyCustomInterceptor()).build() The intention is that this would be a client specifically for dealing with the quirks of those endpoints, other clients would not have those filters applied. I'm leaving off the Provider annotation purposely so it doesn't get picked up automagically anywhere else. Appreciate any advice as ever. |
|
From: Weinan Li <we...@re...> - 2013-03-08 03:17:46
|
Hi, I'll be on PTO Mar 11-22 to take my family back to my wife's hometown Wuhan to see her parents, and I will have limited access to internet(with my wife's censorship :-) - For RESTEasy community issues please contact with Ron (rs...@re...). - For RESTEasy and JBossTS EAP related issues, please contact with Fernando (fn...@re...). - For EWS tasks, please contact with Permaine (pc...@re...). - For Fedora bzs assigned to me, David could help on them (dav...@gm...). - For ETT issues, please wait for me come back ;-) Yang (yy...@re...) could reach me via mobile. For any other issues, please contact with my boss Trevor (tk...@re...). - Weinan Li JBoss, Redhat |
|
From: Bill B. <bb...@re...> - 2013-03-07 23:24:05
|
They are proxies to ThreadLocal instances. On 3/7/2013 5:22 PM, Geyer, Randy wrote: > Hi all, > > Can @Context parameters be safely injected into singleton providers? In > other words, are @Context parameters a proxy to a ThreadLocal instance? > > Thanks - rg > > > ------------------------------------------------------------------------------ > Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester > Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the > endpoint security space. For insight on selecting the right partner to > tackle endpoint security challenges, access the full report. > http://p.sf.net/sfu/symantec-dev2dev > > > > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Geyer, R. <Ran...@in...> - 2013-03-07 22:57:37
|
Hi all, Can @Context parameters be safely injected into singleton providers? In other words, are @Context parameters a proxy to a ThreadLocal instance? Thanks - rg |
|
From: Bill B. <bb...@re...> - 2013-03-07 14:52:02
|
Jetty is a servlet container, so, deploy resteasy as a servlet to
embedded jetty.
On 3/7/2013 9:08 AM, Michael McCarthy wrote:
> Hi all,
>
> Using the latest beta and I'm deploying outside of Jboss with an
> embedded container. I'm using Jetty, so I have a main method that looks
> like this:
>
> public static void main(String[] args) throws Exception {
>
> Server server = new Server(8080);
> ProtectionDomain domain = MyServer.class.getProtectionDomain();
> URL location = domain.getCodeSource().getLocation();
> WebAppContext webapp = new WebAppContext();
> webapp.setContextPath("/");
> webapp.setWar(location.toExternalForm());
> server.setHandler(webapp);
> server.start();
> server.join();
>
> }
>
> From what I understand from chapter 33, RESTeasy has some libraries
> that help with Netty, TJWS and the Sun server. Is there any reason why
> these isn't a library for using Jetty? Would it not bring any value adds?
>
> Thanks,
> Michael
>
>
>
> ------------------------------------------------------------------------------
> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
> endpoint security space. For insight on selecting the right partner to
> tackle endpoint security challenges, access the full report.
> http://p.sf.net/sfu/symantec-dev2dev
>
>
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Michael M. <mic...@ga...> - 2013-03-07 14:41:10
|
Hi all,
Using the latest beta and I'm deploying outside of Jboss with an embedded container. I'm using Jetty, so I have a main method that looks like this:
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
ProtectionDomain domain = MyServer.class.getProtectionDomain();
URL location = domain.getCodeSource().getLocation();
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar(location.toExternalForm());
server.setHandler(webapp);
server.start();
server.join();
}
>From what I understand from chapter 33, RESTeasy has some libraries that help with Netty, TJWS and the Sun server. Is there any reason why these isn't a library for using Jetty? Would it not bring any value adds?
Thanks,
Michael
|
|
From: Jason H. <ja...@gm...> - 2013-03-06 16:58:07
|
Hi, I tried the example in RestEasy 2.3.5 for ejb integration in JBoss 5.1.0 AS. The jndi's defined in the web.xml is it automatically registered in JBoss 5.1.0 or do I have to manually create the jndi myself in JBoss. If so how is it done in JBoss 5.1.0. Your example does not explain it. Thanks. Jason |
|
From: Bill B. <bb...@re...> - 2013-03-04 16:12:52
|
I have a commit i'll be merging to fix this. On 3/2/2013 7:04 PM, Ron Sigal wrote: > I've been having a problem compiling > se.unlogic.standardutils.dao.SimpleDataSource in eagledns-fork, and it > turns out that there's a new method in the interface > javax.sql.CommonDataSource. I'm assuming we want Resteasy 3.0 to > support jdk 1.7, so I've created RESTEASY-835 "eagledns-fork doesn't > compile with jdk 1.7" with fix version 3.0-beta-2 (3.0-beta-4 isn't in > the list yet). > > But what about Resteasy 2? Should it support jdk 1.7? > > -Ron > > [And I was just getting used to jdk 1.4.] > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > Resteasy-developers mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/resteasy-developers > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Ron S. <rs...@re...> - 2013-03-03 00:04:23
|
I've been having a problem compiling se.unlogic.standardutils.dao.SimpleDataSource in eagledns-fork, and it turns out that there's a new method in the interface javax.sql.CommonDataSource. I'm assuming we want Resteasy 3.0 to support jdk 1.7, so I've created RESTEASY-835 "eagledns-fork doesn't compile with jdk 1.7" with fix version 3.0-beta-2 (3.0-beta-4 isn't in the list yet). But what about Resteasy 2? Should it support jdk 1.7? -Ron [And I was just getting used to jdk 1.4.] |
|
From: Ron S. <rs...@re...> - 2013-02-19 21:30:55
|
This isn't an issue, just an observation. I had a test that looked like
ClientRequest request = new
ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/concrete/decorators/clear");
ClientResponse<?> response = request.get();
assertEquals(200, response.getStatus());
request = new
ClientRequest("http://localhost:8080/resteasy-cdi-ejb-test/rest/concrete/decorators/execute");
response = request.get();
which I rewrote as
WebTarget target =
ClientBuilder.newClient().target("http://localhost:8080/resteasy-cdi-ejb-test/rest/concrete/decorators");
Response response = target.path("clear").request().get();
assertEquals(200, response.getStatus());
response = target.path("execute").request().get();
The latter failed with
Caused by: java.lang.IllegalStateException: Invalid use of
SingleClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
because I didn't call Response.close(). The analogous call
(ClientResponse.releaseConnection) wasn't necessary in the original
version (though I probably should have done it anyway) because I created
a new ClientRequest for the second call.
The point is that the client framework encourages factoring and reuse,
which led to a problem I didn't have before. Or, really, it exposed a
problem I had before without realizing it.
That's all. Just saying.
-Ron
On 02/18/2013 03:14 PM, Ron Sigal wrote:
> Cool. Done: RESTEASY-829 "CDI doesn't work in client framework".
>
> On 02/17/2013 07:43 PM, Bill Burke wrote:
>> Currently I create a brand new ResteasyProviderFactory every time you
>> create a Client. This has been done for classloader reasons and because
>> you're not really supposed to initialize a Client with scanned providers.
>
> ------------------------------------------------------------------------------
> The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
> is your hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials, tech docs,
> whitepapers, evaluation guides, and opinion stories. Check out the most
> recent posts - join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
|
|
From: Ron S. <rs...@re...> - 2013-02-18 19:14:23
|
Cool. Done: RESTEASY-829 "CDI doesn't work in client framework". On 02/17/2013 07:43 PM, Bill Burke wrote: > Currently I create a brand new ResteasyProviderFactory every time you > create a Client. This has been done for classloader reasons and because > you're not really supposed to initialize a Client with scanned providers. |