java/spring-在org.springframework.context.support.AbstractApplicationContext处获取NoClassDefFoundError [英] java/spring- getting NoClassDefFoundError at org.springframework.context.support.AbstractApplicationContext
问题描述
我正在尝试初始化使用过Spring的RMI客户端.
I am trying to initialise an RMI client for which I have used Spring.
现在,应用程序的RMI上下文存储在file = rmiClientAppContext.xml中
Now, the application's RMI context is stored in file= rmiClientAppContext.xml
下面给出了使用上述文件的相关代码-
The relevant code for using the above file is given below--
//RMI Client Application Context is started...
ApplicationContext context = new ClassPathXmlApplicationContext("rmiClientAppContext.xml");
但是,当我尝试运行该程序时,这就是我得到的错误-
However, when I try and run the program, this is the error I am getting--
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:164)
at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:90)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:59)
at org.springframework.context.support.AbstractXmlApplicationContext.<init>(AbstractXmlApplicationContext.java:61)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:136)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
在进一步研究上述错误消息的第一行时,我发现
On further investigation of the first line of error message above, I found that
"164 is not a valid line number in org.springframework.context.support.AbstractApplicationContext"
我在这里做错了什么?我正在使用Spring v3.1.3 如何解决以上错误?另外,对于RMI客户端,我到底必须包括哪些JAR?在Eclipse中将这些JAR添加到Java构建路径时,是否有任何特定的顺序?
What have i done wrong here? I am using Spring v3.1.3 How do I resolve the above error? Also, exactly which JARs do I have to include for the RMI client? And is there any specific order in which those JARs should be added to Java build path in Eclipse?
推荐答案
在这种特殊情况下,应在客户端类路径中包含commons-logging-1.1.1.jar. Spring-Core依赖于此.
In this particular case you should include commons-logging-1.1.1.jar in your client classpath. Spring-Core depends on it.
通常,我建议您使用 Maven 或类似工具来管理依赖项.
In general I suggest you to use Maven or similar tool to manage your dependencies.
这篇关于java/spring-在org.springframework.context.support.AbstractApplicationContext处获取NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!