我用我的项目构建了一个jar文件。服务器使用JPA和MySQL数据库。我成功地在Windows和Debian上运行它。我想在我的VPS上运行它。像往常一样:java -jar server.jar
,但服务器无法启动,日志不会仅移动信息:
[root@vps196664 opt]# java -jar drinkandfood.server-0.1.0.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.2.2.RELEASE)
2015-08-27 15:26:50.215 INFO 1464 --- [ main] com.drinkandfood.server.Application : Starting Application v0.1.0 on vps196664.ovh.net with PID 1464 (/opt/d
rinkandfood.server-0.1.0.jar started by root in /opt)
2015-08-27 15:26:50.364 INFO 1464 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigE
mbeddedWebApplicationContext@288eee4e: startup date [Thu Aug 27 15:26:50 CEST 2015]; root of context hierarchy
2015-08-27 15:26:54.027 INFO 1464 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManag
ementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$2432028c] is not eligible fo
r getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-27 15:26:54.068 INFO 1464 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.t
ransaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-27 15:26:54.105 INFO 1464 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.trans
action.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-27 15:26:54.111 INFO 1464 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdviso
r' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessor
s (for example: not eligible for auto-proxying)
2015-08-27 15:26:55.309 INFO 1464 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2015-08-27 15:26:56.380 INFO 1464 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2015-08-27 15:26:56.381 INFO 1464 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.20
2015-08-27 15:26:56.746 INFO 1464 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2015-08-27 15:26:56.746 INFO 1464 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 6396 ms
2015-08-27 15:26:57.101 INFO 1464 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2015-08-27 15:26:57.121 INFO 1464 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
我不知道出了什么问题。在其他系统上,没有这样的问题。
这是来自Windows机器的日志:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.2.5.RELEASE)
2015-08-27 16:05:32.384 INFO 8388 --- [ main] com.drinkandfood.server.Application : Starting Application on Laptop with PID 8388 (started by �ukasz in C:\Users\�ukasz\IdeaProjects\DFS)
2015-08-27 16:05:32.452 INFO 8388 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@150c158: startup date [Thu Aug 27 16:05:32 CEST 2015]; root of context hierarchy
2015-08-27 16:05:36.543 INFO 8388 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$c72e2994] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-27 16:05:36.598 INFO 8388 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-27 16:05:36.622 INFO 8388 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-27 16:05:36.635 INFO 8388 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2015-08-27 16:05:37.652 INFO 8388 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2015-08-27 16:05:38.266 INFO 8388 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2015-08-27 16:05:38.268 INFO 8388 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.23
2015-08-27 16:05:38.686 INFO 8388 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2015-08-27 16:05:38.686 INFO 8388 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 6239 ms
2015-08-27 16:05:38.999 INFO 8388 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2015-08-27 16:05:39.007 INFO 8388 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2015-08-27 16:05:39.684 INFO 8388 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2015-08-27 16:05:39.711 INFO 8388 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2015-08-27 16:05:39.881 INFO 8388 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.10.Final}
2015-08-27 16:05:39.884 INFO 8388 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2015-08-27 16:05:39.887 INFO 8388 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2015-08-27 16:05:40.493 INFO 8388 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2015-08-27 16:05:41.275 INFO 8388 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2015-08-27 16:05:41.597 INFO 8388 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2015-08-27 16:05:42.298 INFO 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2015-08-27 16:05:42.319 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table product drop foreign key FK_jkpn0y1dute8nbjlx9rvec18
2015-08-27 16:05:42.320 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Can't DROP 'FK_jkpn0y1dute8nbjlx9rvec18'; check that column/key exists
2015-08-27 16:05:42.321 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table product_category drop foreign key FK_ac25kv0aljr3ts4lux00s93yt
2015-08-27 16:05:42.321 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'drinkfood.product_category' doesn't exist
2015-08-27 16:05:42.322 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table product_category drop foreign key FK_cm5vajyq5tshew4w6xvutslrw
2015-08-27 16:05:42.322 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'drinkfood.product_category' doesn't exist
2015-08-27 16:05:42.335 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table restaurant drop foreign key FK_ld6c40vlgs1192pu8kw91021w
2015-08-27 16:05:42.335 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Can't DROP 'FK_ld6c40vlgs1192pu8kw91021w'; check that column/key exists
2015-08-27 16:05:42.337 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table restaurant_products drop foreign key FK_hcv9mkoh1u2ccan9bnynfj5cm
2015-08-27 16:05:42.337 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'drinkfood.restaurant_products' doesn't exist
2015-08-27 16:05:42.338 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table restaurant_products drop foreign key FK_20q3pjlynyuygik57a5vxybd3
2015-08-27 16:05:42.338 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'drinkfood.restaurant_products' doesn't exist
2015-08-27 16:05:42.339 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user drop foreign key FK_qy1digd4jfeljpu058xaf3g8y
2015-08-27 16:05:42.339 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'drinkfood.user' doesn't exist
2015-08-27 16:05:42.346 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: drop table if exists product
2015-08-27 16:05:42.349 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Cannot delete or update a parent row: a foreign key constraint fails
2015-08-27 16:05:42.355 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: drop table if exists restaurant
2015-08-27 16:05:42.355 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Cannot delete or update a parent row: a foreign key constraint fails
2015-08-27 16:05:42.414 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table product (product_id bigint not null auto_increment, description varchar(255), name varchar(255), price double precision, restaurantid bigint, restaurant_id bigint, primary key (product_id))
2015-08-27 16:05:42.414 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'product' already exists
2015-08-27 16:05:42.458 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table restaurant (restaurant_id bigint not null auto_increment, address varchar(255), lat varchar(255), lon varchar(255), name varchar(255), phone varchar(255), user_id bigint, primary key (restaurant_id))
2015-08-27 16:05:42.458 ERROR 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'restaurant' already exists
2015-08-27 16:05:43.352 INFO 8388 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2015-08-27 16:05:44.571 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/category/all]}" onto public java.util.List<com.drinkandfood.server.Entity.Category> com.drinkandfood.server.RestController.CategoryController.getAll()
2015-08-27 16:05:44.573 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addNewProduct],methods=[GET]}" onto public org.springframework.http.ResponseEntity<com.drinkandfood.server.AndroidController.NewProduct> com.drinkandfood.server.RestController.NewProductController.get()
2015-08-27 16:05:44.573 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addNewProduct],methods=[POST]}" onto public org.springframework.http.ResponseEntity<com.drinkandfood.server.AndroidController.NewProduct> com.drinkandfood.server.RestController.NewProductController.update(com.drinkandfood.server.AndroidController.NewProduct)
2015-08-27 16:05:44.574 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/product/findByPriceRange]}" onto java.util.List<com.drinkandfood.server.Entity.Product> com.drinkandfood.server.RestController.ProductController.findByPriceRange(java.lang.Long,java.lang.Double,java.lang.Double)
2015-08-27 16:05:44.579 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/getRestaurants],methods=[GET]}" onto public java.util.List<com.drinkandfood.server.Entity.Restaurant> com.drinkandfood.server.RestController.RestaurantController.getRestaurants()
2015-08-27 16:05:44.580 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/findRestaurant],methods=[GET]}" onto public java.util.List<com.drinkandfood.server.Entity.Restaurant> com.drinkandfood.server.RestController.RestaurantController.findRestaurant(java.lang.String)
2015-08-27 16:05:44.580 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/restaurant/find]}" onto java.util.List<com.drinkandfood.server.Entity.Restaurant> com.drinkandfood.server.RestController.RestaurantController.findByIds(java.lang.Long[])
2015-08-27 16:05:44.581 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/list]}" onto public java.lang.String com.drinkandfood.server.WebController.ListController.showRestaurantPreferences(org.springframework.ui.Model)
2015-08-27 16:05:44.582 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/add_new_product],methods=[GET]}" onto public java.lang.String com.drinkandfood.server.WebController.WebNewProductController.addNewProductForm(org.springframework.ui.Model)
2015-08-27 16:05:44.583 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/new_product],methods=[POST]}" onto public java.lang.String com.drinkandfood.server.WebController.WebNewProductController.setNewProduct(com.drinkandfood.server.WebObject.WebProduct,org.springframework.ui.Model)
2015-08-27 16:05:44.588 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-08-27 16:05:44.588 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2015-08-27 16:05:44.622 INFO 8388 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/login] onto handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2015-08-27 16:05:44.623 INFO 8388 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Root mapping to handler of type [class org.springframework.web.servlet.mvc.ParameterizableViewController]
2015-08-27 16:05:44.639 INFO 8388 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/images/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-08-27 16:05:44.639 INFO 8388 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/js/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-08-27 16:05:44.639 INFO 8388 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/fonts/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-08-27 16:05:44.639 INFO 8388 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/css/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2015-08-27 16:05:45.146 INFO 8388 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@150c158: startup date [Thu Aug 27 16:05:32 CEST 2015]; root of context hierarchy
2015-08-27 16:05:46.134 INFO 8388 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2015-08-27 16:05:46.279 INFO 8388 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2015-08-27 16:05:47.084 INFO 8388 --- [ main] com.drinkandfood.server.Application : Started Application in 15.314 seconds (JVM running for 16.452)
答案 0 :(得分:1)
尝试将此添加到java -jar
启动命令:
-Djava.security.egd=file:/dev/./urandom
这应该通过为它提供更快的会话密钥熵源来加速Tomcat启动(在这种情况下它是嵌入式Tomcat)。