Intellij12.1.4和Tomcat 7 context.xml问题

时间:2014-01-23 21:12:35

标签: intellij-idea tomcat7

当尝试部署到tomcat7时,我得到一个空白的网页,而.IntelliJIdea12 \ system文件夹中的日志文件显示以下错误 -

com.intellij.execution.ExecutionException: Cannot load C:\Users\XXX\GitRepo\project1\webapp\target\webapp-3.1.0-SNAPSHOT\META-INF\context.xml
    at org.jetbrains.idea.tomcat.TomcatUtil.loadXMLFile(TomcatUtil.java:151)
    at org.jetbrains.idea.tomcat.TomcatUtil.findContextInContextXml(TomcatUtil.java:103)
    at org.jetbrains.idea.tomcat.TomcatUtil.findContextElement(TomcatUtil.java:338)
    at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl.addApplicationContext(TomcatAdminLocalServerImpl.java:192)
    at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl$4.doPerform(TomcatAdminLocalServerImpl.java:123)
    at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl$DeployStep.perform(TomcatAdminLocalServerImpl.java:271)
    at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl.doDeploy(TomcatAdminLocalServerImpl.java:118)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$4.doPerform(JavaeeJmxAdminServerBase.java:115)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$JmxOperation.perform(JavaeeJmxAdminServerBase.java:234)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase.doStartDeploy(JavaeeJmxAdminServerBase.java:106)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase.access$100(JavaeeJmxAdminServerBase.java:22)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$2.setDeploymentStatus(JavaeeJmxAdminServerBase.java:85)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$DeploymentModelOperation.doSetDeploymentStatus(JavaeeJmxAdminServerBase.java:272)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$3.doPerform(JavaeeJmxAdminServerBase.java:95)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$JmxOperation.perform(JavaeeJmxAdminServerBase.java:234)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase.doStartDeployWithUndeploy(JavaeeJmxAdminServerBase.java:90)
    at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase.startDeploy(JavaeeJmxAdminServerBase.java:69)
    at org.jetbrains.idea.tomcat.admin.TomcatAdminServerBase.startDeploy(TomcatAdminServerBase.java:122)
    at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl.startDeploy(TomcatAdminLocalServerImpl.java:101)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.javaee.oss.admin.AdminClientBase$InvocationHandlerImpl$1.call(AdminClientBase.java:55)
    at com.intellij.javaee.oss.admin.AdminClientBase$InvocationHandlerImpl$2.run(AdminClientBase.java:74)
    at com.intellij.javaee.util.SequentialTaskExecutor$1.run(SequentialTaskExecutor.java:32)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:454)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:152)
Caused by: java.io.FileNotFoundException: C:\Users\XXX\GitRepo\project1\webapp\target\webapp-3.1.0-SNAPSHOT\META-INF\context.xml (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at com.intellij.openapi.util.JDOMUtil.loadDocument(JDOMUtil.java:350)
    at org.jetbrains.idea.tomcat.TomcatUtil.loadXMLFile(TomcatUtil.java:145)

有关如何解决此问题的想法吗?

1 个答案:

答案 0 :(得分:0)

当我从“运行/调试配置”对话框的“部署”选项卡中删除了爆炸的war文件并在其位置添加了非爆炸的war文件时,我在IntelliJ Idea v12中遇到了类似的错误 - 同时忘记设置应用程序上下文回到我之前设定的内容。

例如,如果我将应用程序上下文设置为/coolapp,那么当我删除爆炸的war文件时,上下文会重置为/。我添加了非爆炸的war文件,上下文仍然设置为/,但我继续尝试在浏览器中访问/coolapp。在查找FileNotFoundException时会产生.../META-INF/context.xml,这与您在堆栈跟踪底部看到的异常相匹配。

希望这可以帮助将来的某个人!