我有一个Sping Boot 应用程序,我们为我们的产品安装在一些小服务器上。它一直有效。今天晚上,我们已经安装在我们的服务器之一,它没有启动。
每个服务器都是来自公共映像的映像,因此操作系统是相同的。
当我们启动.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关于hibernate的www.example.com
# 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在一个设备中工作,而在另一个设备中给出了这个错误,我不能理解哪个是错误...
3条答案
按热度按时间wgeznvg71#
我也遇到了同样的问题。然后在清理了我的本地maven存储库之后,应用程序就启动并运行了。清理您的本地maven repo(由于损坏的依赖关系),然后重试!
hmtdttj42#
我不是100%确定,但我会替换这个:
用这个:
因此参见下面的示例:
否则,就这样做:
dxxyhpgq3#
如果你在项目中错过了
application.properties
文件,那么你也会面临这样的问题。检查它是否在类路径中可用。