我正在从WAS 8迁移到WAS 9。 我的应用程序使用Hibernate 4.3.0.Beta3版本和spring 4.0.3。 在应用程序启动时,出现此错误:
An error occurred in the org.hibernate.jpa.HibernatePersistenceProvider persistence
provider when it attempted to create the container entity manager factory for
the AccidentCompensation persistence unit. The following error occurred:
java.lang.IllegalStateException: java.lang.UnsupportedOperationException:
No current bean manager found in CDI service
at com.ibm.ws.jpa.cdi.impl.BeanManagerInvocationHandler.invoke(BeanManagerInvocationHandler.java:80)
请让我知道是否需要更多信息。
答案 0 :(得分:1)
我解决了我的问题,编写了一个自定义会话构建器并从工厂实例中禁用beanreference。
package br.com.temasistemas.utils.hibernate;
import org.hibernate.boot.SessionFactoryBuilder;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.boot.spi.SessionFactoryBuilderFactory;
import org.hibernate.boot.spi.SessionFactoryBuilderImplementor;
public class CustomSessionFactoryBuilderFactory implements SessionFactoryBuilderFactory {
@Override
public SessionFactoryBuilder getSessionFactoryBuilder(final MetadataImplementor metadata,
final SessionFactoryBuilderImplementor defaultBuilder) {
return defaultBuilder.applyBeanManager(null);
}
}
create a service file in
META-INF/services/org.hibernate.boot.spi.SessionFactoryBuilderFactory
content
br.com.temasistemas.utils.hibernate.CustomSessionFactoryBuilderFactory