Jos Snellings wrote:
> Hi,
>
> When trying to deploy a cocoon-3 block to Tomcat, it does not seem to
> find it:
> java.lang.RuntimeException: There is no block 'YourBlockName' deployed.
> The available blocks are {}.
>
> I must say that the documentation on this issue is a little bit terse...
> (http://cocoon.apache.org/subprojects/block-deployment/1.1/1471_1_1.html)
>
>>From what I understand:
> - pack block in a .jar file
> - add a line to the manifest file META-INF/MANIFEST.MF :
> Cocoon-Block-Name: YourBlockName
> (yes it ends with a newline)
> - place .jar in lib directory of webapp
>
> Can anybody shed some light on this issue, please?
In order to use a Cocoon *block*, you also have to install the
BlockDeploymentServletContextListener in your web.xml:
<listener>
<listener-class>org.apache.cocoon.blockdeployment.BlockDeploymentServletContextListener</listener-class>
</listener>
If the block provides servlet-services, you have to use the
DispatcherServlet of the servlet-service-framework which collects and
mounts all servlets that are registered as Spring beans.
<servlet>
<description>Cocoon blocks dispatcher</description>
<display-name>DispatcherServlet</display-name>
<servlet-name>DispatcherServlet</servlet-name>
<servlet-class>org.apache.cocoon.servletservice.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DispatcherServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
And of course you have to properly setup Spring:
<!--
Declare Spring context listener which sets up the Spring Application
Context containing all Cocoon components (and user defined beans as
well).
-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!--
Declare Spring request listener which sets up the required
RequestAttributes to support Springs and Cocoon custom bean scopes
like the request scope or the session scope.
-->
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
Does this answer your question?
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member [email protected]
________________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]