Just to wrap this up, in case anyone needs this information:

I "solved" the issue by making my own copy of the spring listener and
context loader and added logging instead of exception when this happens.

It turns out that Jetty calls the spring context loader twice, the second
time crashing. See Matt Raible's blog post about this:
http://raibledesigns.com/rd/date/20060815

My log after putting my own logging into spring:

2009-02-17 08:37:24.227:/moby:INFO:  Initializing Spring root
WebApplicationContext
08:37:24,227 INFO  [ContextLoader] Root WebApplicationContext:
initialization started
08:37:25,207 DEBUG [ContextLoader] Published root WebApplicationContext as
ServletContext attribute with name
[org.springframework.web.context.WebApplicationContext.ROOT]
2009-02-17 08:37:25.207:/moby:INFO:  Initializing Spring root
WebApplicationContext
08:37:25,207 INFO  [ContextLoader] Root WebApplicationContext:
initialization completed in 980 ms
08:37:25,207 ERROR [ContextLoader] Multiple context, old context:
org.springframework.web.context.support.xmlwebapplicationcont...@2e67cd84:
display name [Root WebApplicationContext]; startup date [Tue Feb 17 08:37:24
CET 2009]; root of context hierarchy
08:37:25,207 INFO  [ContextLoader] Root WebApplicationContext:
initialization started
08:37:25,315 DEBUG [ContextLoader] Published root WebApplicationContext as
ServletContext attribute with name
[org.springframework.web.context.WebApplicationContext.ROOT]
08:37:25,315 INFO  [ContextLoader] Root WebApplicationContext:
initialization completed in 108 ms

Regards
Inge

On Mon, Feb 16, 2009 at 9:07 AM, Inge Solvoll <inge.tapes...@gmail.com>wrote:

> I also tried removing all links to tapestry 5, with the spring filter being
> the only thing left in web.xml. Still same error in Jetty, still working in
> Tomcat.
>
> I'll stop posting about this here now, because this obviously has nothing
> to do with Tapestry. It is probably due to something weird happening on
> Jetty startup...
>
> Thanks
>
> Inge
>
>
> On Mon, Feb 16, 2009 at 9:04 AM, Inge Solvoll <inge.tapes...@gmail.com>wrote:
>
>> Removed everything except the very essental stuff. Still getting the
>> error. Stripped down web.xml listed below:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
>> 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
>>
>> <web-app >
>>    <distributable/>
>>
>>    <context-param>
>>       <param-name>tapestry.app-package</param-name>
>>       <param-value>no.dossier.moby.frontend.tapestry5</param-value>
>>
>>    </context-param>
>>
>>    <context-param>
>>   <param-name>contextConfigLocation</param-name>
>>   <param-value>/WEB-INF/backend-api.xml</param-value>
>> </context-param>
>>    <filter>
>>      <filter-name>tapestry5</filter-name>
>>
>> <filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
>>  </filter>
>>
>>  <filter-mapping>
>>       <filter-name>tapestry5</filter-name>
>>       <url-pattern>/*</url-pattern>
>>   </filter-mapping>
>>
>>
>>     <listener>
>>
>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>> </listener>
>>
>>
>>    <session-config>
>>       <session-timeout>60</session-timeout>
>>    </session-config>
>>
>> </web-app>
>>
>>
>> On Sun, Feb 15, 2009 at 8:43 PM, Inge Solvoll <inge.tapes...@gmail.com>wrote:
>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
>>> 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd";>
>>>
>>> <web-app >
>>>    <distributable/>
>>>
>>>    <context-param>
>>>       <param-name>tapestry.app-package</param-name>
>>>       <param-value>no.dossier.moby.frontend.tapestry5</param-value>
>>>
>>>    </context-param>
>>>
>>>    <context-param>
>>>   <param-name>contextConfigLocation</param-name>
>>>   <param-value>/WEB-INF/backend-api.xml</param-value>
>>> </context-param>
>>>
>>>    <filter>
>>>      <filter-name>tapestry5</filter-name>
>>>
>>> <filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
>>>  </filter>
>>>
>>> <filter>
>>>   <filter-name>LinkLoginFilter</filter-name>
>>>
>>> <filter-class>no.dossier.moby.frontend.common.filters.LinkLoginFilter</filter-class>
>>> </filter>
>>> <filter>
>>>   <filter-name>BasicFilter</filter-name>
>>>
>>> <filter-class>no.dossier.moby.frontend.common.filters.BasicFilter</filter-class>
>>> </filter>
>>>
>>> <filter>
>>>     <filter-name>ResponseHeaderFilter</filter-name>
>>>
>>> <filter-class>no.dossier.moby.frontend.common.filters.ResponseHeaderFilter</filter-class>
>>> </filter>
>>>
>>> <filter>
>>>     <filter-name>GZIPFilter</filter-name>
>>>
>>> <filter-class>no.dossier.moby.frontend.common.filters.GZIPFilter</filter-class>
>>> </filter>
>>>
>>> <filter>
>>>   <filter-name>configInitFilter</filter-name>
>>>
>>> <filter-class>no.dossier.moby.frontend.filters.ConfigInitFilter</filter-class>
>>> </filter>
>>>
>>> <filter>
>>>     <filter-name>sitemesh</filter-name>
>>>
>>> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
>>> </filter>
>>>
>>>
>>>  <filter-mapping>
>>>       <filter-name>tapestry5</filter-name>
>>>       <url-pattern>/*</url-pattern>
>>>   </filter-mapping>
>>>
>>>
>>>   <filter-mapping>
>>>     <filter-name>ResponseHeaderFilter</filter-name>
>>>     <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>     <filter-name>GZIPFilter</filter-name>
>>>     <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>LinkLoginFilter</filter-name>
>>>   <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>/jsp/*</url-pattern>
>>> </filter-mapping>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>*.do</url-pattern>
>>> </filter-mapping>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>*.page</url-pattern>
>>> </filter-mapping>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>*.reset</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>*.external</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>*.direct</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>*.sdirect</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>BasicFilter</filter-name>
>>>   <url-pattern>/assets4/*</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>     <filter-name>configInitFilter</filter-name>
>>>     <url-pattern>/*</url-pattern>
>>> </filter-mapping>
>>> <filter-mapping>
>>>   <filter-name>sitemesh</filter-name>
>>>   <url-pattern>*.page</url-pattern>
>>> </filter-mapping>
>>> <filter-mapping>
>>>   <filter-name>sitemesh</filter-name>
>>>   <url-pattern>*.reset</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>sitemesh</filter-name>
>>>   <url-pattern>*.external</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>sitemesh</filter-name>
>>>   <url-pattern>*.direct</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>sitemesh</filter-name>
>>>   <url-pattern>*.sdirect</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>sitemesh</filter-name>
>>>   <url-pattern>/assets4/*</url-pattern>
>>> </filter-mapping>
>>>
>>> <filter-mapping>
>>>   <filter-name>sitemesh</filter-name>
>>>   <url-pattern>*.svc</url-pattern>
>>> </filter-mapping>
>>>
>>>
>>>     <listener>
>>>
>>> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>> </listener>
>>>
>>> <servlet>
>>>     <servlet-name>action</servlet-name>
>>>     <servlet-class>
>>>         org.apache.struts.action.ActionServlet
>>>     </servlet-class>
>>>     <init-param>
>>>         <param-name>config</param-name>
>>>         <param-value>/WEB-INF/struts-config.xml</param-value>
>>>     </init-param>
>>>     <init-param>
>>>         <param-name>config/external</param-name>
>>>         <param-value>/WEB-INF/struts-external.xml</param-value>
>>>     </init-param>
>>>     <init-param>
>>>         <param-name>debug</param-name>
>>>         <param-value>2</param-value>
>>>     </init-param>
>>>     <init-param>
>>>         <param-name>detail</param-name>
>>>         <param-value>2</param-value>
>>>     </init-param>
>>>     <init-param>
>>>         <param-name>chainConfig</param-name>
>>>
>>> <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
>>>     </init-param>
>>>     <load-on-startup>1</load-on-startup>
>>> </servlet>
>>>
>>> <servlet>
>>>     <servlet-name>Moby</servlet-name>
>>>     <servlet-class>
>>>         org.apache.tapestry.ApplicationServlet
>>>     </servlet-class>
>>>     <init-param>
>>>         <param-name>org.apache.tapestry.visit-class</param-name>
>>>
>>> <param-value>no.dossier.moby.frontend.common.tapestry.Visit</param-value>
>>>     </init-param>
>>>     <load-on-startup>1</load-on-startup>
>>> </servlet>
>>>
>>> <servlet-mapping>
>>>     <servlet-name>action</servlet-name>
>>>     <url-pattern>*.do</url-pattern>
>>> </servlet-mapping>
>>>
>>> <servlet-mapping>
>>>     <servlet-name>Moby</servlet-name>
>>>     <url-pattern>*.page</url-pattern>
>>> </servlet-mapping>
>>>
>>> <servlet-mapping>
>>>   <servlet-name>Moby</servlet-name>
>>>   <url-pattern>*.direct</url-pattern>
>>> </servlet-mapping>
>>> <servlet-mapping>
>>>   <servlet-name>Moby</servlet-name>
>>>   <url-pattern>*.sdirect</url-pattern>
>>> </servlet-mapping>
>>>
>>> <servlet-mapping>
>>>   <servlet-name>Moby</servlet-name>
>>>   <url-pattern>*.external</url-pattern>
>>> </servlet-mapping>
>>>
>>> <servlet-mapping>
>>>   <servlet-name>Moby</servlet-name>
>>>   <url-pattern>*.reset</url-pattern>
>>> </servlet-mapping>
>>>
>>> <servlet-mapping>
>>>   <servlet-name>Moby</servlet-name>
>>>   <url-pattern>/assets4/*</url-pattern>
>>> </servlet-mapping>
>>>
>>> <servlet-mapping>
>>>   <servlet-name>Moby</servlet-name>
>>>   <url-pattern>*.svc</url-pattern>
>>> </servlet-mapping>
>>>
>>>    <session-config>
>>>       <session-timeout>60</session-timeout>
>>>    </session-config>
>>>
>>>    <welcome-file-list>
>>>       <welcome-file>startPage.do</welcome-file>
>>>    </welcome-file-list>
>>>
>>>   <taglib>
>>>     <taglib-uri>/WEB-INF/string.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/string.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/struts-layout.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/struts-layout.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/taglibs-log.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/taglibs-log.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/string.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/string.tld</taglib-location>
>>> </taglib>
>>> <taglib>
>>>     <taglib-uri>/WEB-INF/dossier-html.tld</taglib-uri>
>>>     <taglib-location>/WEB-INF/dossier-html.tld</taglib-location>
>>> </taglib>
>>>
>>> </web-app>
>>>
>>>
>>>
>>> On Sat, Feb 14, 2009 at 11:00 PM, Howard Lewis Ship <hls...@gmail.com>wrote:
>>>
>>>> Let's see your web.xml.
>>>>
>>>> On Sat, Feb 14, 2009 at 1:07 AM, Inge Solvoll <inge.tapes...@gmail.com>
>>>> wrote:
>>>> > Hi!
>>>> >
>>>> > I''m trying to get my T5 application up and running with Spring. I've
>>>> placed
>>>> > the "kitchen sink" spring.jar in my WEB-INF/lib together with
>>>> > tapestry-spring.jar. I'm using T5.0.18.
>>>> >
>>>> > I'm testing this on Tomcat 6.0.10 and Jetty 6.1.12. Tomcat initializes
>>>> > correctly, and spring injects work nicely from Tapestry pages. But in
>>>> Jetty,
>>>> > spring won't initialize on startup, and I get the exception listed
>>>> below.
>>>> >
>>>> > I have ONE spring listener and ZERO spring servlets and filters. I
>>>> have
>>>> > replaced TapestryFilter with TapestrySpringFilter. If I remove the
>>>> spring
>>>> > context loader listener, I get the expected message from tapestry
>>>> saying
>>>> > that the spring context hasn't been initialized. But all this seems
>>>> > meaningless to pursue, since spring/tapestry integration is working
>>>> > correctly in Tomcat with my current setup. Does anyone have a clue?
>>>> Does
>>>> > Jetty have some kind of built-in spring support that gets in my way?
>>>> >
>>>> > I realize that the problem seems to be related to Jetty and Spring,
>>>> and not
>>>> > to Tapestry. I'm still hoping that you guys can help me on this one,
>>>> as this
>>>> > is a very common case for most of us.
>>>> >
>>>> > 2009-02-14 09:48:14.995:/moby:INFO:  Initializing Spring root
>>>> > WebApplicationContext
>>>> > 2009-02-14 09:48:15.941::WARN:  Failed startup of context
>>>> > org.mortbay.jetty.webapp.webappcont...@7afaa550
>>>> > {/moby,c:/dev/projects/Moby/web}
>>>> > 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:182)
>>>> >    at
>>>> >
>>>> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>>>> >    at
>>>> >
>>>> org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:547)
>>>> >    at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
>>>> >    at
>>>> >
>>>> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1233)
>>>> >    at
>>>> >
>>>> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:516)
>>>> >    at
>>>> > org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:459)
>>>> >    at
>>>> >
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42)
>>>> >    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:42)
>>>> >    at
>>>> >
>>>> org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
>>>> >    at
>>>> >
>>>> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:42)
>>>> >    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:42)
>>>> >    at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
>>>> >    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.mortbay.start.Main.invokeMain(Main.java:194)
>>>> >    at org.mortbay.start.Main.start(Main.java:523)
>>>> >    at org.mortbay.start.Main.main(Main.java:119)
>>>> >
>>>>
>>>>
>>>>
>>>> --
>>>> Howard M. Lewis Ship
>>>>
>>>> Creator Apache Tapestry and Apache HiveMind
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>
>>>>
>>>
>>
>

Reply via email to