tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fernando Padilla <f...@alum.mit.edu>
Subject Re: spring context troubles
Date Thu, 01 Jan 2009 23:23:59 GMT
nice work around.  but I want to make sure, this will be a temporary 
work around until you get the latest spring module working as you 
desire, with two-way integration??

Howard Lewis Ship wrote:
> I think the best option for you is to use Tapestry 5.1, but revert
> tapestry-spring to 5.0.18.  This allows you to benefit from the
> improvements to tapestry-core without having any compatibility
> problems with the changes to tapestry-spring. I'm adding documentation
> to the web site to explain this.
> 
> On Mon, Dec 29, 2008 at 4:20 PM, Fernando Padilla <fern@alum.mit.edu> wrote:
>> I'm sorry that I'm hammering on this code, while it's still probably a work
>> in progress.. (always available through im)
>>
>> but I commented out the spring ContextLoaderListener, moved the filter up to
>> be first, and this seems to initialize properly at least for Jetty (within
>> eclipse).  The next issue, it looks like it did not register the spring
>> beans in the TapestryIoC.. so now I'm getting exceptions saying that it
>> can't find particular beans:
>>
>>
>> ....
>> Caused by: java.lang.RuntimeException: Service id 'common-conf-properties'
>> is not defined by any module.  Defined services:
>> ActionRenderResponseGenerator, AjaxComponentEventRequestHandler,
>> AjaxComponentEventResultProcessor, AjaxPartialResponseRenderer, Alias,
>> AliasOverrides, AppSubscriptionHandler, ApplicationContext,
>> ApplicationDefaults, ApplicationGlobals, ApplicationInitializer,
>> ApplicationStateManager, ApplicationStatePersistenceStrategySource,
>> AspectDecorator, AssetBindingFactory, AssetObjectProvider, AssetSource,
>> BaseURLSource, BeanBlockOverrideSource, BeanBlockSource, BeanModelSource,
>> BindingSource, ChainBuilder, ClassNameLocator, ClasspathAssetAliasManager,
>> ClasspathAssetFactory, ClasspathURLConverter, ClientPersistentFieldStorage,
>> ClientPersistentFieldStrategy, ComponentClassCache, ComponentClassFactory,
>> ComponentClassResolver, ComponentClassTransformWorker,
>> ComponentClassTransformer, ComponentClassesInvalidationEventHub,
>> ComponentDefaultProvider, ComponentEventRequestHandler,
>> ComponentEventResultProcessor, ComponentInstanceResultProcessor,
>> ComponentInstantiatorSource, ComponentInvocationMap,
>> ComponentMessagesInvalidationEventHub, ComponentMessagesSource,
>> ComponentPageElementResourcesSource, ComponentSource,
>> ComponentTemplateSource, ComponentTemplatesInvalidationEventHub, Context,
>> ContextAssetFactory, ContextPathEncoder, ContextValueEncoder, CookieSink,
>> CookieSource, Cookies, CtClassSource, DataTypeAnalyzer,
>> DefaultDataTypeAnalyzer, DefaultFileItemFactory,
>> DefaultImplementationBuilder, EndOfRequestListenerHub, Environment,
>> EnvironmentalShadowBuilder, ExceptionAnalyzer, ExceptionTracker,
>> FacebookAuthFilterImpl, FactoryDefaults, FbForceModeFilter,
>> FieldTranslatorSource, FieldValidationSupport, FieldValidatorDefaultSource,
>> FieldValidatorSource, FormSupport, HiddenFieldLocationRules,
>> HttpServletRequest, HttpServletRequestHandler, IgnoredPathsFilter,
>> InjectionProvider, InternalRequestGlobals, LinkCreationHub, LinkFactory,
>> LocalizationSetter, LocationRenderer, LoggingDecorator, MarkupRenderer,
>> MarkupWriterFactory, MasterDispatcher, MasterObjectProvider,
>> MessageBindingFactory, MetaDataLocator, MultipartDecoder,
>> NullFieldStrategyBindingFactory, NullFieldStrategySource, ObjectRenderer,
>> OsForceTypeFilter, PageActivationContextCollector, PageContentTypeAnalyzer,
>> PageDocumentGenerator, PageElementFactory, PageLoader, PageMarkupRenderer,
>> PagePool, PageRenderQueue, PageRenderRequestHandler, PageResponseRenderer,
>> PageTemplateLocator, PartialMarkupRenderer, PersistentFieldManager,
>> PersistentLocale, PipelineBuilder, PropBindingFactory, PropertyAccess,
>> PropertyConduitSource, PropertyShadowBuilder, RegistryStartup,
>> RenderSupport, Request, RequestExceptionHandler, RequestGlobals,
>> RequestHandler, RequestLogFilter, RequestPageCache, RequestPathOptimizer,
>> RequestSecurityManager, ResourceCache, ResourceDigestGenerator,
>> ResourceStreamer, Response, ResponseRenderer, ServiceLifecycleSource,
>> ServletApplicationInitializer, SessionApplicationStatePersistenceStrategy,
>> StrategyBuilder, SymbolSource, TemplateParser, ThreadLocale,
>> TranslateBindingFactory, TranslatorSource, TypeCoercer, URLEncoder,
>> UpdateListenerHub, ValidateBindingFactory, ValidationConstraintGenerator,
>> ValidationMessagesSource, ValueEncoderSource.
>>        at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.locateModuleForService(RegistryImpl.java:321)
>>        at
>> org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:288)
>>        at
>> org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getService(ObjectLocatorImpl.java:39)
>>        at
>> org.apache.tapestry5.internal.services.ServiceAnnotationObjectProvider.provide(ServiceAnnotationObjectProvider.java:35)
>>        at
>> org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:50)
>>        at
>> org.apache.tapestry5.ioc.internal.InvokableToRunnable.run(InvokableToRunnable.java:36)
>>        at
>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:52)
>>
>>
>>
>>
>>
>>
>> Howard Lewis Ship wrote:
>>> We need to figure out the order that the filters are initialized, so
>>> that the Tapestry filter can be initialized first.  I think just
>>> listing it first in the web.xml may do the trick.
>>>
>>> On Mon, Dec 29, 2008 at 4:00 PM, Fernando Padilla <fern@alum.mit.edu>
>>> wrote:
>>>> I just tried it, and it won't work like that :(
>>>>
>>>> Like I said, I use spring outside of tapestry.  So I need a valid working
>>>> spring context before the first request ever gets to tapestry filter..
>>>>
>>>> Here is my exception when I comment out the normal
>>>> ContextLoaderListener..
>>>>
>>>>
>>>>
>>>> [Console output redirected to
>>>>
>>>> file:/local/fern/work/social-app-repository/trunk/fanwars/site/../../log.txt]
>>>> 2008-12-29 15:58:26,140 [main] ERROR org.mortbay.log - failed OpenDS
>>>> java.lang.NullPointerException
>>>>       at
>>>> com.protrade.common.spring.OpenDSFilter.init(OpenDSFilter.java:28)
>>>>       at
>>>> com.protrade.common.web.ProtradeFilter.init(ProtradeFilter.java:37)
>>>>       at
>>>> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
>>>>       at
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>       at
>>>>
>>>> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:589)
>>>>       at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
>>>>       at
>>>>
>>>> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1216)
>>>>       at
>>>> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:509)
>>>>       at
>>>> org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:447)
>>>>       at
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>       at
>>>> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
>>>>       at org.mortbay.jetty.Server.doStart(Server.java:222)
>>>>       at
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>       at runjettyrun.Bootstrap.main(Bootstrap.java:76)
>>>> 2008-12-29 15:58:26,142 [main] ERROR org.mortbay.log - Failed startup of
>>>> context org.mortbay.jetty.webapp.WebAppContext@1961581{/,src/main/webapp}
>>>> java.lang.NullPointerException
>>>>       at
>>>> com.protrade.common.spring.OpenDSFilter.init(OpenDSFilter.java:28)
>>>>       at
>>>> com.protrade.common.web.ProtradeFilter.init(ProtradeFilter.java:37)
>>>>       at
>>>> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
>>>>       at
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>       at
>>>>
>>>> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:589)
>>>>       at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
>>>>       at
>>>>
>>>> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1216)
>>>>       at
>>>> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:509)
>>>>       at
>>>> org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:447)
>>>>       at
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>       at
>>>> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
>>>>       at org.mortbay.jetty.Server.doStart(Server.java:222)
>>>>       at
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>       at runjettyrun.Bootstrap.main(Bootstrap.java:76)
>>>>
>>>>
>>>> Howard Lewis Ship wrote:
>>>>> This is a change in behavior from Tapestry 5.0; it was necessary in
>>>>> order to coordinate Spring and Tapestry IoC.  It is necessary to let
>>>>> Tapestry initialize Spring and use Tapestry-specific subclasses of
>>>>> XmlWebApplicationContext and DefaultListableBeanFactory, to hook in
>>>>> the logic that allows Spring beans to use @Inject and @InjectService.
>>>>>
>>>>> You should be fine if you just remove the ContextLoaderListener from
>>>>> your web.xml.
>>>>>
>>>>> On Mon, Dec 29, 2008 at 3:22 PM, Fernando Padilla
>>>>> <fern@citizensportsinc.com> wrote:
>>>>>> I just tried to run with the latest tapestry-trunk, and I get this
>>>>>> really
>>>>>> nasty exception :( :(
>>>>>>
>>>>>> I initialize my own spring context with a ContextLoaderListener,
>>>>>> because
>>>>>> I
>>>>>> need spring outside of tapestry.  Why is tapestry attempting to create
>>>>>> a
>>>>>> context?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 2008-12-29 15:18:27,363 [main] ERROR org.apache.tapestry5.ioc.Registry
>>>>>> -
>>>>>> Cannot initialize context because there is already a root application
>>>>>> context present - check whether you have multiple ContextLoader*
>>>>>> definitions
>>>>>> in your web.xml!
>>>>>> 2008-12-29 15:18:27,363 [main] ERROR org.apache.tapestry5.ioc.Registry
>>>>>> -
>>>>>> Operations trace:
>>>>>> 2008-12-29 15:18:27,364 [main] ERROR org.apache.tapestry5.ioc.Registry
>>>>>> -
>>>>>> [
>>>>>> 1] Realizing service ApplicationContext
>>>>>> 2008-12-29 15:18:27,364 [main] ERROR org.apache.tapestry5.ioc.Registry
>>>>>> -
>>>>>> [
>>>>>> 2] Invoking ObjectCreator for Spring ApplicationContext
>>>>>> 2008-12-29 15:18:27,364 [main] ERROR org.apache.tapestry5.ioc.Registry
>>>>>> -
>>>>>> [
>>>>>> 3] Creating Spring ApplicationContext via ContextLoader
>>>>>> 2008-12-29 15:18:27,365 [main] ERROR Spring.ApplicationContext -
>>>>>> Construction of service ApplicationContext failed: Cannot initialize
>>>>>> context
>>>>>> because there is already a root application context present - check
>>>>>> whether
>>>>>> you have multiple ContextLoader* definitions in your web.xml!
>>>>>> org.apache.tapestry5.ioc.internal.OperationException: Cannot initialize
>>>>>> context because there is already a root application context present
-
>>>>>> check
>>>>>> whether you have multiple ContextLoader* definitions in your web.xml!
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:74)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:96)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:871)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.spring.SpringModuleDef$1$2.createObject(SpringModuleDef.java:76)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.InvokableToRunnable.run(InvokableToRunnable.java:36)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:52)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:96)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:871)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:52)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:56)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.InvokableToRunnable.run(InvokableToRunnable.java:36)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:52)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:96)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:871)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator.createObject(OperationTrackingObjectCreator.java:49)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:65)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> $ConfigurableWebApplicationContext_11e850a8929.delegate($ConfigurableWebApplicationContext_11e850a8929.java)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> $ConfigurableWebApplicationContext_11e850a8929.getBeanDefinitionCount($ConfigurableWebApplicationContext_11e850a8929.java)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.spring.SpringModule$1.initializeApplication(SpringModule.java:45)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> $ApplicationInitializer_11e850a892a.initializeApplication($ApplicationInitializer_11e850a892a.java)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.services.TapestryModule$37.initializeApplication(TapestryModule.java:1912)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> $ApplicationInitializer_11e850a892a.initializeApplication($ApplicationInitializer_11e850a892a.java)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> $ApplicationInitializer_11e850a8925.initializeApplication($ApplicationInitializer_11e850a8925.java)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.services.TapestryModule$18.initializeApplication(TapestryModule.java:1043)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> $ServletApplicationInitializer_11e850a890f.initializeApplication($ServletApplicationInitializer_11e850a890f.java)
>>>>>>      at
>>>>>> org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:91)
>>>>>>      at
>>>>>> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
>>>>>>      at
>>>>>>
>>>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:589)
>>>>>>      at
>>>>>> org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1216)
>>>>>>      at
>>>>>>
>>>>>> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:509)
>>>>>>      at
>>>>>> org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:447)
>>>>>>      at
>>>>>>
>>>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>>>      at
>>>>>>
>>>>>> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
>>>>>>      at org.mortbay.jetty.Server.doStart(Server.java:222)
>>>>>>      at
>>>>>>
>>>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>>>>>>      at runjettyrun.Bootstrap.main(Bootstrap.java:76)
>>>>>> Caused by: java.lang.IllegalStateException: Cannot initialize context
>>>>>> because there is already a root application context present - check
>>>>>> whether
>>>>>> you have multiple ContextLoader* definitions in your web.xml!
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:172)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.internal.spring.SpringModuleDef$1$2$1.invoke(SpringModuleDef.java:86)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.InvokableToRunnable.run(InvokableToRunnable.java:36)
>>>>>>      at
>>>>>>
>>>>>>
>>>>>> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:52)
>>>>>>      ... 45 more
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Mime
View raw message