Java 失败 - 在上下文路径中部署应用程序/但上下文无法启动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28281403/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
FAIL - Deployed application at context path / but context failed to start
提问by Keeper01
Im working in 2 separate webapplications a back and front app. The funny thing is when I run the back-end I don't have any issues. But in the front-end I get the following error:
我在 2 个独立的 web 应用程序中工作,一个后台应用程序和一个前台应用程序。有趣的是,当我运行后端时,我没有任何问题。但是在前端我收到以下错误:
I have the following error in Netbeans
NetBeans: Deploying on Apache Tomcat or TomEE
profile mode: false
debug mode: false
force redeploy: true
Undeploying ...
undeploy?path=/
OK - Undeployed application at context path /
In-place deployment at D:\WebDevel\WebStore\WebFrontE\target\Web-1.0-SNAPSHOT
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%7E1%2FAppData%2FLocal%2FTemp%2Fcontext7815575477480252472.xml&path=/
FAIL - Deployed application at context path / but context failed to start
Both are running on the same Tomcat. my colleague has the same code and it works fine :-s
两者都运行在同一个Tomcat上。我的同事有相同的代码,它工作正常:-s
采纳答案by K139
Context Path
(or) Context Root
must be unique for each application deployed on the server.
Context Path
(或)Context Root
对于部署在服务器上的每个应用程序必须是唯一的。
So you can't deploy two applications with same context root to the same server. It seems for both of your applications the context path is /
.
因此,您不能将具有相同上下文根的两个应用程序部署到同一台服务器。对于您的两个应用程序,上下文路径似乎都是/
.
Check server.xml
to see what context path both of them have. If they are not unique, then change them to solve the problem.
检查server.xml
以查看它们都有哪些上下文路径。如果它们不是唯一的,则更改它们以解决问题。
But if you want the same context root for both applications, then you need to deploy them in two different servers.
但是,如果您希望两个应用程序使用相同的上下文根,则需要将它们部署在两个不同的服务器中。
For more information: Tomcat Context paths configuration
更多信息: Tomcat 上下文路径配置
回答by Sharayu
'undeployed application at context path' this error occur due to missing some file while copying project from one system to another. while coping make sure all files should be copied.If an error occur then please recopy project and import it.. It may work..
“在上下文路径中未部署的应用程序”发生此错误是由于在将项目从一个系统复制到另一个系统时丢失了某些文件。在处理时确保所有文件都应该被复制。如果发生错误,请重新复制项目并导入它..它可能会工作..
回答by user3856196
I had the same problem, but I used only maven (without IDE). My tomcat version was tomcat7 7.0.70-1 and jdk8 (in pom.xml
: <java.version>1.8</java.version>
) It turned out that tomcat7 incompatiblewith java 8, so, I changed java.version
in pom.xml
on <java.version>1.7</java.version>
and that was the solution!
我遇到了同样的问题,但我只使用了 maven(没有 IDE)。我的tomcat的版本是tomcat7 7.0.70-1和jdk8(在pom.xml
:<java.version>1.8</java.version>
)原来,tomcat7不兼容的Java 8,所以,我改变了java.version
在pom.xml
上<java.version>1.7</java.version>
,那是解决方案!
回答by Jim Reitz
I had this problem a d after a lot of links that didn't work, found this solution. Edit the server.xml on your Tomee server to provide a fully qualified path for appBase:
在许多无效的链接之后,我遇到了这个问题广告,找到了这个解决方案。编辑 Tomee 服务器上的 server.xml 以提供 appBase 的完全限定路径:
<Host name="localhost" appBase="C:\apache\apache-tomee-7.0.2-plume\webapps"
unpackWARs="true" autoDeploy="true">
回答by Bharadwaj_Turlapati
The following error occurs if your context has not started well. Instance : You have context listener that calls a method and the method is not present.
如果您的上下文没有很好地启动,则会出现以下错误。实例:您有调用方法的上下文侦听器,但该方法不存在。
回答by Kesavan Maharajan
I just had the same issue i solved by giving security permission to the user for Apache Server Foundation in root folder
我刚刚通过在根文件夹中为 Apache Server Foundation 用户授予安全权限解决了同样的问题
回答by Invin
I may be a little late but would say that this could be because of the change in the factory name in Tomcat 8. So follow the below steps:
我可能有点晚了,但会说这可能是因为 Tomcat 8 中的工厂名称发生了变化。因此请按照以下步骤操作:
1) First, see if you are using Tomcat 8 or higher.
1)首先,看看你是否使用的是Tomcat 8或更高版本。
2) If yes, and tomcat is not able to deploy your application. Run the application in Debug mode and see stack trace in Tomcat window (at bottom. Not same as Tomcat.log). Scroll down the window and see if you can find an Exception like this:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory
2) 如果是,并且 tomcat 无法部署您的应用程序。在 Debug 模式下运行应用程序并在 Tomcat 窗口中查看堆栈跟踪(底部。与 Tomcat.log 不同)。向下滚动窗口,看看是否可以找到这样的异常:
引起:java.lang.NoClassDefFoundError:无法初始化类 org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory
3) If you see something like above, Open your META-INF/context.xml and replace or add the factory attribute in the resource tag with: factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
3) 如果你看到类似上面的内容,打开你的 META-INF/context.xml 并在资源标签中替换或添加工厂属性: factory="org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
4) Restart tomcat and redeploy.
4)重启tomcat并重新部署。
回答by im-gautam
I had same problem and I resolved this issue by stopping the tomcat from IDE and run the web application it starts the tomcat automatically.(This works in Netbeans IDE). Simply Stop Tomcat and start again and redeploy web application.
我遇到了同样的问题,我通过从 IDE 停止 tomcat 并运行它自动启动 tomcat 的 Web 应用程序解决了这个问题。(这在 Netbeans IDE 中有效)。只需停止 Tomcat 并重新启动并重新部署 Web 应用程序。
回答by Joe Areeda
My issue was a syntax error in web.xml, I didn't close an element
我的问题是 web.xml 中的语法错误,我没有关闭元素
The tomcat window (NetBeans) had a clear errormessage, thanks Arafat
tomcat 窗口 (NetBeans) 有一个明确的错误消息,感谢 Arafat
01-Sep-2018 17:34:38.641 SEVERE [http-nio-8080-exec-5] org.apache.tomcat.util.digester.Digester.fatalError Parse Fatal Error at line 50 column 11: The element type "param-value" must be terminated by the matching end-tag "".
2018 年 9 月 1 日 17:34:38.641 严重 [http-nio-8080-exec-5] org.apache.tomcat.util.digester.Digester.fatalError 在第 50 行第 11 列解析致命错误:元素类型“param- value" 必须以匹配的结束标签 "" 结尾。
回答by aiipee
I am also had trouble solving this kind of issue on my netbeans. I'm stack the whole day getting rid of this issue. Many solutions have been tried but still nothing happen until I tried to delete the "target" folder of my project and that solved the problem! Hope it helps! :)
我也无法在我的 netbeans 上解决此类问题。我整天都在解决这个问题。已经尝试了许多解决方案,但在我尝试删除项目的“目标”文件夹并解决问题之前仍然没有任何反应!希望能帮助到你!:)