• Bug
  • Status: Resolved
  • 2 Major
  • Resolution: Won't Fix
  • teck
  • Reporter: steve
  • August 23, 2006
  • 1
  • Watchers: 2
  • September 06, 2013
  • September 06, 2013

Description

Spring had an issue with our removing of final from fields. For literals we should be able to leave it because java serialization seems to deal ok with it. We can also consider strategies where we remove the final but fake out the Modifiers.

Comments

Tim Eck 2006-08-23

I don’t know the exact specifics, but I think if you include *..* with a spring app that wants to use something related to org.springframework.beans.factory.config.PropertyPlaceholderConfigurer, one might see any exception like this:

This has something to do with removing a final modifier

org.springframework.core.ConstantException: Field ‘SYSTEM_PROPERTIES_MODE_OVERRIDE’ not found in class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] at org.springframework.core.Constants.asObject(Constants.java:137) at org.springframework.core.Constants.asNumber(Constants.java:108) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.setSystemPropertiesModeName(PropertyPlaceholderConfigurer.java:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:707) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:572) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:737) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:764) at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:753) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1057) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.aw$original$_AW_$createBean$_AW_$org_springframework_beans_factory_support_AbstractAutowireCapableBeanFactory(AbstractAutowireCapableBeanFactory.java:378) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at com.tcspring.GetBeanProtocol.beanNameCflow(GetBeanProtocol.java:74) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.proceed(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory_1_674776996_662555251___AW_JoinPoint.invoke(Unknown Source) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:537) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:362) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:295) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:120) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:101) at com.tctest.spring.integrationtests.framework.web.RemoteContextListener.contextInitialized(RemoteContextListener.java:16) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827) at org.apache.catalina.core.StandardContext.\_\_tc\_wrapped\_start(StandardContext.java:4343) at org.apache.catalina.core.StandardContext.start(StandardContext.java) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) at org.apache.catalina.core.StandardService.start(StandardService.java:480) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) at org.apache.catalina.startup.Catalina.start(Catalina.java:556) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.tc.test.server.appserver.cargo.CargoLinkedChildProcess.main(CargoLinkedChildProcess.java:51)

Geert Bevin 2007-04-27

I’m hitting this problem in RIFE also. You can annotate static final fields in RIFE to for example provide names for certain artifacts. RIFE ensures that these fields are actually final before accepting to do this. When going through TC, this assertion fails and an exceptions is triggered.

Eugene Kuleshov 2007-06-08

Same error reported by Ryan Crumley


Here is the snipet of spring config that is causing issues:

Here is the stack trace:

ource [bside-com.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘systemPropertiesModeName’ threw exception; nested exception is org.springframework.core.ConstantException: Field ‘SYSTEM_PROPERTIES_MODE_OVERRIDE’ not found in class [ org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property ‘systemPropertiesModeName’ threw exception; nested exception is org.springframework.core.ConstantException: Field ‘SYSTEM_PROPERTIES_MODE_OVERRIDE’ not found in class [ org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Caused by: org.springframework.core.ConstantException: Field ‘SYSTEM_PROPERTIES_MODE_OVERRIDE’ not found in class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer ] at org.springframework.core.Constants.asObject(Constants.java:142) at org.springframework.core.Constants.asNumber(Constants.java:113) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.setSystemPropertiesModeName (PropertyPlaceholderConfigurer.java:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.springframework.beans.BeanWrapperImpl.setPropertyValue (BeanWrapperImpl.java:788) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:607) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValue(AbstractPropertyAccessor.java :49) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:74) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java :57) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:965) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean (AbstractAutowireCapableBeanFactory.java:740) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:417) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject (AbstractBeanFactory.java:245) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:242) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156) at org.springframework.context.support.AbstractApplicationContext.getBean (AbstractApplicationContext.java:640) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:403) at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:328) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) at org.springframework.web.context.ContextLoader.createWebApplicationContext (ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized (ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild (StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:535) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java :310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021) at org.apache.catalina.core.StandardHost.start (StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start (StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:709) at org.apache.catalina.startup.Catalina.start(Catalina.java:551) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

Eugene Kuleshov 2007-06-08

Also reported by Chris Richardson:

The first problem is that Spring 2.0.4 seems to break in an unusual way that has something to do with reflection. The org.springframework.core.Constants class uses reflection on PropertyPlaceholderConfigurer to find the public static final fields:

public static boolean isPublicStaticFinal(Field field) { int modifiers = field.getModifiers(); return (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)); }

It’s is used in a couple of Spring bean definitions in my application to map a name such as SYSTEM_PROPERTIES_MODE_OVERRIDE to the constant value.

classpath*:/config/development/**/*.properties classpath*:/config/${ptrack.application.environment}/**/*.properties

org.springframework.beans.MethodInvocationException: Property ‘systemPropertiesModeName’ threw exception; nested exception is org.springframework.core.ConstantException: Field ‘SYSTEM_PROPERTIES_MODE_OVERRIDE’ not found in class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] Caused by: org.springframework.core.ConstantException: Field ‘SYSTEM_PROPERTIES_MODE_OVERRIDE’ not found in class [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] at org.springframework.core.Constants.asObject(Constants.java:145) at org.springframework.core.Constants.asNumber(Constants.java:114) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.setSystemPropertiesModeName(PropertyPlaceholderConfigurer.java:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod) at sun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource) at sun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource) at java.lang.reflect.Method.invoke(Unknown Source)

Tim Eck 2007-08-20

this one needs a new owner