在运行链接一段时间后,我在使用spring tomcat并在云tomcat服务器上部署项目后出现以下错误。
Whitelabel错误页面
此应用程序没有/ error的显式映射,因此您将此视为后备。
Thu Feb 01 16:20:29 IST 2018
出现意外错误(type = Internal Server Error,status = 500)。 没有可用消息
这是项目的pom.xml文件。
<?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.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.msoft</groupId>
<artifactId>crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>CRM</name>
<description>Customer Relationship Management</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<packaging>war</packaging>
</project>
我的控制员 - 包com.msoft.crm.controller;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.msoft.crm.model.Users;
import com.msoft.crm.service.IUserService;
@Controller
public class LoginController {
@Autowired
private IUserService userService;
@ResponseBody
@RequestMapping("/hello")
public List<Users> hello(HttpServletRequest request) {
// return userService.getAllUsers();
return userService.getMenusByRole(1);
}
@RequestMapping("/")
public ModelAndView home(ModelAndView modelAndView) {
modelAndView.setViewName("login");
return modelAndView;
}
}
我无法得到我错的地方。代码在本地计算机上运行正常但在云上运行不正常。
添加stacktrace
Exclusions:
-----------
None
Unconditional classes:
----------------------
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
org.springframework.boot.actuate.autoconfigure.PublicMetricsAutoConfiguration
org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration
org.springframework.boot.actuate.autoconfigure.InfoContributorAutoConfiguration
org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration
org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration
org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration
org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration
org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration
org.springframework.boot.actuate.autoconfigure.TraceRepositoryAutoConfiguration
org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration
org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration
2018-02-01 20:20:26.560 DEBUG 4960 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'metricWritersMetricExporter'
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] s.a.ScheduledAnnotationBeanPostProcessor : Could not find default TaskScheduler bean
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.scheduling.TaskScheduler' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:996) ~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.resolveSchedulerBean(ScheduledAnnotationBeanPostProcessor.java:278) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.finishRegistration(ScheduledAnnotationBeanPostProcessor.java:221) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:200) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:94) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:337) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at com.msoft.crm.CrmApplication.main(CrmApplication.java:17) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_144]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.3.RELEASE.jar:1.5.3.RELEASE]
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] s.a.ScheduledAnnotationBeanPostProcessor : Could not find default ScheduledExecutorService bean
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.util.concurrent.ScheduledExecutorService' available
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:996) ~[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.resolveSchedulerBean(ScheduledAnnotationBeanPostProcessor.java:278) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.finishRegistration(ScheduledAnnotationBeanPostProcessor.java:241) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:200) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.onApplicationEvent(ScheduledAnnotationBeanPostProcessor.java:94) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:337) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) [spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]
at com.msoft.crm.CrmApplication.main(CrmApplication.java:17) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_144]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_144]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.3.RELEASE.jar:1.5.3.RELEASE]
2018-02-01 20:20:26.562 INFO 4960 --- [ restartedMain] s.a.ScheduledAnnotationBeanPostProcessor : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Looking for resource handler mappings
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'resourceHandlerMapping'
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'faviconHandlerMapping'
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**/favicon.ico", locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@5ecbefa4]
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/webjars/**", locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@77f913b4]
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**", locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@1002ee43]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [servletConfigInitParams]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [servletContextInitParams]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [random]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [applicationConfig: [classpath:/application.properties]]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [refresh]
2018-02-01 20:20:26.562 TRACE 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [Management Server]
2018-02-01 20:20:26.562 DEBUG 4960 --- [ restartedMain] o.s.c.e.PropertySourcesPropertyResolver : Could not find key 'spring.liveBeansView.mbeanDomain' in any property source
2018-02-01 20:20:26.612 INFO 4960 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8090 (http)
2018-02-01 20:20:26.612 TRACE 4960 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Publishing event in org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@62a0b341: org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent[source=org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer@4bf86f7]
2018-02-01 20:20:26.612 DEBUG 4960 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Adding [server.ports] PropertySource with highest search precedence
2018-02-01 20:20:26.622 TRACE 4960 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Publishing event in org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@62a0b341: org.springframework.boot.context.event.ApplicationReadyEvent[source=org.springframework.boot.SpringApplication@422436cb]
2018-02-01 20:20:26.622 DEBUG 4960 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'springApplicationAdminRegistrar'
2018-02-01 20:20:26.622 DEBUG 4960 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Creating new Restarter for thread Thread[main,5,main]
2018-02-01 20:20:26.622 DEBUG 4960 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Immediately restarting application
2018-02-01 20:20:26.622 DEBUG 4960 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader@24e86b6d
2018-02-01 20:20:26.622 DEBUG 4960 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Starting application com.msoft.crm.CrmApplication with URLs [file:/E:/CRM%20Application/latest_trunk/developed/ui/target/classes/]
2018-02-01 20:20:26.622 INFO 4960 --- [ restartedMain] com.msoft.crm.CrmApplication : Started CrmApplication in 6.857 seconds (JVM running for 7.561)
主要方法的CrmApplication.java类 -
package com.msoft.crm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
public class CrmApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CrmApplication.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(CrmApplication.class, args);
}
}