Html Groovy/Grails Hibernate无法创建bean事务
这是我在启动带有我的webapp的tomcat时遇到的错误。我确信它与hibernate插件有关 我的web应用程序在12.04 LTS ubuntu上运行,现在已经升级到18.04 LTS。我将GrailsWeb应用程序编译为.war,但没有重新编译war。我想它会在ubuntu的不同版本之间继续工作Html Groovy/Grails Hibernate无法创建bean事务,html,hibernate,tomcat,grails,groovy,Html,Hibernate,Tomcat,Grails,Groovy,这是我在启动带有我的webapp的tomcat时遇到的错误。我确信它与hibernate插件有关 我的web应用程序在12.04 LTS ubuntu上运行,现在已经升级到18.04 LTS。我将GrailsWeb应用程序编译为.war,但没有重新编译war。我想它会在ubuntu的不同版本之间继续工作 15-Jun-2018 12:22:32.580 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext
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')
谢谢你的帮助和提示 关键一行是由以下原因引起的
:java.lang.ClassNotFoundException:javax.xml.bind.jaxBeException
在新版本的Ubuntu上运行此功能的Java运行时似乎有所不同。它是偶然的Java 9吗?如果是这样的话,您可能有这里描述的问题
您可以按照回答中所述解决问题,或者安装Java的早期版本,并使用该版本在旧Ubuntu版本上运行Grails应用程序我有Java版本8u161,在新Ubuntu上我有8u171。你认为版本差异会导致问题吗?我还可以尝试安装java9,然后使用您发布的链接中的建议?