我有一個Spring Boot應用程序,我們在我們的產品的一些小型服務器上安裝該應用程序。它一直工作。今天晚上,我們已經將它安裝在我們的一臺服務器上,並沒有啓動。Spring引導應用程序無法啓動
每臺服務器都是來自一個共同映像的映像,所以操作系統是相同的。
當我們推出我們正在將.jar:
Oct 05, 2016 11:16:45 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Oct 05, 2016 11:16:45 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.5
Oct 05, 2016 11:16:46 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
Oct 05, 2016 11:17:03 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Tomcat
這是我們application.properties這對於休眠
# Username and password
spring.datasource.username = parkuser
spring.datasource.password = xxxxxxxxxxxxxxxxxxxxxx
spring.datasource.url= jdbc:mysql://xxxxxxxxxxxxxxxxxxxxxxxxx:3306/SMARTPARK?useSSL=false
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
spring.jpa.show-sql = false
# Hibernate ddl auto (create, create-drop, update): with "update" the database
# schema will be automatically updated accordingly to java entities found in
# the project
spring.jpa.hibernate.ddl-auto = update
# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext
在我們的pom.xml中,我們有
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
<version>1.3.8.RELEASE</version>
</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-jdbc</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-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
這是我們的StartServer.class
@SpringBootApplication
@EnableScheduling
public class StartServer extends SpringBootServletInitializer{
public static void main(String[] args){
SpringApplication.run(StartServer.class, args);
}
@Bean
public HibernateJpaSessionFactoryBean sessionFactory() {
return new HibernateJpaSessionFactoryBean();
}
}
我無法理解爲什麼在一個設備中的同一個jar的作品,而在另一個人給這個錯誤,我不明白這是錯誤...
此服務器是否具有與其他版本相同的Java版本?在pom中你有mysql連接器的依賴關係,但我認爲它不能加載這個依賴關係,所以它不能確定連接哪個數據庫。可能這種行爲是由於java版本 – reos
每臺服務器都是由相同的映像製作的... – besmart
是否存在連接到數據庫的權限問題?用戶名/密碼或聯網?由於連接無法工作,因此可能無法檢測到幾件事情。 – wemu