embedded-tomcat-7

Deployment of resources on embedded Tomcat server using Spring Boot

时光毁灭记忆、已成空白 提交于 2019-12-11 13:17:43
问题 I have a project where data from several sources are being processed into some data structures. After the program is done building these structures, I want it to set up a server that enables users to fine-tune these structures manually. I decided that Spring MVC on an embedded Tomcat server set up using Spring Boot is just what I need. I want to use Thymeleaf as view technology, and therefore did @Configuration @ComponentScan @EnableAutoConfiguration public class Main { public static void

Spring boot - Embeded Tomcat HTTP to HTTPS redirect

梦想的初衷 提交于 2019-12-11 12:36:08
问题 I'm using Java 7, Spring-Boot 1.1.7 and an ambeded Tomcat 7. In the past, when I used a stand alone Tomcat, I used to add an http connector, that will redirect the requests to the HTTPS port : <Connector port="8080" enableLookups="false" redirectPort="8443" /> How can I do it when I'm using an embeded Tomcat (and I dont have a server.xml file) ? 回答1: You can add a Connector or configure the existing one with its Java API (e.g. see http://docs.spring.io/spring-boot/docs/current-SNAPSHOT

Spring boot jar fails to start embedded server on adding tomcat-embed-jasper dependency

我只是一个虾纸丫 提交于 2019-12-11 10:18:10
问题 I am upgrading a legacy application to spring boot and creating a fully executable jar. In order to render jsp and tiles I suppose I need to add the tomcat-embed-jasper dependency. After I do that, and try to run the application application startup fails with following stacktrace. Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to

Embedded Tomcat: how to configure the number of request threads

喜夏-厌秋 提交于 2019-12-11 03:38:14
问题 In Embedded Tomcat , how can I configure the number of request threads ? I can't seem to get it to work. I tried all of these without success: tomcat.getConnector().setProperty("maxThreads", "20"); tomcat.getConnector().setAttribute("maxThreads", "20"); tomcat.getConnector().setAttribute("maxThreads", 20); 回答1: If you want embedded tomcat to refuse new connections after 20 connections, you should also set acceptCount attribute. So, below code should work and refuse new connections after 20.

How to set custom realm in embedded tomcat server? I am using Spring Boot.

只愿长相守 提交于 2019-12-11 02:28:43
问题 How to set custom realm for the embedded tomcat? i am using SpringBoot however dont see a way to add custom realm via Embeddedservletcontainercustomizer. 回答1: Looks like you should define this bean: @Bean public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() { TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(); factory.addContextCustomizers(new TomcatContextCustomizer() { @Override public void customize(Context context) {

Embeded Tomcat with webapp directory within the classpath/jar

北战南征 提交于 2019-12-11 00:36:52
问题 So I have a Java application that use to be packaged as a war and then deployed to Tomcat, but now I have it setup so it all runs straight from a jar file using embedded Jetty as follows: class JettyServer extends ServerTrait { val server = new Server() val connector = new ServerConnector(server) connector.setPort(BigSenseServer.config.options("httpPort").toInt) server.setConnectors(Array(connector)) val context = new ServletContextHandler() context.setContextPath(BigSenseServer.webRoot)

Using Spring Boot 2.0 with Tomcat 7.0.82

吃可爱长大的小学妹 提交于 2019-12-10 22:37:40
问题 I have a project that uses Spring Boot 2.0.0.RC2. I need to deploy it to a customer environment using traditional deployment for Tomcat 7.0.82. I've managed to build a war that can be deployed successfully by configuring web.xml in a typical way for Spring applications (with DispatcherServlet) instead of using SpringBootServletInitializer . I also would like to have a quick way of starting the app on local environment using an embedded Tomcat container by simply running the main method in the

configure hibernate with embedded tomcat 7 programmatically

ぃ、小莉子 提交于 2019-12-10 16:38:31
问题 I am trying to configure a embedded tomcat instance in my app without any configuration files. I have done some research and based upon this long tutorial and a shorter one i extracted this steps: Create a ServletContextListener @WebListener //some articles on the web mentioned, that this would add the //Listener automatically to the app context, but i cant believe that this works in my case public class HibernateListener implements ServletContextListener { public void contextInitialized

java.net.SocketTimeoutException on embedded tomcat with jersey

我的未来我决定 提交于 2019-12-10 16:35:01
问题 My server application use embedded tomcat with Jersey. From time to time I'm getting the following error: 02-03-2014 10:06:05 [com.sun.jersey.spi.container.ContainerResponse] [http-nio-8243-exec-4] [ERROR] - The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container java.net.SocketTimeoutException at org.apache.tomcat.util.net.NioBlockingSelector.read(NioBlockingSelector.java:191) at org.apache.tomcat.util.net.NioSelectorPool

Spring boot - Embedded Tomcat - Connector Customizer - fail to add parseBodyMethods attributes

我的未来我决定 提交于 2019-12-08 04:26:49
问题 The original problem is when I sent a http request with method 'DELETE', the body part couldn't be sent to the server. After googling, I found this article that suggests modifying the server.xml file and adding 'parseBodyMethods' to the Connector part can solve the problem: <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" parseBodyMethods="POST,PUT,DELETE" redirectPort="8443" /> However, because I'm using spring's embedded tomcat, I have to find a way to do the same in