论坛首页 Java企业应用论坛

Spring Exception

浏览 3432 次
该帖已经被评为隐藏帖
作者 正文
   发表时间:2007-08-30  
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from file [D:\tomcat-5.5\bin\applicationContext.xml]; nested exception is java.io.FileNotFoundException: applicationContext.xml (系统找不到指定的文件。)
java.io.FileNotFoundException: 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.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
at test.lfh.spring.Test.testSpring(Test.java:26)
at test.lfh.spring.TestD.doGet(TestD.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)


不知道什么错误了.. 弄了好久了..所以上来求教. 我是初学者.
   发表时间:2007-08-30  
package test.lfh.spring;

import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;

import com.lfh.spring.test.Action;

public class Test {

public void testSpring() {
try {
// FileInputStream is =new
// FileInputStream("applicationContext.xml");
// XmlBeanFactory factory=new XmlBeanFactory((Resource) is);
// ApplicationContext ctx=new
// FileSystemXmlApplicationContext("applicationContext.xml");
// Action action=(Action) ctx.getBean("TheAction");
// System.out.print(action.execute("lfh"));
// Resource rs = new FileSystemResource("beans-config.xml");
// BeanFactory factory = new XmlB eanFactory(rs);
// HelloBean hello = (HelloBean) factory.getBean("helloBean");
// System.out.println(hello.getHelloWord());
Resource rs = new FileSystemResource("applicationContext.xml");
BeanFactory factory = new XmlBeanFactory(rs);
Action action = (Action) factory.getBean("TheAction");
System.out.println(action.execute("lfh"));
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}

}
}
  • 大小: 5 KB
0 请登录后投票
   发表时间:2007-08-31  

错误很清楚了

[D:\tomcat-5.5\bin\applicationContext.xml]; nested exception is java.io.FileNotFoundException: applicationContext.xml (系统找不到指定的文件。)

到D:\tomcat-5.5\bin\目录下看能否找到applicationContext.xml,可能是你的eclipse的自动编译有问题

0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics