简体   繁体   English

Groovy / Grails Hibernate无法创建bean事务

[英]Groovy/Grails Hibernate failed to create bean transaction

This is the error I get when I launch tomcat w/ my webapp. 这是我使用Webapp启动tomcat时遇到的错误。 Im sure it has something to do w/ the hibernate plugin. 我确定它与冬眠插件有关。

I had the web application running on version 12.04 LTS ubuntu and now have upgraded to 18.04 LTS. 我的Web应用程序在12.04 LTS ubuntu版本上运行,现在已升级到18.04 LTS。 I have the grails web-app compiled as a .war and have not recompiled the war. 我已经将grails网络应用编译为.war,但还没有重新编译战争。 I figured it would continue to work from one version of ubuntu to another. 我认为它可以从一个版本的ubuntu继续运行到另一个版本。

15-Jun-2018 12:22:32.580 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
15-Jun-2018 12:22:33.287 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
15-Jun-2018 12:22:38.637 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener]
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    ... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    ... 5 more
Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
    ... 5 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
    ... 7 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    ... 8 more

15-Jun-2018 12:22:38.647 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
15-Jun-2018 12:22:38.955 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
15-Jun-2018 12:22:38.955 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
15-Jun-2018 12:22:38.956 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker@306acdc')

Thanks for any help or tips!! 感谢您的帮助或提示!

The key line is this one Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException 关键在于这一点, Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException

It appears that the Java runtime you are running this under on your new version of Ubuntu is different. 看来在新版本的Ubuntu上运行此Java运行时是不同的。 Is it by chance Java 9? Java 9是偶然的吗? If so you probably have the problem described here How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9 如果是这样,则您可能遇到了此处所述的问题如何解决java.lang.NoClassDefFoundError:Java 9中的javax / xml / bind / JAXBException

You could fix the problem as described in that answer, or install a previous version of Java and use that to run your Grails application 您可以按照该答案中所述解决问题,或者安装Java的早期版本并使用它来运行Grails应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM