服务运行时,如果有线程在跑时修改了项目代码

1,看: this web application instance has been stopped already
 
     所以,需要重启Tomcat的情况下才有可能发上,这是第一个出错条件。
 
2,看: Could not load ......
 
     看这个不能直接推出问题产生条件,但是很明显是关于加载的。
 
     总结以上两点,通俗点讲,就是重启了工程(可能是因为直接修改代码,工程reload了), 并且,连过了数据库(登录等),才出现了上述报错信息。
 
原因是因为在tomcat重启的时候,之前的tomcat的线程还没有完全关闭,最新启动tomcat就会报这个异常,只要把tomcat的server.xml 中的reloadable="true" 改成false就OK.
 
下面是Tomcat server.xml配置:
 
<Context debug="0" docBase="E:\Workspaces\CTC-ERP_KF\web" path="" reloadable="false" > 
</Context>
 
导致这种原因还有可能是:使用数据库连接后没有关闭等。
 
下面是Linux下Tomcat的启动、关闭、杀死进程命令:
 
#看是否已经有tomcat在运行了  
ps -ef |grep tomcat  
 
#结果为:
 
root     31918     1 34 11:19 pts/1    00:02:46 /opt/jdk1.6.0_27/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat-7.0.20/conf/logging.properties -server -Xms3000m -Xmx3000m -XX:PermSize=128M -XX:MaxPermSize=256M -Djava.awt.headless=true -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/apache-tomcat-7.0.20/endorsed -classpath /opt/apache-tomcat-7.0.20/bin/bootstrap.jar:/opt/apache-tomcat-7.0.20/bin/tomcat-juli.jar -Dcatalina.base=/opt/apache-tomcat-7.0.20 -Dcatalina.home=/opt/apache-tomcat-7.0.20 -Djava.io.tmpdir=/opt/apache-tomcat-7.0.20/temp org.apache.catalina.startup.Bootstrap start 
#如果有,用kill;  
kill -9 pid   #pid 为相应的进程号 
则 31918 就为进程号 pid = 31918  
kill -9 31918 就可以彻底杀死tomcat 
#然后再启动tomcat即可  
或者  
#直接查看指定端口的进程pid  
netstat -anp|grep 9217   
#结果为 tcp        0      0 :::9217                     :::*                        LISTEN      26127/java  
#则26127为9217这个端口的tomcat进程的pid,然后就可以kill这个进程  
kill -9 26127   
#然后再启动tomcat即可  
 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在C#中使用OpenCV捕获8个摄像头并在子线程上运行,可以使用以下步骤: 1. 安装OpenCV库,可以从官方网站下载安装程序。 2. 在Visual Studio中创建一个新的C#控制台应用程序。 3. 在项目中添加OpenCV的引用,可以通过右键单击“引用” -> “添加引用” -> “浏览” -> 选择OpenCV的dll文件来完成。 4. 创建一个新的子线程,并在其中启动所有8个摄像头的捕获过程。 5. 在子线程中使用OpenCV的VideoCapture类初始化每个摄像头,并捕获每个摄像头的帧。 以下是一个示例代码,可以参考: ``` using System; using System.Threading; using OpenCvSharp; class Program { static readonly int NumCameras = 8; static void Main(string[] args) { // Create a new thread to capture frames from all cameras Thread thread = new Thread(new ThreadStart(CaptureFrames)); thread.Start(); // Main thread logic here... // Wait for the capture thread to finish thread.Join(); Console.WriteLine("Done!"); } static void CaptureFrames() { // Initialize all cameras and capture frames for (int i = 0; i < NumCameras; i++) { // Initialize the camera VideoCapture camera = new VideoCapture(i); // Start capturing frames while (true) { // Capture a frame Mat frame = new Mat(); camera.Read(frame); // Process the frame here... // Release the frame frame.Dispose(); // Sleep for a short time to avoid hogging the CPU Thread.Sleep(10); } // Release the camera camera.Dispose(); } } } ``` 请注意,该代码仅提供了一个基本框架,您需要根据自己的需求进行修改和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值