java - Spring Boot 1.4.1 和 WAS 9 冲突

标签 java spring-boot websphere

我正在尝试使用 Spring Boot 1.4.1.RELEASE 在 WAS 9.0.0.1 上构建一个新应用程序

EAR 依赖项:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</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-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

数据源应该从 jndi 加载,这是我的 application.properties

spring.datasource.jndi-name=jdbc/bcCore
application.code=BCC

当我启动应用程序时,WAS 似乎阻止了持久性上下文和持久性单元的加载,然后抛出一个错误,它找不到它刚刚阻止的类

        [11/4/16 9:45:34:021 EET] 00000195 SystemOut     O 2016-11-04 09:45:34.020  WARN 8920 --- [bContainer : 27] c.i.w.r.component.ApplicationMgrImpl     : WSVR0200I: Starting application: core-ear
[11/4/16 9:45:34:022 EET] 00000195 SystemOut     O 2016-11-04 09:45:34.022  WARN 8920 --- [bContainer : 27] c.i.w.r.component.ApplicationMgrImpl     : WSVR0203I: Application: core-ear  Application build level: 1.0.0.1
[11/4/16 9:45:34:420 EET] 00000195 SystemOut     O 09:45:34.417 [WebContainer : 27] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
[11/4/16 9:45:34:479 EET] 00000195 SystemOut     O 2016-11-04 09:45:34.479  WARN 8920 --- [bContainer : 27] com.ibm.ws.ffdc.impl.FfdcProvider        : FFDC1003I: FFDC Incident emitted on D:\IBM\WebSphere9\AppServer\profiles\AppSrv01\logs\ffdc\server1_2995a52e_16.11.04_09.45.34.4463170190477703144327.txt com.ibm.ws.jpa.management.JPAPUnitInfo.createEMFactory 773
[11/4/16 9:45:34:479 EET] 00000195 SystemOut     O 2016-11-04 09:45:34.479 ERROR 8920 --- [bContainer : 27] com.ibm.ws.jpa.management.JPAPUnitInfo   : CREATE_CONTAINER_ENTITYMANAGER_FACTORY_ERROR_CWWJP0015E
[11/4/16 9:45:41:631 EET] 00000195 SystemOut     O 2016-11-04 09:45:41.631  WARN 8920 --- [bContainer : 27] c.i.w.i.AbstractInjectionEngine          : CWNEN0070W: The javax.persistence.PersistenceContext annotation class will not be recognized because it was loaded from the file:/D:/IBM/WebSphere9/AppServer/profiles/AppSrv01/installedApps/NBCDANISOR1Node03Cell/core-ear.ear/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar location rather than from a product class loader.
[11/4/16 9:45:41:631 EET] 00000195 SystemOut     O 2016-11-04 09:45:41.631  WARN 8920 --- [bContainer : 27] c.i.w.i.AbstractInjectionEngine          : CWNEN0070W: The javax.persistence.PersistenceUnit annotation class will not be recognized because it was loaded from the file:/D:/IBM/WebSphere9/AppServer/profiles/AppSrv01/installedApps/NBCDANISOR1Node03Cell/core-ear.ear/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar location rather than from a product class loader.
[11/4/16 9:45:41:655 EET] 00000195 SystemOut     O 09:45:41.655 [WebContainer : 27] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
[11/4/16 9:45:41:656 EET] 00000195 SystemOut     O 09:45:41.656 [WebContainer : 27] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
[11/4/16 9:45:41:656 EET] 00000195 SystemOut     O 09:45:41.656 [WebContainer : 27] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
[11/4/16 9:45:41:657 EET] 00000195 SystemOut     O 09:45:41.657 [WebContainer : 27] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Found Equinox FileLocator for OSGi bundle URL resolution
[11/4/16 9:45:41:658 EET] 00000195 SystemOut     O 09:45:41.658 [WebContainer : 27] INFO org.springframework.data.jpa.repository.cdi.JpaRepositoryExtension - Activating CDI extension for Spring Data JPA repositories.
[11/4/16 9:45:41:659 EET] 00000195 SystemOut     O 09:45:41.659 [WebContainer : 27] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
[11/4/16 9:45:41:659 EET] 00000195 SystemOut     O 09:45:41.659 [WebContainer : 27] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
[11/4/16 9:45:41:659 EET] 00000195 SystemOut     O 09:45:41.659 [WebContainer : 27] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]
[11/4/16 9:45:41:659 EET] 00000195 SystemOut     O 09:45:41.659 [WebContainer : 27] INFO org.springframework.data.jpa.repository.cdi.JpaRepositoryExtension - Activating CDI extension for Spring Data JPA repositories.
[11/4/16 9:45:41:743 EET] 00000195 SystemOut     O 2016-11-04 09:45:41.743  INFO 8920 --- [bContainer : 27] org.jboss.weld.Event                     : WELD-000411: Observer method [BackedAnnotatedMethod] protected org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport.processAnnotatedType(@Observes ProcessAnnotatedType<X>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
[11/4/16 9:45:41:744 EET] 00000195 SystemOut     O 2016-11-04 09:45:41.744  INFO 8920 --- [bContainer : 27] org.jboss.weld.Event                     : WELD-000411: Observer method [BackedAnnotatedMethod] protected org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport.processAnnotatedType(@Observes ProcessAnnotatedType<X>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
[11/4/16 9:45:41:896 EET] 00000195 SystemOut     O 2016-11-04 09:45:41.896  INFO 8920 --- [bContainer : 27] com.ibm.ws.webcontainer.webapp           : SRVE0169I: Loading Web Module: core-web-1.0.0.war.
[11/4/16 9:45:41:904 EET] 00000195 SystemOut     O 2016-11-04 09:45:41.904  INFO 8920 --- [bContainer : 27] com.ibm.ws.session.WASSessionCore        : SESN0176I: Will create a new session context for application key default_host/core-rest
[11/4/16 9:45:41:920 EET] 00000195 SystemOut     O 2016-11-04 09:45:41.920  INFO 8920 --- [bContainer : 27] com.ibm.ws.webcontainer.webapp           : SRVE0292I: Servlet Message - [core-ear#core-web-1.0.0.war]:.1 Spring WebApplicationInitializers detected on classpath
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O 
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O   .   ____          _            __ _ _
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O   '  |____| .__|_| |_|_| |_\__, | / / / /
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O  =========|_|==============|___/=/_/_/_/
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O  :: Spring Boot ::        (v1.4.1.RELEASE)
[11/4/16 9:45:42:349 EET] 00000195 SystemOut     O 
[11/4/16 9:45:42:374 EET] 00000195 SystemOut     O 2016-11-04 09:45:42.374  INFO 8920 --- [bContainer : 27] ro.test.ServletInitializer            : Starting ServletInitializer on NBCDANISOR1 with PID 8920 (D:\IBM\WebSphere9\AppServer\profiles\AppSrv01\installedApps\NBCDANISOR1Node03Cell\core-ear.ear\core-web-1.0.0.war\WEB-INF\classes started by cosmin.danisor in D:\IBM\WebSphere9\AppServer\profiles\AppSrv01\bin)
[11/4/16 9:45:42:375 EET] 00000195 SystemOut     O 2016-11-04 09:45:42.375  INFO 8920 --- [bContainer : 27] ro.test.ServletInitializer            : No active profile set, falling back to default profiles: default
[11/4/16 9:45:42:394 EET] 00000195 SystemOut     O 2016-11-04 09:45:42.394  INFO 8920 --- [bContainer : 27] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@62e4bebf: startup date [Fri Nov 04 09:45:42 EET 2016]; root of context hierarchy
[11/4/16 9:45:43:614 EET] 00000195 SystemOut     O 2016-11-04 09:45:43.614  INFO 8920 --- [bContainer : 27] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
[11/4/16 9:45:43:696 EET] 00000195 SystemOut     O 2016-11-04 09:45:43.696  INFO 8920 --- [bContainer : 27] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$39abe309] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[11/4/16 9:45:43:734 EET] 00000195 SystemOut     O 2016-11-04 09:45:43.734  INFO 8920 --- [bContainer : 27] com.ibm.ws.webcontainer.webapp           : SRVE0292I: Servlet Message - [core-ear#core-web-1.0.0.war]:.Initializing Spring embedded WebApplicationContext
[11/4/16 9:45:43:734 EET] 00000195 SystemOut     O 2016-11-04 09:45:43.734  INFO 8920 --- [bContainer : 27] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1340 ms
[11/4/16 9:45:43:927 EET] 00000195 SystemOut     O 2016-11-04 09:45:43.926  WARN 8920 --- [bContainer : 27] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to ServerProperties (prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
[11/4/16 9:45:43:939 EET] 00000195 SystemOut     O 2016-11-04 09:45:43.938 ERROR 8920 --- [bContainer : 27] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to ServerProperties (prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    ...
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) [com.ibm.ws.runtime.jar:na]
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) [com.ibm.ws.runtime.jar:na]
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1892) [com.ibm.ws.runtime.jar:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to ServerProperties (prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1148) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1051) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    ...
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:89) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:213) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:168) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    ... 114 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverProperties': Could not bind properties to ServerProperties (prefix=server, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:351) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:302) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1575) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:207) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1128) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1056) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    ... 142 common frames omitted
Caused by: javax.validation.ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.
    at org.hibernate.validator.internal.engine.ValidatorImpl.isReachable(ValidatorImpl.java:1621) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:1597) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:609) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:580) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java:524) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:492) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:457) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:407) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:205) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:93) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.validation.DataBinder.validate(DataBinder.java:852) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.boot.bind.PropertiesConfigurationFactory.validate(PropertiesConfigurationFactory.java:367) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.bind.PropertiesConfigurationFactory.doBindPropertiesToTarget(PropertiesConfigurationFactory.java:287) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.bind.PropertiesConfigurationFactory.bindPropertiesToTarget(PropertiesConfigurationFactory.java:256) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:346) ~[spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
    ... 156 common frames omitted
Caused by: javax.persistence.PersistenceException: java.lang.ClassNotFoundException: com.ibm.websphere.persistence.PersistenceProviderImpl
    at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.loadResolverClasses(PersistenceProviderResolverHolder.java:160) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
    at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.<init>(PersistenceProviderResolverHolder.java:122) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
    at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader.getPersistenceProviders(PersistenceProviderResolverHolder.java:80) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
    at javax.persistence.Persistence.getProviders(Persistence.java:69) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
    at javax.persistence.Persistence.access$000(Persistence.java:23) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
    at javax.persistence.Persistence$1.isLoaded(Persistence.java:109) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
    at org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:46) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:128) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.resolver.CachingTraversableResolverForSingleValidation.isReachable(CachingTraversableResolverForSingleValidation.java:36) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    at org.hibernate.validator.internal.engine.ValidatorImpl.isReachable(ValidatorImpl.java:1612) ~[hibernate-validator-5.2.4.Final.jar:5.2.4.Final]
    ... 170 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.ibm.websphere.persistence.PersistenceProviderImpl
    at java.net.URLClassLoader.findClass(URLClassLoader.java:607) ~[na:1.8.0]
    at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243) ~[bootstrap.jar:WAS90.SERV1 [cf011635.01]]
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:846) ~[na:1.8.0]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:825) ~[na:1.8.0]
    at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134) ~[bootstrap.jar:WAS90.SERV1 [cf011635.01]]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:805) ~[na:1.8.0]
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62) ~[com.ibm.ws.runtime.jar:WAS90.SERV1 [cf011635.01]]
    at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58) ~[com.ibm.ws.runtime.jar:WAS90.SERV1 [cf011635.01]]
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:619) ~[com.ibm.ws.runtime.jar:WAS90.SERV1 [cf011635.01]]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:805) ~[na:1.8.0]
    at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:619) ~[com.ibm.ws.runtime.jar:WAS90.SERV1 [cf011635.01]]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:805) ~[na:1.8.0]
    at javax.persistence.spi.PersistenceProviderResolverHolder$PersistenceProviderResolverPerClassLoader$CachingPersistenceProviderResolver.loadResolverClasses(PersistenceProviderResolverHolder.java:142) ~[hibernate-jpa-2.1-api-1.0.0.Final.jar:1.0.0.Final]
    ... 179 common frames omitted

我敢肯定没有多少人尝试过将这两者混合在一起,但它应该会起作用。

[INFO] ro.test:core-ear:ear:1.0.0
[INFO] +- ro.test:core-web:war:1.0.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.1.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.7:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.7:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile
[INFO] |  |  +- org.springframework:spring-core:jar:4.3.3.RELEASE:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
[INFO] |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  \- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.3:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.3:compile
[INFO] |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.3:compile
[INFO] |  +- org.springframework:spring-web:jar:4.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-beans:jar:4.3.3.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-context:jar:4.3.3.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:4.3.3.RELEASE:compile
[INFO] |     \- org.springframework:spring-expression:jar:4.3.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.4.1.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.1.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-jdbc:jar:8.5.5:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-juli:jar:8.5.5:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:4.3.3.RELEASE:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.0.11.Final:compile
[INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  |  \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:5.0.11.Final:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.10.3.RELEASE:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.12.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-orm:jar:4.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-tx:jar:4.3.3.RELEASE:compile
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile
[INFO] |  \- org.springframework:spring-aspects:jar:4.3.3.RELEASE:compile
[INFO] +- net.sf.saxon:Saxon-HE:jar:9.7.0-10:compile
[INFO] \- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.1.RELEASE:provided
[INFO]    +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.5:provided
[INFO]    +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.5:provided
[INFO]    \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.5:provided

最佳答案

我终于设法让它工作了。谢谢你 dunni 的帮助,你让我走上了正确的道路。

<dependency>
    <groupId>ro.bpmwave</groupId>
    <artifactId>core-web</artifactId>
    <type>war</type>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
    <exclusions>
        <exclusion>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>javax.transaction</groupId>
            <artifactId>javax.transaction-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>

我已经将这些设置添加到 WebMvc 配置类

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter{

    @Autowired
    private javax.sql.DataSource dataSource;

    @Bean
    public SessionInterceptor sessionInterceptor() {
        SessionInterceptor sessionInterceptor = new SessionInterceptor();
        return sessionInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(sessionInterceptor());
    }

    @Bean
    LocalSessionFactoryBean sessionFactory() throws IOException {
        LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
        factoryBean.setHibernateProperties(getHibernateProperties());
        factoryBean.setDataSource(dataSource);
        factoryBean.setPackagesToScan("ro.test");
        return factoryBean;
    }

    private Properties getHibernateProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect", DB2Dialect.class.getName());
        properties.put("hibernate.show_sql", "false");
        properties.put("hibernate.transaction.coordinator_class", "jta");
        properties.put("hibernate.transaction.factory_class", "org.hibernate.transaction.CMTTransactionFactory");
        return properties;
    }
}

现在它就像一个魅力:)

关于java - Spring Boot 1.4.1 和 WAS 9 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40417723/

相关文章:

java - 将 JTextArea 文本写入字符串

java - 无法从 War 文件外部找到 application.properties 文件

Spring-boot Web服务端点类不工作

java - mod_deflate 与 IBM WebSphere 和 IBM IHS

jakarta-ee - 使用共享库与完全封装的 EAR 的优缺点

java - 错误: java. lang.NoClassDefFoundError : com. fastxml.jackson.databind.Module

java - 我从哪里获得在 jdk 1.6 中编译的 OkHttpClient 版本?我在 WAS 7 上运行时遇到 UnsupportedClassVersionError

java - SQLite 删除级联不工作 : FOREIGN KEY constraint failed

java - Spring Boot应用程序启动时没有正确的应用程序名称

java - 如何获取每天随着天数递增的输出