Tomcat

BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/<NONE>]

守給你的承諾、 提交于 2020-08-09 08:49:11
问题 I have an Apache Camel v3.3 project that works fine as a stand-alone application but I'm struggling to deploy it to Tomcat. The error I get is: Jul 06, 2020 5:53:49 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener] org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/<NONE>];

Java Web(5)-Servlet详解(上)

不打扰是莪最后的温柔 提交于 2020-08-09 06:51:11
一、Servlet 1. 什么是Servlet Servlet 是 JavaEE 规范之一,规范就是接口 Servlet 就 JavaWeb 三大组件之一,三大组件分别是: Servlet 程序、Filter 过滤器、Listener 监听器 Servlet 是运行在服务器上的一个 java 小程序, 它可以接收客户端发送过来的请求,并响应数据给客户端 2. 手动实现Servlet程序 首先还是在IDEA中创建一个对应的模块,具体看上一个,结果如下 编写一个类去实现 Servlet 接口 实现 service 方法,处理请求,并响应数据 到 web.xml 中去配置 servlet 程序的访问地址 1. 首先在src下建立一个java文件,实现Servlet接口,重写方法 现在先看Servlet(),其他的省略 package com.md.servlet; import javax.servlet.*; import javax.servlet.http.HttpServletRequest; import java.io.IOException; /** * @author MD * @create 2020-07-24 14:44 */ public class HelloServlet implements Servlet { /** *

Eg挨蒙—Zabbix监控进程占cpu和内存大小及批量监控端口

≯℡__Kan透↙ 提交于 2020-08-09 05:45:55
监控简介: 通过shell脚本的方式,实现对进程占cpu百分比和内存大小的监控,通过python脚本方式,实现批量监控服务器端口。 一、监控进程占cpu的百分比和内存的大小 1、在agent端编写脚本 [root@monitor sbin]$ cat /usr/local/zabbix/scripts/processtatus.sh #!/bin/bash #date:2020.05.21 nginx(){ ps aux|grep "nginx"|grep -v "grep"|grep -v "processstatus.sh"|awk '{sum+=$6}; END{print sum}' } nginxcpu(){ ps aux|grep "nginx"|grep -v "grep"|grep -v "processstatus.sh"|awk '{sum+=$3}; END{print sum}' } redis(){ ps aux|grep "redis"|grep -v "grep"|grep -v "processstatus.sh"|awk '{sum+=$6}; END{print sum}' } rediscpu(){ ps aux|grep "redis"|grep -v "grep"|grep -v "processstatus.sh"|awk '{sum+=

Springboot快速上手- 第九篇 Web应用开发

我们两清 提交于 2020-08-09 03:46:49
1 应用开发基础 1.1 静态文件 1: Spring Boot默认为我们提供了静态资源处理,使用 WebMvcAutoConfiguration 来配置各种属性,建议使用默认配置方式,提供的静态资源映射,按照优先级顺序如下: classpath:/META-INF/resources classpath:/resources classpath:/static classpath:/public 2:可以通过修改spring.mvc.static-path-pattern来修改默认的映射路径 3:注意:如果应用将被打包成jar,就不要使用src/main/webapp文件夹。尽管该文件夹是一个共同的标准,但它仅在打包成war的情况下起作用 4:SpringMVC使用ResourceHttpRequestHandler 来进行资源映射,所以可以通过添加自己的WebMvcConfigurerAdapter并覆写addResourceHandlers方法,来改变这个行为,也就是自定义加载静态文件 1.2 自定义加载静态文件示例 @Configuration public class MyWebMvcConfig extends WebMvcConfigurerAdapter { public void addResourceHandlers

Spring Boot 2.3 新特性优雅停机详解

北城以北 提交于 2020-08-09 02:23:08
什么是优雅停机 先来一段简单的代码,如下: @RestController public class DemoController { @GetMapping("/demo") public String demo() throws InterruptedException { // 模拟业务耗时处理流程 Thread.sleep(20 * 1000L); return "hello"; } } 当我们流量请求到此接口执行业务逻辑的时候,若服务端此时执行关机 (kill),spring boot 默认情况会直接关闭容器(tomcat 等),导致此业务逻辑执行失败。在一些业务场景下:会出现数据不一致的情况,事务逻辑不会回滚。 graceful shutdown 在最新的 spring boot 2.3 版本,内置此功能,不需要再自行扩展容器线程池来处理, 目前 spring boot 嵌入式支持的 web 服务器(Jetty、Reactor Netty、Tomcat 和 Undertow)以及反应式和基于 Servlet 的 web 应用程序都支持优雅停机功能。 我们来看下如何使用: 当使用 server.shutdown=graceful 启用时,在 web 容器关闭时,web 服务器将不再接收新请求,并将等待活动请求完成的缓冲期。 配置体验 此处支持的 shutdown 行为

Springboot快速上手- 第八篇 Actuator

烂漫一生 提交于 2020-08-08 19:38:14
1 概述 Spring Boot Actuator的关键特性是在应用程序里提供众多Web端点,通过它们了解应用程序运行时的内部状况,比如: Spring应用程序上下文里配置的Bean Bean在Spring应用程序上下文里是如何组装在一 起的 Spring Boot的自动配置做的决策 应用程序取到的环境变量、系统属性、配置属性和命令行参数 应用程序里线程的当前状态 应用程序最近处理过的HTTP请求的追踪情况 各种和内存用量、垃圾回收、Web请求以及数据源用量相关的指标…… Spring Boot Actuator提供的端点,可以查看官方文档: https://docs.spring.io/spring-boot/docs/2.0.0.M4/reference/htmlsingle/#production-ready-endpoints 2 启用Actuator 要启用Actuator的端点,只需在项目中引入Actuator的起步依赖即可 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> 同时在properties里面设置management.security.enabled=false

sessionid如何产生?由谁产生?保存在哪里?

你离开我真会死。 提交于 2020-08-08 18:46:54
sessionid是一个会话的key,浏览器第一次访问服务器会在服务器端生成一个session,有一个sessionid和它对应。tomcat生成的sessionid叫做jsessionid。 session在访问tomcat 服务器 HttpServletRequest的getSession(true)的时候 创建 ,tomcat的ManagerBase类提供创建sessionid的方法: 随机数+时间+jvmid ; 存储在服务器的内存中,tomcat的StandardManager类将session 存储在内存中 ,也可以持久化到file,数据库,memcache,redis等。 客户端只保存sessionid到cookie 中,而不会保存session,session销毁只能通过invalidate或超时,关掉浏览器并不会关闭session。 那么Session在何时创建呢?当然还是在服务器端程序运行的过程中创建的,不同语言实现的应用程序有不同创建Session的方法,而在Java中是通过调用HttpServletRequest的getSession方法(使用true作为参数)创建的。在创建了Session的同时,服务器会为该Session生成唯一的Session id,而这个Session id在随后的请求中会被用来重新获得已经创建的Session

Publishing failed with multiple errors Could not delete E:\apache-tomcat-7.0.69\webapps\SafeStora...

荒凉一梦 提交于 2020-08-08 18:12:24
eclipse每次修改jsp页面总会报错“ Publishing failed with multiple errors Could not delete E:\apache-tomcat-7.0.69\webapps\SafeStorage\logs\all.log. May be locked by another process. Could not delete E:\apache-tomcat-7.0.69\webapps\SafeStorage\logs\debugs.log. May be locked by another process. Could not delete E:\apache-tomcat-7.0.69\webapps\SafeStorage\logs\errors.log. May be locked by another process. ” 解决办法:双击tomcat,将“Server module without publishing”勾选上即可,如图: 来源: oschina 链接: https://my.oschina.net/u/4279277/blog/4479344

互联网必看文章墙裂推荐

主宰稳场 提交于 2020-08-08 18:06:28
后端必看文章系列 大型项目架构演进过程及思考的点 tomcat集群引发的问题 数据库的垂直拆分和水平拆分 支付 微信支付开发指南(内含微信账号借用) 10行代码搞定微信支付(Java版) 来源: oschina 链接: https://my.oschina.net/jacklinnn/blog/4336244