I think it is rather a Wicket/Spring integration question. Thus look at
http://cwiki.apache.org/WICKET/spring.html
You have to
1) Declare your wicket application in your application context, e.g.
<bean id="wicketApplication" class="project.MyApplication"/>
2) Install a SpringComponentInjector in your application, e.g.
class MyApplication extends WebApplication {
public void init() {
super.init();
addComponentInstantiationListener(new
SpringComponentInjector(this));
}
}
3) Add the ContextLoaderListener to your web.xml
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</list
ener-class>
</listener>
HTH, Kai
Edwin Ansicodd <mailto:[email protected]> wrote:
> Extending org.apache.wicket.spring.SpringWebApplication, used abator
> to generate generated DAOs, beans, and _SqlMap.xml files, but
> deploying the app, get following error:
>
> 17:58:31,025 ERROR [[/JPS]] StandardWrapper.Throwable
> java.lang.IllegalStateException: bean of type
> [com.base.dao.LookupTableDAO] not found
>
> I've declared the DAO in a SpringWebApplication like so:
>
> @SpringBean private LookupTableDAO ltDAO;
>
> But the app can't seem to find the DAOs. Is there any additional
> configuration files I need? Or any special requirements if not
> satisfied that would cause the DAOs not to be found?
>
> My abatorConfig.xml includes:
>
> <javaModelGenerator targetPackage="com.base.domain.model"
> targetProject="JPS"/>
> <sqlMapGenerator targetPackage="com.base.dao.ibatis"
> targetProject="JPS"/> <daoGenerator type="SPRING"
> targetPackage="com.base.dao" targetProject="JPS"/>
>
> I also have a persistance.ibatis.xml where my sqlmap and DAOs are
> configured:
>
> <bean id="sqlMapClient"
> class="org.springframework.orm.ibatis.SqlMapClient FactoryBean">
> <property name="configLocation" value="classpath:sqlMapConfig.xml"/>
> <property name="dataSource" ref="dataSource"/>
> </bean>
>
> <bean id="lookupTableDAO" class="com.base.dao.LookupTableDAO">
> <property name="sqlMapClient" ref="sqlMapClient"/>
> </bean>
>
>
> but it seems the app can't find this file or is not using it.
>
> I also have a sqlMapConfig.xml file that lists the sqlmap files:
>
> <sqlMap resource="com/base/dao/ibatis/OBJECTIDS_SqlMap.xml"/>
>
> I don't have a dao.xml like an iBATIS document suggests.
>
> Following is the complete error message:
>
> 17:58:31,025 ERROR [[/JPS]] StandardWrapper.Throwable
> java.lang.IllegalStateException: bean of type
> [com.base.dao.LookupTableDAO] not found
> at
>
org.apache.wicket.spring.SpringBeanLocator.getBeanNameOfClass(SpringBeanLoca
tor.java:107)
> at
>
org.apache.wicket.spring.SpringBeanLocator.getBeanName(SpringBeanLocator.jav
a:192)
> at
>
org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator
.java:133)
> at
>
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFiel
dValue(AnnotProxyFieldValueFactory.java:91)
> at
>
> org.apache.wicket.injection.Injector.inject(Injector.java:108) at
>
>
org.apache.wicket.injection.ConfigurableInjector.inject(ConfigurableInjector
.java:39)
> at
>
com.ppaworld.lbs.base.web.localization.DatabaseResourceLoader.<init>(Databas
eResourceLoader.java:16)
> at
> com.ppaworld.lbs.base.LBSApplication.init(JPSApplication.java:102)
> at
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:514)
> at
> org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:148)
> at javax.servlet.GenericServlet.init(GenericServlet.java:215)
> at
>
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:10
53)
> at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:955)
> at
>
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
4051)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4354)
> at
>
org.apache.geronimo.tomcat.GeronimoStandardContext.access$201(GeronimoStanda
rdContext.java:63)
> at
>
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(
GeronimoStandardContext.java:398)
> at
>
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBef
oreAfterValve.java:47)
> at
>
org.apache.geronimo.tomcat.GeronimoStandardContext.start(GeronimoStandardCon
text.java:251)
> at
>
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
91)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
> at
>
org.apache.geronimo.tomcat.TomcatContainer.addContext(TomcatContainer.java:3
64)
> at
>
org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.j
ava:512)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance
.java:998)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanI
nstanceState.java:268)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceStat
e.java:102)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541
)
> at
>
org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDepe
ndency.java:111)
> at
>
org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.
java:146)
> at
>
org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.
java:120)
> at
>
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(Basi
cLifecycleMonitor.java:176)
> at
>
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifec
ycleMonitor.java:44)
> at
>
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcast
er.fireRunningEvent(BasicLifecycleMonitor.java:254)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanI
nstanceState.java:294)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceStat
e.java:102)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanIns
tanceState.java:124)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance
.java:555)
> at
>
org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel
.java:379)
> at
>
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans
(ConfigurationUtil.java:456)
> at
>
org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelCon
figurationManager.java:188)
> at
>
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfigurat
ion(SimpleConfigurationManager.java:562)
> at
>
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfigurat
ion(SimpleConfigurationManager.java:543)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source) at java.lang.reflect.Method.invoke(Unknown Source)
> at
>
org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionM
ethodInvoker.java:34)
> at
>
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:
124)
> at
>
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:83
2)
> at
> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
> at
>
org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvo
ker.java:35)
> at
>
org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMetho
dInterceptor.java:96)
> at
>
org.apache.geronimo.gbean.GBeanLifecycle$$EnhancerByCGLIB$$3fdff422.startCon
figuration(<generated>)
> at
>
org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.ja
va:67)
> at java.lang.Thread.run(Unknown Source)
>
>
> How does my web application know where to find the DAOs?? Why might
> it not find the DAOs??
>
> Following is my web.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
> Application
> 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>
> <display-name>Johnny Player Special (JPS)</display-name>
> <description>Johnny Player Special </description>
>
> <context-param>
> <param-name>contextConfigLocation</param-name>
>
> <param-value>/WEB-INF/applicationContext.xml</param-value>
> </context-param>
>
> <!-- This filter is only used during test! Please remove for
> production!-->
> <filter>
> <filter-name>JPSMockFilter</filter-name>
>
> <filter-class>com.base.test.JPSMockServletFilter</filter-class>
> </filter>
>
> <filter>
> <filter-name>JPSForwardingFilter</filter-name>
>
> <filter-class>com.base.JPSForwardingFilter</filter-class> </filter>
>
> <!-- This filter is only used during test! Please remove for
> production! -->
> <filter-mapping>
> <filter-name>JPSMockFilter</filter-name>
> <url-pattern>/jps/*</url-pattern>
> </filter-mapping>
>
> <filter-mapping>
> <filter-name>JPSForwardingFilter</filter-name>
> <url-pattern>/jps/quickstart/*</url-pattern>
> </filter-mapping>
>
> <listener>
>
>
<listener-class>org.springframework.web.context.ContextLoaderListener</liste
ner-class>
> </listener>
>
> <servlet>
> <servlet-name>DownloadServlet</servlet-name>
> <display-name>DownloadServlet</display-name>
> <description></description>
>
>
>
> <servlet-class>com.web.downloader.DownloadServlet</servlet-class>
> <load-on-startup>1</load-on-startup> </servlet>
>
>
>
> <servlet>
> <servlet-name>JPSApplication</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-val
ue>
> </init-param>
>
> <init-param>
> <param-name>configuration</param-name>
> <!-- <param-value>development</param-value>
> --> <param-value>deployment</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>JPSApplication</servlet-name>
> <url-pattern>/jps/*</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>DownloadServlet</servlet-name>
> <url-pattern>/download/*</url-pattern>
> </servlet-mapping>
>
> <!-- Database Pool -->
> <resource-ref>
> <res-ref-name>jdbc/JPSDB</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
>
>
>
> <security-constraint>
> <web-resource-collection>
> <web-resource-name>Protected</web-resource-name>
> <url-pattern>/jps/*</url-pattern>
> </web-resource-collection>
> <auth-constraint>
> <role-name>jps</role-name>
> </auth-constraint>
> </security-constraint>
>
> <login-config>
> <auth-method>BASIC</auth-method>
> <realm-name>JPSBASIC</realm-name>
> </login-config>
> <security-role>
> <role-name>jps</role-name>
> </security-role>
>
> </web-app>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]