3 Replies Latest reply on Sep 23, 2007 12:35 PM by mgrouch

    How to configure 2 Session Factories?

    mgrouch Expert

      How to configure 2 Session Factories?

      I've tried:

       <core:hibernate-session-factory name="hibernateSessionFactory" />
       <core:managed-hibernate-session name="settlementsDatabase" auto-create="true"
       session-factory-jndi-name="java:/settlementsHibernateSessionFactory" />
       <core:managed-hibernate-session name="settlementsHistDatabase" auto-create="true"
       session-factory-jndi-name="java:/settlementsHistHibernateSessionFactory" />


      Fist one is configured fine. Second one is not initialized at all.

      Thanks


        • 1. Re: How to configure 2 Session Factories?
          mgrouch Expert

          OK

          I've figured out configuration

          <core:hibernate-session-factory name="hibernateSessionFactory" cfg-resource-name="hibernate.cfg.xml" />
           <core:hibernate-session-factory name="hibernateHistSessionFactory" cfg-resource-name="hist-hibernate.cfg.xml" />
           <core:managed-hibernate-session name="settlementsDatabase" auto-create="true"
           session-factory-jndi-name="java:/settlementsHibernateSessionFactory" />
           <core:managed-hibernate-session name="settlementsHistDatabase" auto-create="true"
           session-factory-jndi-name="java:/settlementsHistHibernateSessionFactory" />


          But I'm getting error at start up


          [java] 12:50:12,491 ERROR [[/LPP/settlements]] Exception sending context initialized event to listener instance of class org.jboss.seam.
          servlet.SeamListener
           [java] org.hibernate.MappingException: component class not found: com.company.data.entity.FailId
           [java] at org.hibernate.mapping.Component.getComponentClass(Component.java:104)
           [java] at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:130)
           [java] at org.hibernate.tuple.component.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:43)
           [java] at org.hibernate.tuple.component.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:38)
           [java] at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.<init>(ComponentEntityModeToTuplizerMapping.java:52)
           [java] at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:50)
           [java] at org.hibernate.mapping.Component.buildType(Component.java:152)
           [java] at org.hibernate.mapping.Component.getType(Component.java:145)
           [java] at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
           [java] at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
           [java] at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
           [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
           [java] at org.jboss.seam.microcontainer.HibernateFactory.createSessionFactory(HibernateFactory.java:121)
           [java] at org.jboss.seam.core.HibernateSessionFactory.startup(HibernateSessionFactory.java:35)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
           [java] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
           [java] at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
           [java] at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
           [java] at org.jboss.seam.Component.newInstance(Component.java:1746)
           [java] at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
           [java] at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
           [java] at org.jboss.seam.init.Initialization.init(Initialization.java:504)
           [java] at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
           [java] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
           [java] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
           [java] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
           [java] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
           [java] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
           [java] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5310)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
           [java] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
           [java] at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
           [java] at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
           [java] at org.jboss.web.WebModule.startModule(WebModule.java:83)
           [java] at org.jboss.web.WebModule.startService(WebModule.java:61)
           [java] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
           [java] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
           [java] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
           [java] at $Proxy0.start(Unknown Source)
           [java] at org.jboss.system.ServiceController.start(ServiceController.java:417)
           [java] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           [java] at $Proxy54.start(Unknown Source)
           [java] at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           [java] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           [java] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           [java] at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
           [java] at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
           [java] at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:93)
           [java] at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
           [java] at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           [java] at $Proxy55.start(Unknown Source)
           [java] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
           [java] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
           [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
           [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
           [java] at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           [java] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           [java] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           [java] at $Proxy9.deploy(Unknown Source)
           [java] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
           [java] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
           [java] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
           [java] at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
           [java] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
           [java] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
           [java] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
           [java] at $Proxy0.start(Unknown Source)
           [java] at org.jboss.system.ServiceController.start(ServiceController.java:417)
           [java] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
           [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           [java] at $Proxy4.start(Unknown Source)
           [java] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
           [java] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
           [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
           [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
           [java] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [java] at java.lang.reflect.Method.invoke(Method.java:585)
           [java] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
           [java] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
           [java] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           [java] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
           [java] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
           [java] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
           [java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
           [java] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
           [java] at $Proxy5.deploy(Unknown Source)
           [java] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
           [java] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
           [java] at org.jboss.Main.boot(Main.java:200)
           [java] at org.jboss.Main$1.run(Main.java:508)
           [java] at java.lang.Thread.run(Thread.java:595)
           [java] Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: com.company.data.entity.FailId
           [java] at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
           [java] at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:514)
           [java] at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
           [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
           [java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
           [java] at java.lang.Class.forName0(Native Method)
           [java] at java.lang.Class.forName(Class.java:164)
           [java] at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
           [java] at org.hibernate.mapping.Component.getComponentClass(Component.java:101)
           [java] ... 162 more


          • 2. Re: How to configure 2 Session Factories?
            Alex Ka Novice

            How do you use the two factories after you configure them?

            • 3. Re: How to configure 2 Session Factories?
              mgrouch Expert

              Never mind. Problem is fixed.