Gabriel Gruber skrev:

Dear C2.2 Dev-Community!

I just played around with Wicket and wanted to integrate a HelloWorld Wicket application within a C2.2 Block as a servlet service:

<beans xmlns="http://www.springframework.org/schema/beans";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:servlet="http://cocoon.apache.org/schema/servlet";
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cocoon.apache.org/schema/servlet http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd";> <bean id="com.mycompany.block2.service" class="org.apache.cocoon.sitemap.SitemapServlet"> <servlet:context mount-path="/block2" context-path="blockcontext:/block2/"/>
  </bean>
<bean id="com.mycompany.block2.wicketapp" class="org.apache.wicket.protocol.http.WicketServlet">
    <servlet:init-params>
      <entry key="applicationClassName">
        <value>com.mycompany.WicketApplication</value>
      </entry>
    </servlet:init-params>
<servlet:context mount-path="/block2-wicket" context-path="blockcontext:/block2-wicket/"/>
  </bean>
</beans>

While this seems generally ok, there seems to be a problem with the spring namespacehandler for the servlet service tags. When i start spring an exception is thrown like this... Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unable to read spring configurations from classpath*:META-INF/cocoon/spring; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: *Configuration problem: Cannot locate BeanDefinitionDecorator for element [init-params]*

...
What is wrong here?

Any suggestions?
The servlet:context element must be the root element of the elements in the servlet: namespace. The error message basically sys that there is no handler for the servlet:init-params as a root element.

Modify the above  bean definition to:

<bean id="com.mycompany.block2.wicketapp" class="org.apache.wicket.protocol.http.WicketServlet"> <servlet:context mount-path="/block2-wicket" context-path="blockcontext:/block2-wicket/">
     <servlet:init-params>
       <entry key="applicationClassName">
         <value>com.mycompany.WicketApplication</value>
       </entry>
     </servlet:init-params>
   </servlet:context>
 </bean>

And see if it works.

/Daniel

Reply via email to