0

I am migrating from WAS 8 to WAS 9. my application uses Hibernate 4.3.0.Beta3 version and spring 4.0.3. At the time of application start up I am getting this error:

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)

Please let me know if need more information.

MWiesner
  • 8,868
  • 11
  • 36
  • 70
praful
  • 1
  • 2

1 Answers1

1

I solve my problem write a custom session builder and disable beanreference from factory instance.

    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
  • Thanks for your reply. But how to disable beanreference from factory instance. And i am using persistence.xml file for configuration. – praful Dec 11 '18 at 03:32