我正在尝试使用Spring Boot 1.4.1在WAS 9.0.0.1上构建一个新的应用程序.RELEASE
EAR依赖项:
#include <stdio.h>
#include <stdlib.h>
int getdata(FILE *data, int *empid, int *dept, float *paygr, int *exe, int *hours);
void calcdata(float paygr, int exe, int hours, float *pay, float *overpay, float *tpay);
void printdata(int empid, int dept, float paygr, int exe, int hours, float pay, float overpay, float tpay);
int main(void) {
FILE *data;
int empid;
int dept;
float paygr;
char exe;
int hours;
float pay;
float overpay;
float tpay;
data = fopen("emp_data.txt", "r");
if (data == NULL) {
printf("Could not open input file\a\n");
exit(101);
}
while (getdata(data, &empid, &dept, &paygr, &exe, &hours)) {
calcdata(paygr, exe, hours, &pay, &overpay, &tpay);
printdata(empid, dept, paygr, exe, hours, pay, overpay, tpay);
}
fclose(data);
return 0;
}
int getdata(FILE *data, int* empid, int* dept, float *paygr, char *exe, int *hours) {
int ioResult;
ioResult = fscanf(data, "%d%d%f %c%d", &empid, &dept, &paygr, &exe, &hours);
if (ioResult == EOF) {
return 0;
} else
if (ioResult != 5) {
printf("\aError reading data\n");
return 0;
} else {
return 1;
}
}
void calcdata(float paygr, char exe, int hours, float *pay, float *overpay, float *tpay) {
int overhrs;
if (exe == 'N' || hours > 40) {
overhrs = hours - 40;
*tpay = (paygr * (hours - overhrs)) + (overhrs * (paygr * 1.5));
*pay = (hours - overhrs) * paygr;
*overpay = (overhrs * (paygr * 1.5));
} else {
*tpay = hours * paygr;
*pay = hours * paygr;
*overpay = 0.0;
}
}
void printdata(int empid, int dept, float paygr, char exe, int hours,
float pay, float overpay, float tpay) {
printf("%d %d %2f %c %d %2f %2f %2f\n",
empid, dept, paygr, exe, hours, pay, overpay, tpay);
}
数据源应该从jndi加载,这是我的application.properties
<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>
当我启动应用程序时,WAS似乎阻止了持久性上下文和持久性单元被加载,然后抛出一个错误,它无法找到它刚刚阻止的类
spring.datasource.jndi-name=jdbc/bcCore
application.code=BCC
我确信很多人都没有尝试过将这两者混合在一起,但它应该有效。
[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
答案 0 :(得分:1)
我终于设法让它发挥作用。谢谢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;
}
}
它现在就像一个魅力:)