尝试部署到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)
关于如何解决此问题的任何想法?
最佳答案
当我从“运行/调试配置”对话框的“部署”选项卡中删除爆炸的war文件并在其位置添加了未爆炸的war文件时,我在IntelliJ Idea v12中遇到了类似的错误-却忘记了将应用程序上下文设置回什么我把它设置为以前。
例如,如果我将Application上下文设置为/coolapp
,那么当我删除爆炸的war文件时,该上下文将重置为/
。我添加了未爆炸的war文件,上下文仍然设置为/
,但是我继续尝试在浏览器中访问/coolapp
。在查找FileNotFoundException
时生成了.../META-INF/context.xml
,它与您在堆栈跟踪底部看到的异常匹配。
希望这对以后的人有所帮助!