首页 > 解决方案 > Spring boot - 无法构建休眠 SessionFactory;嵌套异常是 java.lang.UnsupportedOperationException

问题描述

当我在本地机器上的 IBM Websphere 8.5.5.14/SDK 1.8 上部署我的 war 文件时,我遇到了这个运行时异常。但是,当我在 Tomcat 上部署相同的应用程序时,没有遇到此类异常。

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.abc.xyz</groupId>
    <artifactId>xyz</artifactId>
    <version>0.0.5</version>
    <packaging>war</packaging>

    <name>xyz</name>
    <description>Web App</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.15.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <log4j2.version>2.8.2</log4j2.version>
        <hibernate.version>5.2.13.Final</hibernate.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </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-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.8</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.54</version>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>


    </dependencies>
</project>

应用程序属性

spring.jpa.generate-ddl=true
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect

spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.type=trace
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false

spring.session.store-type=jdbc
spring.session.jdbc.initializer.enabled=true
server.session.timeout=600

spring.session.jdbc.schema=classpath:org/springframework/session/jdbc/schema-mysql.sql

堆栈跟踪

[12/10/18 11:30:37:536 IST] 0000009d SystemErr     R com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Error creating bean with name &amp;#39&#59;entityManagerFactory&amp;#39&#59; defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed&amp;#59&#59; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory&amp;#59&#59; nested exception is java.lang.UnsupportedOperationException
[12/10/18 11:30:37:536 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:433)
[12/10/18 11:30:37:536 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1211)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1450)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:1032)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:795)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1413)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2273)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:436)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
[12/10/18 11:30:37:537 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:379)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:127)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$1.run(CompositionUnitMgrImpl.java:654)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5572)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5698)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:668)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.startCompositionUnit(CompositionUnitMgrImpl.java:612)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1303)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at java.lang.reflect.Method.invoke(Method.java:508)
[12/10/18 11:30:37:538 IST] 0000009d SystemErr     R    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:83)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at java.lang.reflect.Method.invoke(Method.java:508)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:287)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at javax.management.modelmbean.RequiredModelMBean$4.run(RequiredModelMBean.java:1263)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at java.security.AccessController.doPrivileged(AccessController.java:666)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:91)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1257)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1096)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:831)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:813)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1350)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
[12/10/18 11:30:37:539 IST] 0000009d SystemErr     R    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1243)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at com.ibm.ws.management.commands.AdminServiceCommands$InvokeCmd.execute(AdminServiceCommands.java:251)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at com.ibm.ws.console.core.mbean.MBeanHelper.invoke(MBeanHelper.java:246)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at com.ibm.ws.console.appdeployment.ApplicationDeploymentCollectionAction.execute(ApplicationDeploymentCollectionAction.java:628)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at org.apache.struts.action.RequestProcessor.processActionPerform(Unknown Source)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at org.apache.struts.action.RequestProcessor.process(Unknown Source)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at org.apache.struts.action.ActionServlet.process(Unknown Source)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at org.apache.struts.action.ActionServlet.doPost(Unknown Source)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1233)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
[12/10/18 11:30:37:540 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1404)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:196)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at org.apache.struts.action.RequestProcessor.doForward(Unknown Source)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at org.apache.struts.tiles.TilesRequestProcessor.doForward(Unknown Source)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at org.apache.struts.action.RequestProcessor.processForwardConfig(Unknown Source)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(Unknown Source)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at org.apache.struts.action.RequestProcessor.process(Unknown Source)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at org.apache.struts.action.ActionServlet.process(Unknown Source)
[12/10/18 11:30:37:541 IST] 0000009d SystemErr     R    at org.apache.struts.action.ActionServlet.doPost(Unknown Source)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1233)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:782)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:481)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.console.core.servlet.WSCUrlFilter.setUpCommandAssistance(WSCUrlFilter.java:968)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.console.core.servlet.WSCUrlFilter.continueStoringTaskState(WSCUrlFilter.java:515)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.console.core.servlet.WSCUrlFilter.doFilter(WSCUrlFilter.java:336)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
[12/10/18 11:30:37:542 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:949)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:213)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1833)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[12/10/18 11:30:37:543 IST] 0000009d SystemErr     R    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[12/10/18 11:30:37:544 IST] 0000009d SystemErr     R    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[12/10/18 11:30:37:544 IST] 0000009d SystemErr     R    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
[12/10/18 11:30:37:544 IST] 0000009d SystemErr     R    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
[12/10/18 11:30:37:544 IST] 0000009d SystemErr     R    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
[12/10/18 11:30:37:544 IST] 0000009d SystemErr     R    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892)
[12/10/18 11:30:37:544 IST] 0000009d SystemErr     R Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Error creating bean with name &amp;#39&#59;entityManagerFactory&amp;#39&#59; defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed&amp;#59&#59; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory&amp;#59&#59; nested exception is java.lang.UnsupportedOperationException
[12/10/18 11:30:37:544 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:914)
[12/10/18 11:30:37:545 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:789)
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:427)
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    ... 96 more
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Error creating bean with name &#39;entityManagerFactory&#39; defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed&#59; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory&#59; nested exception is java.lang.UnsupportedOperationException
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:186)
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:901)
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    ... 98 more
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.UnsupportedOperationException
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1634)
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
[12/10/18 11:30:37:546 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:156)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:136)
[12/10/18 11:30:37:547 IST] 0000009d SystemErr     R    at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:620)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:410)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:171)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    ... 99 more
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.UnsupportedOperationException
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:396)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1692)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1630)
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R    ... 120 more
[12/10/18 11:30:37:548 IST] 0000009d SystemErr     R Caused by: java.lang.UnsupportedOperationException
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.suspend(WebSphereExtendedJtaPlatform.java:131)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.resource.transaction.backend.jta.internal.DdlTransactionIsolatorJtaImpl.<init>(DdlTransactionIsolatorJtaImpl.java:51)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl.buildDdlTransactionIsolator(JtaTransactionCoordinatorBuilderImpl.java:46)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.tool.schema.internal.HibernateSchemaManagementTool.getDdlTransactionIsolator(HibernateSchemaManagementTool.java:178)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:94)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:312)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:460)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384)
[12/10/18 11:30:37:549 IST] 0000009d SystemErr     R    ... 124 more

注意:我已将类加载策略设置为 PARENT_LAST。

标签: springspring-bootwebsphere

解决方案


Spring Boot 版本1.5.15.RELEASE对 Hibernate 的依赖是<hibernate.version>5.0.12.Final</hibernate.version>.

所以 <hibernate.version>5.2.13.Final</hibernate.version>从你的 pom 中删除并让 Spring boot 下载与之兼容的版本应该可以解决问题。

在此干净安装依赖项并生成战争之后。

并删除mysql连接器(<version>5.1.8</version>)的版本:

<dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>         
</dependency>

推荐阅读