Spring Framework
  1. Spring Framework
  2. SPR-8781

3.1 RC1 does not work on Google App Engine because direct InitialContext usage (which is restricted)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Complete
    • Affects Version/s: 3.1 RC1
    • Fix Version/s: 3.1 RC2
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      3.1 RC1 uses the InitialContext directly, which causes RC1 not to run on Google App Engine as it is a restricted class. M2 was working fine.

      See below the details:

      java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google App Engine developer's guide for more details.
      at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
      at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136)
      at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103)
      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
      at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:37)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:77)
      at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:32)
      at org.springframework.jndi.JndiPropertySource.getProperty(JndiPropertySource.java:82)
      at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:73)
      at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:59)
      at org.springframework.core.env.AbstractEnvironment.doGetDefaultProfiles(AbstractEnvironment.java:229)
      at org.springframework.core.env.AbstractEnvironment.acceptsProfiles(AbstractEnvironment.java:257)
      at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isCandidateComponent(ClassPathScanningCandidateComponentProvider.java:303)
      at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:232)
      at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:218)
      at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.scan(ClassPathBeanDefinitionScanner.java:196)
      at org.springframework.web.context.support.AnnotationConfigWebApplicationContext.loadBeanDefinitions(AnnotationConfigWebApplicationContext.java:236)
      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
      at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:224)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:186)
      at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:182)
      at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:172)
      at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
      at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
      at com.google.appengine.tools.development.DevAppServerMain.(DevAppServerMain.java:113)
      at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:381)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
      at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:548)
      at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
      at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
      at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
      at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
      at org.mortbay.jetty.Server.doStart(Server.java:224)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:186)
      at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:182)
      at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:172)
      at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
      at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
      at com.google.appengine.tools.development.DevAppServerMain.(DevAppServerMain.java:113)
      at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
      Caused by: java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google App Engine developer's guide for more details.
      at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
      at org.springframework.jndi.JndiTemplate.createInitialContext(JndiTemplate.java:136)
      at org.springframework.jndi.JndiTemplate.getContext(JndiTemplate.java:103)
      at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
      at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:37)
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:77)
      at org.springframework.jndi.JndiLocatorDelegate.lookup(JndiLocatorDelegate.java:32)
      at org.springframework.jndi.JndiPropertySource.getProperty(JndiPropertySource.java:82)
      at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:73)
      at org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:59)
      at org.springframework.core.env.AbstractEnvironment.doGetDefaultProfiles(AbstractEnvironment.java:229)
      at org.springframework.core.env.AbstractEnvironment.acceptsProfiles(AbstractEnvironment.java:257)
      at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.isCandidateComponent(ClassPathScanningCandidateComponentProvider.java:303)
      at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:232)
      ... 27 more

        Activity

        Hide
        Juergen Hoeller added a comment -

        As of 3.1 RC2, StandardServlet/PortletEnvironment checks for the availability of a JNDI environment before registering a JndiPropertySource by default.

        Juergen

        Show
        Juergen Hoeller added a comment - As of 3.1 RC2, StandardServlet/PortletEnvironment checks for the availability of a JNDI environment before registering a JndiPropertySource by default. Juergen
        Hide
        Marcel Overdijk added a comment -

        Thanks Juergen,

        Would there be any option to disable this behavior in RC1?
        Like using a dummy implementation for a certain class? Just wondering...

        Show
        Marcel Overdijk added a comment - Thanks Juergen, Would there be any option to disable this behavior in RC1? Like using a dummy implementation for a certain class? Just wondering...

          People

          • Assignee:
            Juergen Hoeller
            Reporter:
            Marcel Overdijk
            Last updater:
            Trevor Marshall
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 26 weeks, 5 days ago