you need to assign the correct application class (fully path!) derived from WebApplication

->
<!--<param-name>applicationClassName</param-name>
            <param-value>HelloWorldApplication</param-value>-->

is outcommented and not set, correct this;

also remember to call

addComponentInstantiationListener(new SpringComponentInjector(this));

in your application's init() function

Best

Korbinian

pxk schrieb:
Hello all,

I trying to configure a maven multi module app which uses wicket spring and
hibernate and unfortunately i'm stuck. I know that this may be the wrong
forum to post but since the exception is more relative to wicket i thought i
should try here. Anyway enough nagging.

The web.xml is this one:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="simple-webapp" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
    <display-name>Simple Web Application</display-name>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:applicationContext-weather.xml
            classpath:applicationContext-persist.xml
        </param-value>
    </context-param>
    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/log4j.properties</param-value>
    </context-param>
    <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>WicketSpring</servlet-name>
<servlet-class>org.apache.wicket.protocol.http.WicketServlet</servlet-class>
        <init-param>
            <param-name>applicationFactoryClassName</param-name>
<param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
            <!--<param-name>applicationClassName</param-name>
            <param-value>HelloWorldApplication</param-value>-->
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>WicketSpring</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>

The spring application context is this one:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd";>

<beans> <bean id="weatherController" class="com.sonatype.maven.web.WeatherController">
       <property name="weatherService" ref="weatherService"/>
       <property name="weatherDAO" ref="weatherDAO"/>
     </bean>

<bean id="historyController" class="com.sonatype.maven.web.HistoryController">
       <property name="weatherDAO" ref="weatherDAO"/>
       <property name="locationDAO" ref="locationDAO"/>
     </bean>

     <!-- you can have more than one handler defined -->

     <bean id="velocityConfig"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
       <property name="resourceLoaderPath" value="/WEB-INF/vm/"/>
     </bean>

     <bean id="viewResolver"
class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
       <property name="cache" value="true"/>
       <property name="prefix" value=""/>
       <property name="suffix" value=".vm"/>
       <property name="exposeSpringMacroHelpers" value="true"/>
     </bean>
<!-- setup wicket application -->
     <bean id="wicketApplication"
class="com.sonatype.maven.web.WicketApplication"/>
</beans>

and the exception which has ruined my week is this one:

javax.servlet.ServletException: Servlet.init() for servlet WicketSpring
threw exception

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        java.lang.Thread.run(Thread.java:595)


root cause
java.lang.IllegalStateException: bean of type
[org.apache.wicket.protocol.http.WebApplication] not found

org.apache.wicket.spring.SpringWebApplicationFactory.createApplication(SpringWebApplicationFactory.java:107)

org.apache.wicket.spring.SpringWebApplicationFactory.createApplication(SpringWebApplicationFactory.java:86)
        org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:503)
        
org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:188)
        javax.servlet.GenericServlet.init(GenericServlet.java:212)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
        
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        java.lang.Thread.run(Thread.java:595)

I have used every possible web.xml configuration that i found on the net but
still i have this exception.
I've used a filter configuration instead of a servlet but that is even
worst.
Can you pleaseeeeeeeeeeeeeee help me.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to