ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin Ansicodd <erik.g.hau...@gmail.com>
Subject Re: How does a web application using iBATIS find the DAOs?? ...pls help...its urgent
Date Thu, 05 Feb 2009 18:50:43 GMT

Hello Rob,

Thank you very much for you reply!!  

I think I am loading my spring application context through web.xml with the
call to :

<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>	

Isn't this enough to load the spring application context? Do I need to
include another configuration file?

I have the following in 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</listener-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-value>
       
		</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>


Edwin Ansicodd wrote:
> 
> Using iBATIS, generated DAOs, beans, and _SqlMap.xml files.
> 
> 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 WebApp 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. 
> 
> I've declared the DAO in a SpringWebApplication like so:
> 
> 	@SpringBean private LookupTableDAO ltDAO;
> 
> But I get the following error on deploying the WebApp:
> 
> 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(SpringBeanLocator.java:107)
> 	at
> org.apache.wicket.spring.SpringBeanLocator.getBeanName(SpringBeanLocator.java:192)
> 	at
> org.apache.wicket.spring.SpringBeanLocator.isSingletonBean(SpringBeanLocator.java:133)
> 	at
> org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(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>(DatabaseResourceLoader.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:1053)
> 	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(GeronimoStandardContext.java:63)
> 	at
> org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:398)
> 	at
> org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
> 	at
> org.apache.geronimo.tomcat.GeronimoStandardContext.start(GeronimoStandardContext.java:251)
> 	at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
> 	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:364)
> 	at
> org.apache.geronimo.tomcat.TomcatWebAppContext.doStart(TomcatWebAppContext.java:512)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:998)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:541)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.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(BasicLifecycleMonitor.java:176)
> 	at
> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
> 	at
> org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:294)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.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(KernelConfigurationManager.java:188)
> 	at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:562)
> 	at
> org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(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(ReflectionMethodInvoker.java:34)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
> 	at
> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:832)
> 	at
> org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
> 	at
> org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
> 	at
> org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
> 	at
> org.apache.geronimo.gbean.GBeanLifecycle$$EnhancerByCGLIB$$3fdff422.startConfiguration(<generated>)
> 	at
> org.apache.geronimo.deployment.plugin.local.StartCommand.run(StartCommand.java: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??
> 
> 

-- 
View this message in context: http://www.nabble.com/How-does-a-web-application-using-iBATIS-find-the-DAOs---...pls-help...its-urgent-tp21856541p21858433.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message