cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Dolg <steven.d...@indoqa.com>
Subject Re: [C3] Putting content in webapp root
Date Wed, 26 May 2010 13:22:04 GMT
Steven Dolg schrieb:
> Hugh Sparks schrieb:
>> Starting with the cocoon-sample-webapp as a model,
>> I'm trying to make this construct work:
>>  
>> webapp:
>>     index.html
>>     sitemap.xmap
>>     WEB-INF/
>>         applicationContext.xml
>>         log4j.xml
>>         web.xml
>>         lib/
>>             ...
>>  
>> applicationContext.xml:
>>  
>>   ...
>>   <bean id="c3demo" class="org.apache.cocoon.servlet.XMLSitemapServlet">
>>     <servlet:context mount-path="" context-path="file://${webroot}"/ 
>> <file://$%7Bwebroot%7D%22/>>
>>   </bean>
>>   ...
>>  
>> web.xml:
>>   ...
>>   <listener>
>>     
>> <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>

>>
>>   </listener>
>>   <context-param>
>>     <param-name>webAppRootKey</param-name>
>>     <param-value>webroot</param-value>
>>   </context-param>
>>   ...
>> Maven compiles and packages the webapp without errors.
>> Jetty runs the webapp without errors, but visiting
>> localhost:8890 does not invoke the sitemap.
>> The log file contains:
>>
>>     ...
>>     2010-05-26 19:30:30,125
>>     ERROR btpool0-1 org.apache.cocoon.servlet.XMLSitemapServlet -
>>     Can't initialize the RequestProcessor correctly.
>>  
>>     org.apache.cocoon.sitemap.SitemapBuilder$SitemapBuilderException:
>>     Can't build sitemap.
>>     ...
>>     Caused by: java.net.UnknownHostException: C
>>     ...
>>  
>>     2010-05-26 19:31:28,718 ERROR btpool0-1
>>     org.apache.cocoon.servlet.XMLSitemapServlet -
>>     Cocoon can't process the request.
>>     java.lang.NullPointerException
>>     ...
>>  
>> I followed the execution into RequestProcessor.java where
>> it turns out the sitemapPath is null. It gets set by the
>> caller, lazyInitialize in XMLSitemapServlet via a call
>> to getInitParameter("sitemap-path") I didn't find this
>> parameter name anywhere else in the cocoon3 java sources
>> or xml files.
>>  
>> The old C2 SitemapServlet contained this expression:
>>  
>>     private static final String DEFAULT_SITEMAP_PATH = "/sitemap.xmap";
>>     ...
>>     if (sitemapPath == null) {
>>         sitemapPath = DEFAULT_SITEMAP_PATH;
>>     }
>>  
>> Inspired by that, I defined sitemap-path as an init-param
>> for XMLSitemapServlet in web.xml. I gave it the value "/sitemap.xmap"
>> But in the debugger, the result of getInitParam("sitemap-path")
>> in XMLSitemapServlet still came back null.
>>  
>> At this point I became sad, dazed, and confused.
>>  
>> Any insights are appreciated.
>
> Hi Hugh,
>
> Try changing the context-path from
>
> context-path="file://${webroot}"/ <file://$%7Bwebroot%7D%22/>>
>
> to
>
> context-path="file:///${webroot}"/ <file://$%7Bwebroot%7D%22/>>

Looks like my mail client tried to be too clever.
Should have read:
context-path="file:///${webroot}"


>
> HTH,
> Steven
>
>>  
>> -Hugh Sparks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


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


Mime
View raw message