Tomcat

SpringBoot项目新建遇到问题整理(一)

梦想与她 提交于 2021-02-19 11:04:02
1.新建了一个SpringBoot项目:只引用需要用到的spring boot相关的jar包,除此之外没有任何的配置 启动application.java报错: APPLICATION FAILED TO START *************************** Description: Cannot determine embedded database driver class for database type NONE Action: If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). --——————>原因:因为spring boot只要你在pom中引入了spring-boot-starter-data-jpa,他就会默认需要加载数据库相关的配置 你要是没有在配置文件中配置数据库相关信息,它会加载默认的配置(不存在的) 然后就报错了, 所以你要是要用数据库相关的东西 你就完善配置 不用数据库相关的东西

认识长轮询:配置中心是如何实现推送的?

别说谁变了你拦得住时间么 提交于 2021-02-19 10:42:25
一 前言 传统的静态配置方式想要修改某个配置时,必须重新启动一次应用,如果是数据库连接串的变更,那可能还容易接受一些,但如果变更的是一些运行时实时感知的配置,如某个功能项的开关,重启应用就显得有点大动干戈了。配置中心正是为了解决此类问题应运而生的,特别是在微服务架构体系中,更倾向于使用配置中心来统一管理配置。 配置中心最核心的能力就是配置的动态推送,常见的配置中心如 Nacos、Apollo 等都实现了这样的能力。在早期接触配置中心时,我就很好奇,配置中心是如何做到服务端感知配置变化实时推送给客户端的,在没有研究过配置中心的实现原理之前,我一度认为配置中心是通过长连接来做到配置推送的。事实上,目前比较流行的两款配置中心:Nacos 和 Apollo 恰恰都没有使用长连接,而是使用的长轮询。本文便是介绍一下长轮询这种听起来好像已经是上个世纪的技术,老戏新唱,看看能不能品出别样的韵味。文中会有代码示例,呈现一个简易的配置监听流程。 二 数据交互模式 众所周知,数据交互有两种模式:Push(推模式)和 Pull(拉模式)。 推模式指的是客户端与服务端建立好网络长连接,服务方有相关数据,直接通过长连接通道推送到客户端。其优点是及时,一旦有数据变更,客户端立马能感知到;另外对客户端来说逻辑简单,不需要关心有无数据这些逻辑处理。缺点是不知道客户端的数据消费能力,可能导致数据积压在客户端

Request Mapping returning error 404

蓝咒 提交于 2021-02-19 08:58:08
问题 This is my controller that maps a request to this url http://localhost:8080/SpringMVCJSON/rest/kfc/brands contoller file @Controller @RequestMapping("/kfc/brands") public class JSONController { @RequestMapping(value = "{name}", method = RequestMethod.GET) public @ResponseBody Shop getShopInJSON(@PathVariable String name) { Shop shop = new Shop(); shop.setName(name); shop.setStaffName(new String[] { "name1", "name2" }); return shop; } this is the web.xml with the servlet request that

Java-DOM-Parser: Exception on Transformer.transform

徘徊边缘 提交于 2021-02-19 08:01:41
问题 I'm trying to solve a problem with the domparser since hour. I wrote a simple application to load a xml-file, modify them and write the changes back. It works until I switched converted the project to a maven-project. I'm not sure if thats the problem. I can't understand the exception Here my Code-Part for the DOM-parser: import java.io.File; import java.io.IOException; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans

SocketException : TOO MANY OPEN FILES

我怕爱的太早我们不能终老 提交于 2021-02-19 06:21:40
问题 Web Service - Tomcat deployed in LINUX Below is my code that sends HTTP request i read that TOO MANY OPEN FILES causes because of client does not close the stream and leave it open then I tried close my stream in below codes And increased ulimit -n number to 4096, still got this error if ("GET".equals(methodType)) { //req System.setProperty("http.keepAlive", "false"); logger.info("<--------CALLING TAX-CLIENT REQUEST------------>"); URL url = new URL(api_url + "?" + queryParams); // URLEncoder

Can't start tomcatv9.0 in Eclipse

不问归期 提交于 2021-02-19 05:47:05
问题 Server OverviewI am getting an error while trying to start tomcat from eclipse. The error message shows. The server cannot be started because one or more of the ports are invalid. Open the server editor and correct the invalid ports. what I have done is installed tomcat v9.0 and eclipse oxygen and connected tomcat with eclipse. Windows 7 - 32 bit Eclipse Oxygen Tomcat v9.0 Please help me! The error message is... error message I followed an udemy course "Spring & Hibernate for Beginners" 回答1:

Why is Log4j2 JsonLayout + KeyValuePair printing empty logEvent messages

99封情书 提交于 2021-02-19 04:43:29
问题 TL;DR If I'm using JsonLayout with a nested KeyValuePair in my log4j2.xml config the resulting log messages are empty. Any ideas why? Long Story I'm using Tomcat 8.5.43 with the following logging related JARs: jackson-annotations-2.9.7.jar jackson-core-2.9.7.jar jackson-databind-2.9.7.jar slf4j-api-1.7.25.jar jcl-over-slf4j-1.7.25.jar log4j-api-2.12.0.jar log4j-core-2.12.0.jar log4j-jul-2.12.0.jar log4j-slf4j-impl-2.12.0.jar tomcat-extras-juli-8.5.2.jar (as tomcat-juli.jar in /bin) tomcat

tomcat8 - custom error page for 400

拜拜、爱过 提交于 2021-02-19 04:22:05
问题 In Tomcat (v8.5.24) an URL with a query parameter containing an unencode curly brace ("{") produces a 400 error. You can configure Tomcat to allow it with "relaxedQueryChars". But this is not what I want. I tried to write a custom error page and add it to web.xml <error-page> <error-code>400</error-code> <location>/error/error400</location> </error-page> But this does not work as Tomcat is really killing the request and does not process the error pages (org.apache.coyote.http11

Trouble Deploying WAR file. Failed to start component []

落爺英雄遲暮 提交于 2021-02-19 04:01:28
问题 I am currently having an issue deploying a WAR file to my Tomcat7 server (Im new to web dev with java). Everything works great in eclipse but when I generate a WAR file and deploy it to the server I get the following error. "Failed to start component []" Below is the log dump. Caused by: org.apache.catalina.LifecycleException: Failed to process either the global, per-host or context-specific context.xml file therefore the [] Context cannot be started. at org.apache.catalina.startup

How do I force tomcat to reload trusted certificates?

試著忘記壹切 提交于 2021-02-19 03:22:47
问题 My WebApp uses a Connector for 2-Way SSL (aka "Client Authentication"): <Connector port="8084" SSLEnabled="true" maxThreads="10" minSpareThreads="3" maxSpareThreads="5" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="true" truststoreFile="conf/keystore.kst" truststoreType="JCEKS" sslProtocol="TLS" URIEncoding="UTF-8" keystoreFile="conf/keystore.kst" keystoreType="JCEKS" keyAlias="myAlias" ciphers="TLS_RSA_WITH_AES_128_CBC_SHA,TLS