Tomcat

错误/异常:java.io.FileNotFoundException: .\src\db.properties (系统找不到指定的路径。);的解决方法

一个人想着一个人 提交于 2021-02-09 13:36:38
1、错误/异常图 2、解决方法 与之相关的部分代码: 1 static { 2 try { 3 // 读取db.properties 4 Properties props = new Properties(); 5 FileInputStream in = new FileInputStream("./src/db.properties"); 6 // 加载文件 7 props.load(in); 8 url = props.getProperty("url" ); 9 user = props.getProperty("user" ); 10 password = props.getProperty("password" ); 11 driverClass = props.getProperty("driverClass" ); 12 // 注册驱动 13 Class.forName(driverClass); 14 } catch (FileNotFoundException e) { 15 e.printStackTrace(); 16 } catch (IOException e) { 17 // TODO Auto-generated catch block 18 e.printStackTrace(); 19 } catch

找不到 cucumber.api.cli.Main 的报错解决方案

耗尽温柔 提交于 2021-02-09 11:34:09
最近玩IDEA,发现导入的项目有问题,报了一个“找不到或者不存在cucumber.api.cli.Main”的错误。 后来发现是新版的IDEA在导入时没有提示,以至于我没有配置项目对应的Tomcat 服务器 ,如上图所示,IDEA错误的给项目配置了一个主类。于是就报错了。 解决方案: 首先点击Run > Edit Configurations > 左上角的 + 号 > Tomcat server > local 一般也不用修改啥配置,直接点击保存即可,然后运行就没问题了 点击“+”添加项目下“WEB-INF”所在目录,在右边的“Application context”里配置“/项目名”。然后点击应用(apply),最后点击OK,就可以了。 这一切搞定后,项目就可以启动了。 来源: oschina 链接: https://my.oschina.net/u/4267186/blog/3620685

Tomcat假死的原因及解决方案

空扰寡人 提交于 2021-02-09 08:05:29
在参与搜人项目时,遇到tomcat假死的问题。 当时情况: 1、ps tomcat正在运行 2、用netstat 查看8080连接情况,有大量的close-wait,还有一些等待连接的状态 3、查看服务器的使用情况,没有过多的消耗内存和CPU 4、重新加载界面,没有报错,只是显示加载失败 5、加载时看到tomcat 日志报错 out of memary 在网上查看资料,问题得到解决 服务器配置:linux+tomcat 现象:Linux服务器没有崩,有浏览器中访问页面,出现无法访问的情况,没有报4xx或5xx错误(假死),并且重启tomcat后,恢复正常。 原因:tomcat默认最大连接数(线程数)200个,默认每一个连接的生命周期2小时(7200秒),tomcat使用http 1.1协议,而http1.1默认是长连接。tomcat接受处理完请求后,socket没有主动关闭,因此如果在2小时内,请求数超过200个,服务器就会出现上述假死现象。 解决方案1:及时断开socket 解决方案2:修改tomcat配置文件,修改最大连接数(增大) 修改server.xml配置文件,Connector节点中增加 acceptCount和maxThreads这两个属性的值,并且使acceptCount大于等于maxThreads: protocol="org.apache.coyote

Can not access deployed WAR file on Tomcat

笑着哭i 提交于 2021-02-08 11:55:52
问题 I have a Spring boot rest service project which works on my local machine. When I run the application as "Spring Boot App" I can access the rest service by going to http://127.0.0.1:8080/persons/all and it returns JSON as it's supposed to. I changed the pom.xml packaging to war, I then created a war by going to Run as -> Maven build in Spring tools suit. It creates a war file. When I upload the war file on http://myserverip:8080/manager/ I get no errors and it shows up under Applications The

How to configure MessageDispatcherServlet programmatically

不问归期 提交于 2021-02-08 11:51:07
问题 I am trying to learn spring-ws and started with this tutorial: http://spring.io/guides/gs/producing-web-service/#initial. What I would like to do now is to start the service on non-embedded servlet container by configuring the application programmatically. I am stuck on how to setup Message Dispatcher Servlet without web.xml. What i tried to is to implement WebApplicationInitializer interface's method onStartup(ServletContext servletContext). public class ServerInitializer implements

How to configure application logging using Log4J on Tomcat 9?

a 夏天 提交于 2021-02-08 09:54:11
问题 I want to use Log4J to log from my Tomcat-based application. The Log4J configuration is <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration debug="true"> <appender name="roller" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="${catalina.base}/logs/application.log"/> <param name="DatePattern" value="'.'yyyy-MM-dd"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[slf5s

JAX-RS on TomCat always returns 404

隐身守侯 提交于 2021-02-08 09:45:11
问题 I have already looked at many tutorials, but I can't get my simple JAX-RS application to work. Tomcat always returns Error 404. The Application to get Classes: package api; import java.util.HashSet; import java.util.Set; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; @ApplicationPath("/resources") public class MyApplication extends Application { // All request scoped resources and providers @Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new

Deploying Multiple Spring Boot Web Applications in Single Server

て烟熏妆下的殇ゞ 提交于 2021-02-08 09:43:13
问题 I have 5 Spring Boot web applications but have only one Server (low-end). What is the best way to deploy all 5 in one Server? Having only one web container (Tomcat) and deploy all of them as separate war files on the same Tomcat or run all 5 on different Tomcat containers (Spring Boot default behavior)? What is your recommendation by considering performance and maintenanability? 回答1: IMHO, if you're running a resource-constrained server, your best bet is to deploy all of your applications as

Deploying Multiple Spring Boot Web Applications in Single Server

血红的双手。 提交于 2021-02-08 09:42:15
问题 I have 5 Spring Boot web applications but have only one Server (low-end). What is the best way to deploy all 5 in one Server? Having only one web container (Tomcat) and deploy all of them as separate war files on the same Tomcat or run all 5 on different Tomcat containers (Spring Boot default behavior)? What is your recommendation by considering performance and maintenanability? 回答1: IMHO, if you're running a resource-constrained server, your best bet is to deploy all of your applications as

Client authentication in server Tomcat

你离开我真会死。 提交于 2021-02-08 09:23:52
问题 i want to configure SSL for mutual authentication. I work with eclipse + tomcat 8. I do this passages: I created private keys in this way: openssl genrsa -des3 -out client_key.pem 2048 openssl genrsa -des3 -out server_key.pem 2048 I created self-signed certificates: openssl req -new -x509 -key client_key.pem -out client.pem -days 365 -config <path to>\openssl.cnf openssl req -new -x509 -key server_key.pem -out server.pem -days 365 -config <path to>\openssl.cnf I created truststore and import