Reputation: 1262
I am trying to deploy spring boot application on my server. I have kept my WAR file on webapps folder inside Tomcat.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.privilance</groupId>
<artifactId>privilance_survey</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>privilance_survey</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j</artifactId>
<version>2.1</version>
</dependency>
<!--
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.21</version><!--$NO-MVN-MAN-VER$-->
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.11</version>
</dependency>
</dependencies>
<build>
<finalName>privilance</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I did some search and find out some people solved their problem by adding this bean.
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcatFactory = new TomcatEmbeddedServletContainerFactory() {
@Override
protected void postProcessContext(Context context) {
final int cacheSize = 40 * 1024;
StandardRoot standardRoot = new StandardRoot(context);
standardRoot.setCacheMaxSize(cacheSize);
context.setResources(standardRoot); // This is what made it work in my case.
logger.info(String.format("New cache size (KB): %d", context.getResources().getCacheMaxSize()));
}
};
return tomcatFactory;
}
But in my case this is also not working. Whenever I run localhost:8080/privilance
on my browser says:
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
and in my cmd prompt says:
the background cache eviction process was unable to free [10] percent of the cache for context. consider increasing maximum size of the cache ....approximately [9285] kb of data remained on the cache.
Upvotes: 2
Views: 13516
Reputation: 2132
There are multiple solutions:
more details on this link
Upvotes: 3
Reputation: 654
What you get in the cmd is probably warning ? I think this might be something to with the resouce configuration in web.xml. Please see Running servlet shows error. Hope it helps.
Upvotes: 0