2016-04-23 29 views
0
我有以下错误

当我运行SpringBootApplication不成功:ALTER TABLE注释下降外键

2016-04-23 05:50:24.346 INFO 11585 --- [ restartedMain] org.hibernate.dialect.Dialect   : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 
2016-04-23 05:50:24.356 INFO 11585 --- [ restartedMain] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory 
2016-04-23 05:50:24.385 INFO 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export 
2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_i2t738wo4x3tdcmbhqgomubmg 
2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist 
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_t0dkmpiim1vamsp4gk8prew3n 
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist 
2016-04-23 05:50:24.441 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table course drop foreign key FK_cuaoq0uw55jpcfvfhbuii5utp 
2016-04-23 05:50:24.441 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.course' doesn't exist 
2016-04-23 05:50:24.461 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table course_material drop foreign key FK_bs5094299iyx2d9ljh6i5rc6k 
2016-04-23 05:50:24.461 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.course_material' doesn't exist 
2016-04-23 05:50:24.481 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table course_material drop foreign key FK_e4tmf79knpcyxjfc41452wtlv 
2016-04-23 05:50:24.481 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.course_material' doesn't exist 
2016-04-23 05:50:24.501 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table forum drop foreign key FK_rynifmiry638ka6e08avmxl9x 
2016-04-23 05:50:24.501 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.forum' doesn't exist 
2016-04-23 05:50:24.533 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table mail_box drop foreign key FK_hodc1557iup5oc121suudg5hr 
2016-04-23 05:50:24.533 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.mail_box' doesn't exist 
2016-04-23 05:50:24.557 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message drop foreign key FK_2kutjtgfjvk2m3i29668l0n3j 
2016-04-23 05:50:24.557 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message' doesn't exist 
2016-04-23 05:50:24.577 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message drop foreign key FK_lbhyy4gtgh0ojf80bc4aq6x45 
2016-04-23 05:50:24.577 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message' doesn't exist 
2016-04-23 05:50:24.599 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message_mailbox drop foreign key FK_eqau3hwhobsvhxr4b0m2xvuop 
2016-04-23 05:50:24.599 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message_mailbox' doesn't exist 
2016-04-23 05:50:24.624 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table message_mailbox drop foreign key FK_d6vn0iflgf9k6jrbsqmwrdxjf 
2016-04-23 05:50:24.624 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.message_mailbox' doesn't exist 
2016-04-23 05:50:24.641 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table registered_user drop foreign key FK_jxpn3w33nyd74ygfsv0smd2i7 
2016-04-23 05:50:24.641 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.registered_user' doesn't exist 
2016-04-23 05:50:24.663 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_rating drop foreign key FK_3lpqe9rmerccjerpnxnhyiyhv 
2016-04-23 05:50:24.663 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.user_rating' doesn't exist 
2016-04-23 05:50:24.685 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_takes_course drop foreign key FK_7ra4qdylay0p2622re8tobacb 
2016-04-23 05:50:24.685 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.user_takes_course' doesn't exist 
2016-04-23 05:50:24.708 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table user_takes_course drop foreign key FK_md8p234kyrbc3unoaaqytxpre 
2016-04-23 05:50:24.708 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.user_takes_course' doesn't exist 
2016-04-23 05:50:26.899 INFO 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete 
2016-04-23 05:50:26.952 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot[email protected]5ffb21e1: startup date [Sat Apr 23 05:50:21 CEST 2016]; root of context hierarchy 
2016-04-23 05:50:26.956 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/home],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.mycompany.app.controllers.HomeController.home(org.springframework.ui.Model) 
2016-04-23 05:50:26.956 INFO 11585 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/welcome]}" onto public com.mycompany.app.controllers.Welcome com.mycompany.app.controllers.WelcomeController.welcome(java.lang.String) 
2016-04-23 05:50:26.957 INFO 11585 --- [ restartedMain] 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) 
2016-04-23 05:50:26.957 INFO 11585 --- [ restartedMain] 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,javax.servlet.http.HttpServletResponse) 
2016-04-23 05:50:26.962 INFO 11585 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 
2016-04-23 05:50:26.962 INFO 11585 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 
2016-04-23 05:50:26.968 INFO 11585 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal) 
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.033 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String) 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/env || /env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String) 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/info || /info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.034 INFO 11585 --- [ restartedMain] o.s.b.a.e.mvc.EndpointHandlerMapping  : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke() 
2016-04-23 05:50:27.052 WARN 11585 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer  : Unable to start LiveReload server 
2016-04-23 05:50:27.076 INFO 11585 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter  : Registering beans for JMX exposure on startup 
2016-04-23 05:50:27.078 INFO 11585 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 
2016-04-23 05:50:27.100 INFO 11585 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 
2016-04-23 05:50:27.101 INFO 11585 --- [ restartedMain] com.mycompany.app.App     : Storing a few customers... 
2016-04-23 05:50:27.431 INFO 11585 --- [ restartedMain] com.mycompany.app.App     : Started App in 5.693 seconds (JVM running for 773.917) 
2016-04-23 05:50:34.376 INFO 11585 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]  : Initializing Spring FrameworkServlet 'dispatcherServlet' 
2016-04-23 05:50:34.376 INFO 11585 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet  : FrameworkServlet 'dispatcherServlet': initialization started 
2016-04-23 05:50:34.398 INFO 11585 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet  : FrameworkServlet 'dispatcherServlet': initialization completed in 22 ms 

我已经看到了还有另外一个类似的问题,但我不知道如何解决它无论如何。很奇怪,因为在某些情况下,同样的错误似乎出现两次,例如

2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_i2t738wo4x3tdcmbhqgomubmg 
2016-04-23 05:50:24.405 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist 
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: alter table comment drop foreign key FK_t0dkmpiim1vamsp4gk8prew3n 
2016-04-23 05:50:24.423 ERROR 11585 --- [ restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport : Table 'Group2SEA2016.comment' doesn't exist 

注意,显然这是不影响例如在一定URL请求的答复......

编辑

我忘了提。我拥有删除和创建此数据库中的表的所有权限。我使用Spring来重新创建表,这是我的application.properties文件:

spring.datasource.driverClassName=com.mysql.jdbc.Driver 
spring.datasource.url=jdbc:mysql://path_to_server/Group2SEA2016 
spring.datasource.username=my_user 
spring.datasource.password=my_password 

spring.jpa.generate-ddl=true 
spring.jpa.hibernate.ddl-auto=create-drop 

有了这个,我想从@Entity类重建之前每次删除表...

回答

0

这是不奇怪,错误出现两次。每次失败操作都会出现一次错误。有两个不同的ALTER TABLE语句正在执行。

: HHH000389: Unsuccessful: alter table comment drop foreign key FK_i2t738wo4x3tdcmbhqgomubmg 
: Table 'Group2SEA2016.comment' doesn't exist 
: HHH000389: Unsuccessful: alter table comment drop foreign key FK_t0dkmpiim1vamsp4gk8prew3n 
: Table 'Group2SEA2016.comment' doesn't exist 

错误的原因可能正是错误消息所说的。它看起来像是指Group2SEA2016数据库中名为comment的表。

表可能不存在。或者,表可能存在,但是您要连接的用户在表上没有权限。

在一些MySQL实例上,表名是区分大小写的。可能有一个表名称Comment,但如果该实例使用区分大小写的表名称,则对表名称comment的引用将不匹配。

+0

对不起,我忘了提及(这里很晚,我很累)。我可以完全访问数据库,即我可以删除任何我想要的表。我将用更多的相关细节来编辑我的问题。 – nbro

0

我不确定在这里看到我的控制台在错误发生之前给出了更多信息(我猜你只是复制错误而不是之前发布的信息行),但是我的错误在哪里。 我的问题似乎是我试图使用保留名称(如)的列。当我改变那个列名时,hibernate没有再给出任何错误,并且我的db被正确地创建了。