[
https://issues.apache.org/jira/browse/TAP5-1837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13406508#comment-13406508
]
Matthias edited comment on TAP5-1837 at 7/4/12 1:29 PM:
--------------------------------------------------------
Because I didn't want to cast, too, I went with the other solution first.
It's not totally obvious, but the ApplicationContext passed to
addServiceDefsForSpringBeans is of type WebApplicationContext and as far as I
can see all of Spring's implementations also implement
ConfigurableApplicationContext ... so the cast should be safe. Maybe
ApplicationContext should be replaced with WebApplicationContext in the whole
file to make this clearer or/and an additional check should be applied when the
external context is located.
was (Author: matthias.noebl):
Because I didn't want a cast, too, I went with the other solution first.
It's not totally obvious, but the ApplicationContext passed to
addServiceDefsForSpringBeans is of type WebApplicationContext and as far as I
can see all of Spring's implementations also implement
ConfigurableApplicationContext ... so the cast should be safe. Maybe
ApplicationContext should be replaced with WebApplicationContext in the whole
file to make this clearer or/and an additional check should be applied when the
external context is located.
> NPE on registry startup when using tapestry.use-external-spring-context in
> 5.3.2
> --------------------------------------------------------------------------------
>
> Key: TAP5-1837
> URL: https://issues.apache.org/jira/browse/TAP5-1837
> Project: Tapestry 5
> Issue Type: Bug
> Components: tapestry-core, tapestry-spring
> Affects Versions: 5.3.2
> Reporter: Adam
> Attachments: TAP5-1837-2.patch, TAP5-1837.patch, t5sandbox.tar.gz
>
>
> When I use a certain kind of bean in my applicationContext.xml, an NPE
> occurs. It only happens with "tapestry.use-external-spring-context" and the
> spring ContextLoaderListener. See attached project.
> java.lang.NullPointerException
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl$2.accept(RegistryImpl.java:273)
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl$2.accept(RegistryImpl.java:270)
> at org.apache.tapestry5.func.F$25.accept(F.java:623)
> at org.apache.tapestry5.func.LazyFilter.next(LazyFilter.java:37)
> at org.apache.tapestry5.func.LazyFlow.resolve(LazyFlow.java:78)
> at org.apache.tapestry5.func.LazyFlow.isEmpty(LazyFlow.java:61)
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl.isContributionForExistentService(RegistryImpl.java:287)
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl.validateContributeDefs(RegistryImpl.java:241)
> at
> org.apache.tapestry5.ioc.internal.RegistryImpl.<init>(RegistryImpl.java:202)
> at
> org.apache.tapestry5.ioc.RegistryBuilder.build(RegistryBuilder.java:177)
> at
> org.apache.tapestry5.internal.TapestryAppInitializer.createRegistry(TapestryAppInitializer.java:200)
> at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:109)
> at
> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:653)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1239)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
> at
> org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:466)
> at
> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:124)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> at
> org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
> 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:222)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:441)
> at
> org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:383)
> at
> org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
> at
> org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
> at
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
> at
> org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
> at
> org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
> 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:597)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira