Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9970

UnsupportedOperationException when accessing Environment with active SecurityManager

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1 GA
    • Fix Version/s: 3.2.1
    • Component/s: Core, Core:Environment
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      When deploying the webapp to tomcat, I got "java.lang.UnsupportedOperationException" (see the stack trace below). I managed to trace back to the commit 20f87ab98da8a813c0251979286286e5e3776435 and found out the cause of the property name are "spring.profiles.default" and "spring.profile.active". I don't have those properties defined anywhere.

      The workaround is to define those two properties in the web.xml files. The value can be anything.

      Stack trace:
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.ReadOnlySystemAttributesMap.keySet(ReadOnlySystemAttributesMap.java:88)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.MapPropertySource.getPropertyNames(MapPropertySource.java:41)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.EnumerablePropertySource.containsProperty(EnumerablePropertySource.java:70)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.SystemEnvironmentPropertySource.resolvePropertyName(SystemEnvironmentPropertySource.java:109)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.SystemEnvironmentPropertySource.getProperty(SystemEnvironmentPropertySource.java:90)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:73)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:59)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.AbstractEnvironment.getProperty(AbstractEnvironment.java:419)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.AbstractEnvironment.doGetDefaultProfiles(AbstractEnvironment.java:277)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.AbstractEnvironment.getDefaultProfiles(AbstractEnvironment.java:260)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.core.env.AbstractEnvironment.merge(AbstractEnvironment.java:402)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.context.support.AbstractApplicationContext.setParent(AbstractApplicationContext.java:392)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:585)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at javax.servlet.GenericServlet.init(GenericServlet.java:212)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at java.lang.reflect.Method.invoke(Method.java:597)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:270)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at java.security.AccessController.doPrivileged(Native Method)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:302)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:163)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:117)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1200)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1026)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4421)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.StandardContext.start(StandardContext.java:4734)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:124)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:146)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at java.security.AccessController.doPrivileged(Native Method)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:777)
      INFO | jvm 1 | 2012/11/07 12:38:09 | at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cbeams Chris Beams
                Reporter:
                compass Pan Luo
                Last updater:
                Chris Beams
              • Votes:
                2 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 18 weeks, 3 days ago