浏览 2544 次
锁定老帖子 主题:关于spring的两个问题
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2007-01-16
异常如下: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [D:\王勋\我的开发环境\jakarta-tomcat-5.0.28\jakarta-tomcat-5.0.28\bin\WebRoot\WEB-INF\applicationContext.xml]; nested exception is java.io.FileNotFoundException: WebRoot\WEB-INF\applicationContext.xml (系统找不到指定的路径。) java.io.FileNotFoundException: WebRoot\WEB-INF\applicationContext.xml (系统找不到指定的路径。) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at org.springframework.core.io.FileSystemResource.getInputStream(FileSystemResource.java:85) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:167) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:129) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:145) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113) at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:262) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:89) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:74) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:65) at com.srit.sadsearch.daoImpl.InsertBatchDaoImpl.batchInsert(InsertBatchDaoImpl.java:23) at com.srit.sadsearch.action.BatchAddInfoAction.execute(BatchAddInfoAction.java:27) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at cn.com.srit.gisupdate.common.SetCharacterEncoding.doFilter(SetCharacterEncoding.java:48) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:595) 当然我只是用到了JDBCTemplate所以没有配置WEB.XML和struts-config.xml(应该没有关系吧) 请看看. 问题2.这个可能比较幼稚.在spring中,我发现 <bean id="transactionAttributeSource" class="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource"> <property name="properties"> <props> <prop key="add"> PROPAGATION_REQUIRES_NEW </prop> </props> </property> </bean> 中可以通过properties的KEY来匹配我想实现事务操作的方法. 但要是在 <bean id="studentManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="target"> <value></value> </property> <property name="transactionManager"> <value></value> </property> <property name="transactionAttributeSource"> <ref bean="transactionAttributeSource"/> </property> </bean> <bean id="myTrans" class="org.springframework.transaction.interceptor.DefaultTransactionAttribute"> <property name="propagationBehaviorName"> <value>PROPAGATION_REQUIRES_NEW</value> </property> <property name="isolationLevelName"> <value>ISOLATION_REPEATABLE_READ</value> </property> </bean> <bean id="transactionAttributeSource" class="org.springframework.transaction.interceptor.MatchAlwaysTransactionAttributeSource"> <property name="transactionAttribute"> <ref bean="myTrans"/> </property> </bean> 中没有指定这个事务所匹配的方法名(或格式) 请赐教.不胜感激 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2007-01-17
问题1, 你到底是进行console编程还是web应用编程。
web编程,还是要配通过web.xml对spring进行配置。 (为啥就不能按照文档来呢?) |
|
返回顶楼 | |
发表时间:2007-01-18
因为我先在CONSLE下好调试.在移植到WEB上面.
我对SPRING配置还没有到随便写来就保证不出错的地步.而且.我前面也说了.我知识想用一个SPRING 的JDBCTEMPLATE所以觉得没有必要.且在CONSLE下能调试通过. 现在我吧FileSystemXmlApplicationContext换成了Web...ApplicationContext.这个类就能用了. 我查了着两个类的区别.他们主要是根目录在工程中的级别不一样。但和我调试结果有出入.不管怎么样好了旧好。 |
|
返回顶楼 | |