You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by "chitrabhanu.das" <ch...@gmail.com> on 2010/09/09 14:51:01 UTC

Wicket Spring integration issue

Hey guys.... I am pretty much stuck integrating wicket and spring.... my
program details are....



applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans default-autowire="autodetect"
    xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
           http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
           http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
           http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
 
    <bean id="FTSApplication" class="nic.fts.FTSApplication" />
    <context:component-scan base-package="nic.fts" />
    
</beans>



web.xml


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app 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"
	 version="2.4">

	<display-name>FTS</display-name>
	<context-param>
        	<param-name>contextConfigLocation</param-name>
        	<param-value>classpath:applicationContext.xml</param-value>
	</context-param>
	
	<listener>
       
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
	<filter>
		<filter-name>wicket.FTS</filter-name>
 		<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
		<init-param>
			<param-name>applicationClassName</param-name>
			<param-value>nic.fts.FTSApplication</param-value>
 		</init-param> 		
	</filter>
 <filter-mapping>
  <filter-name>wicket.FTS</filter-name>
	<url-pattern>/*</url-pattern>
 </filter-mapping>
</web-app>


My WicketApplication Class


package nic.fts;

import org.apache.wicket.Request;
import org.apache.wicket.Response;
import org.apache.wicket.Session;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.protocol.http.WebRequestCycleProcessor;
import
org.apache.wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy;
import org.apache.wicket.request.IRequestCodingStrategy;
import org.apache.wicket.request.IRequestCycleProcessor;
import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
/**
 * Application object for your web application. If you want to run this
application without deploying, run the Start class.
 *
 * @see nic.fts.Start#main(String[])
 */
public class FTSApplication extends WebApplication
{
    /**
     * Constructor
     */
	public FTSApplication()
	{
		System.out.println("WicketApplication called");
	}
	
	@Override
	public void init()
	{
		super.init();
		addComponentInstantiationListener( new SpringComponentInjector(
FTSApplication.this ) );
	}
	
	@Override
	public Session newSession(Request request, Response response) {
		return new UserSession(FTSApplication.this, request);
	}
	
	
	@Override
	protected IRequestCycleProcessor newRequestCycleProcessor() {
 
	return new WebRequestCycleProcessor(){
	  	protected IRequestCodingStrategy newRequestCodingStrategy(){
	  		return new CryptedUrlWebRequestCodingStrategy(new
WebRequestCodingStrategy());
	  	}
	  };
	}


	/**
	 * @see org.apache.wicket.Application#getHomePage()
	 */
	public Class<FTS> getHomePage()
	{
		System.out.println("WicketApplication called for returning the
HomePage.html");
		return FTS.class;
	}

}


the jars I am using are

antlr-runtime-3.0.jar
org.springframework.asm-3.0.0.M3.jar
org.springframework.beans-3.0.0.M3.jar
org.springframework.context-3.0.0.M3.jar
org.springframework.context.support-3.0.0.M3.jar
org.springframework.core-3.0.0.M3.jar
org.springframework.expression-3.0.0.M3.jar
org.springframework.web-3.0.0.M3.jar
org.springframework.web.servlet-3.0.0.M3.jar
wicket-spring-annot-1.3.7.jar
wicket-ioc-1.3.5.jar
wicket-spring-1.3.5.jar
wicket-1.4.10.jar

the full stacktrace i am getting is

SEVERE: failed wicket.FTS
org.apache.wicket.WicketRuntimeException: Application class
nic.fts.FTSApplication must be a subclass of WebApplication
	at
org.apache.wicket.protocol.http.ContextParamWebApplicationFactory.createApplication(ContextParamWebApplicationFactory.java:79)
	at
org.apache.wicket.protocol.http.ContextParamWebApplicationFactory.createApplication(ContextParamWebApplicationFactory.java:49)
	at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:701)
	at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
	at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:594)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
	at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
	at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
	at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
	at org.mortbay.jetty.Server.doStart(Server.java:220)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
	at nic.fts.Start.main(Start.java:36)


where am i doing wrong??? thanks in advance...
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-integration-issue-tp2532788p2532788.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.

Re: Wicket Spring integration issue

Posted by James Carman <ja...@carmanconsulting.com>.
Why the snapshots?

On Thu, Sep 9, 2010 at 9:52 AM, chitrabhanu.das
<ch...@gmail.com> wrote:
>
> thanks for your prompt reply.... now i have removed 1.3 versions and have set
> the following jars in classpath:
>
>
> wicket-ioc-1.4-SNAPSHOT.jar
> wicket-spring-1.4-SNAPSHOT.jar
> wicket-spring-annot-1.4-20080409.121345-1.jar
>
> Still i am getting the same errors....
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-integration-issue-tp2532788p2532904.html
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>

Re: Wicket Spring integration issue

Posted by Igor Vaynberg <ig...@gmail.com>.
you still have a classpath problem

-igor

On Thu, Sep 9, 2010 at 6:52 AM, chitrabhanu.das
<ch...@gmail.com> wrote:
>
> thanks for your prompt reply.... now i have removed 1.3 versions and have set
> the following jars in classpath:
>
>
> wicket-ioc-1.4-SNAPSHOT.jar
> wicket-spring-1.4-SNAPSHOT.jar
> wicket-spring-annot-1.4-20080409.121345-1.jar
>
> Still i am getting the same errors....
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-integration-issue-tp2532788p2532904.html
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>

Re: Wicket Spring integration issue

Posted by "chitrabhanu.das" <ch...@gmail.com>.
thanks for your prompt reply.... now i have removed 1.3 versions and have set
the following jars in classpath:


wicket-ioc-1.4-SNAPSHOT.jar
wicket-spring-1.4-SNAPSHOT.jar
wicket-spring-annot-1.4-20080409.121345-1.jar

Still i am getting the same errors.... 
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-integration-issue-tp2532788p2532904.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.

Re: Wicket Spring integration issue

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Sep 9, 2010 at 2:51 PM, chitrabhanu.das
<ch...@gmail.com>wrote:

>
> Hey guys.... I am pretty much stuck integrating wicket and spring.... my
> program details are....
>
>
>
> applicationContext.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <beans default-autowire="autodetect"
>    xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:aop="http://www.springframework.org/schema/aop"
> xmlns:tx="http://www.springframework.org/schema/tx"
>    xmlns:context="http://www.springframework.org/schema/context"
>    xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>           http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>           http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
>           http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
>
>    <bean id="FTSApplication" class="nic.fts.FTSApplication" />
>    <context:component-scan base-package="nic.fts" />
>
> </beans>
>
>
>
> web.xml
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <web-app 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"
>         version="2.4">
>
>        <display-name>FTS</display-name>
>        <context-param>
>                <param-name>contextConfigLocation</param-name>
>                <param-value>classpath:applicationContext.xml</param-value>
>        </context-param>
>
>        <listener>
>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>    </listener>
>        <filter>
>                <filter-name>wicket.FTS</filter-name>
>
>  <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
>                <init-param>
>                        <param-name>applicationClassName</param-name>
>                        <param-value>nic.fts.FTSApplication</param-value>
>                </init-param>
>        </filter>
>  <filter-mapping>
>  <filter-name>wicket.FTS</filter-name>
>        <url-pattern>/*</url-pattern>
>  </filter-mapping>
> </web-app>
>
>
> My WicketApplication Class
>
>
> package nic.fts;
>
> import org.apache.wicket.Request;
> import org.apache.wicket.Response;
> import org.apache.wicket.Session;
> import org.apache.wicket.protocol.http.WebApplication;
> import org.apache.wicket.protocol.http.WebRequestCycleProcessor;
> import
> org.apache.wicket.protocol.http.request.CryptedUrlWebRequestCodingStrategy;
> import org.apache.wicket.request.IRequestCodingStrategy;
> import org.apache.wicket.request.IRequestCycleProcessor;
> import org.apache.wicket.protocol.http.request.WebRequestCodingStrategy;
> import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
> /**
>  * Application object for your web application. If you want to run this
> application without deploying, run the Start class.
>  *
>  * @see nic.fts.Start#main(String[])
>  */
> public class FTSApplication extends WebApplication
> {
>    /**
>     * Constructor
>     */
>        public FTSApplication()
>        {
>                System.out.println("WicketApplication called");
>        }
>
>        @Override
>        public void init()
>        {
>                super.init();
>                addComponentInstantiationListener( new
> SpringComponentInjector(
> FTSApplication.this ) );
>        }
>
>        @Override
>        public Session newSession(Request request, Response response) {
>                return new UserSession(FTSApplication.this, request);
>        }
>
>
>        @Override
>        protected IRequestCycleProcessor newRequestCycleProcessor() {
>
>        return new WebRequestCycleProcessor(){
>                protected IRequestCodingStrategy newRequestCodingStrategy(){
>                        return new CryptedUrlWebRequestCodingStrategy(new
> WebRequestCodingStrategy());
>                }
>          };
>        }
>
>
>        /**
>         * @see org.apache.wicket.Application#getHomePage()
>         */
>        public Class<FTS> getHomePage()
>        {
>                System.out.println("WicketApplication called for returning
> the
> HomePage.html");
>                return FTS.class;
>        }
>
> }
>
>
> the jars I am using are
>
> antlr-runtime-3.0.jar
> org.springframework.asm-3.0.0.M3.jar
> org.springframework.beans-3.0.0.M3.jar
> org.springframework.context-3.0.0.M3.jar
> org.springframework.context.support-3.0.0.M3.jar
> org.springframework.core-3.0.0.M3.jar
> org.springframework.expression-3.0.0.M3.jar
> org.springframework.web-3.0.0.M3.jar
> org.springframework.web.servlet-3.0.0.M3.jar
> wicket-spring-annot-1.3.7.jar
> wicket-ioc-1.3.5.jar
> wicket-spring-1.3.5.jar
> wicket-1.4.10.jar
>
Why do you mix the versions here ?!
Use 1.4.10 only.

>
> the full stacktrace i am getting is
>
> SEVERE: failed wicket.FTS
> org.apache.wicket.WicketRuntimeException: Application class
> nic.fts.FTSApplication must be a subclass of WebApplication
>        at
>
> org.apache.wicket.protocol.http.ContextParamWebApplicationFactory.createApplication(ContextParamWebApplicationFactory.java:79)
>        at
>
> org.apache.wicket.protocol.http.ContextParamWebApplicationFactory.createApplication(ContextParamWebApplicationFactory.java:49)
>        at
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:701)
>        at
> org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
>        at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>        at
>
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:594)
>        at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
>        at
>
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
>        at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
>        at
> org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
>        at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
>        at org.mortbay.jetty.Server.doStart(Server.java:220)
>        at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
>        at nic.fts.Start.main(Start.java:36)
>
>
> where am i doing wrong??? thanks in advance...
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Spring-integration-issue-tp2532788p2532788.html
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>

Re: Wicket Spring integration issue

Posted by Peter Ertl <pe...@gmx.org>.
Wow, that brief namespace declaration part is hilarious :-)

Am 09.09.2010 um 14:51 schrieb chitrabhanu.das:

> applicationContext.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <beans default-autowire="autodetect"
>    xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    xmlns:aop="http://www.springframework.org/schema/aop"
> xmlns:tx="http://www.springframework.org/schema/tx"
>    xmlns:context="http://www.springframework.org/schema/context"
>    xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>           http://www.springframework.org/schema/aop
> http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
>           http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
>           http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">