1

如果我尝试作为 Java 应用程序运行,我的代码运行正常。但是当我使用调试作为 Java 应用程序异常文件时,会抛出未找到的异常文件。这是我的代码:

public class SecureGameServer {

    public static final ApplicationContext ac= new ClassPathXmlApplicationContext("lion-server.xml");//Here I got the exception
    //public static final ApplicationContext ac= new FileSystemXmlApplicationContext("src\\main\\resources\\lion-server.xml");This code doesnt work too
    public static DefaultChannelGroup gameChannels;

    public static void main(String[] args) throws Exception {
       ...
}
}

怎么了?该程序运行良好。但我无法调试它。

4

2 回答 2

0

哦,我发现异常是在 URLClasspath 上。我不知道为什么,但有断点。我刚刚按 F8 恢复了它。谢谢大家。

于 2013-01-29T21:55:33.313 回答
0

正如名称ClassPathXmlApplicationContext所示,应用程序上下文文件lion-server.xml必须位于类路径中的某个位置。确保是这种情况并且该文件具有格式正确的 XML。

由于您已包含 Eclipse 标记,因此该文件可以位于您的资源文件夹中,例如src\main\resources.

于 2013-01-29T21:31:20.277 回答