1 Reply Latest reply on Jun 3, 2013 10:35 AM by nfilotto

    Gatein 3.5 with PostgreSQL 9.2 on Mac

    mykept

      My environment:

       

      O.S.: Mac 10.7.5

      Database: - PostgreSQL 9.2

      App: Gatein 3.5 and Jboss AS 7

      JDK: 1.7.0_09

       

      • I change the file $JBOSS_HOME/standalone/configuration/gatein/configuration.properties

       

      #JCR

      gatein.jcr.config.type=local

      gatein.jcr.datasource.name=java:/GateinDS

      gatein.jcr.datasource.dialect=org.hibernate.dialect.PostgreSQLDialect

      #

      # PostgreSQL Configuration

      #

      gatein.jcr.datasource.driver=org.postgresql.Driver

      gatein.jcr.datasource.url=jdbc:postgresql://127.0.0.1:5432/gatein

      gatein.jcr.datasource.username=dbuser

      gatein.jcr.datasource.password=dbpassword

       

       

       

      #IDM

      gatein.idm.datasource.name=java:/GateinDS

      #

      # PostgreSQL Configuration

      #

      gatein.idm.datasource.driver=org.postgresql.Driver

      gatein.idm.datasource.url=jdbc:postgresql://127.0.0.1:5432/gatein

      gatein.idm.datasource.username=dbuser

      gatein.idm.datasource.password=dbpassword

       

      ---------------------------

      • Change the file $JBOSS_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/jcr/jcr-configuration.xml

      <external-component-plugins>

          <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>

           ........  

           <properties-param>

                <name>ref-addresses</name>

                <description>ref-addresses</description>

                <property name="driverClassName" value="org.postgresql.Driver"/>

                <property name="url" value="jdbc:postgresql://127.0.0.1:5432/gatein"/>

                <property name="username" value="dbuser"/>

                <property name="password" value="dbpassword"/>

            </properties-param>

           ......

      </external-component-plugins>

      ----------------------------

      • Change the file $JBOSS_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/jcr/repository-configuration.xml

       

      <repository-service default-repository="${gatein.jcr.repository.default:repository}"> 

           .....

           <workspace name="system">  

           ......

                <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">

                       <properties>

                        ......

                        <property name="jbosscache-cl-cache.jdbc.node.type" value="bytea" />

                        ...... 

                </lock-manager>

           ......

           </workspace>

           .......

           <workspace name="portal-system">

           ......

                <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">

                     <properties>

                     .....

                           <property name="jbosscache-cl-cache.jdbc.node.type" value="bytea" />

                             ...... 

                </lock-manager>

           ......

           </workspace>

           .......

           <workspace name="portal-work">

           .......     

                <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">

                      <properties>

                     .....

                          <property name="jbosscache-cl-cache.jdbc.node.type" value="bytea" />

                             ...... 

                  </lock-manager>

                ......

           </workspace>

      ----------------------------

      • Change the file $JBOSS_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/organitation/idm-configuration.xml

      <external-component-plugins>

          <target-component>org.exoplatform.services.naming.InitialContextInitializer</target-component>

           .......

          

                <properties-param>

                     <name>ref-addresses</name>

                     <description>ref-addresses</description>

                     <property name="driverClassName" value="org.postgresql.Driver"/>

                     <property name="url" value="jdbc:postgresql://127.0.0.1:5432/gatein"/>

                     <property name="username" value="dbuser"/>

                     <property name="password" value="dbpassword"/>

              </properties-param>

       

       

       

       

       

      I also have the file gatein-ds.xml on $JBOSS_HOME/standalone/deployments/gatein-ds.xml

       

      <?xml version="1.0" encoding="UTF-8"?>

      <datasources>

          <no-tx-datasource>

            <jndi-name>java:/GateinDS</jndi-name>

            <connection-url>jdbc:postgresql://127.0.0.1:5432/gatein</connection-url>

            <driver-class>org.postgresql.Driver</driver-class>

            <user-name>dbuser</user-name>

            <password>dbpassword</password>

       

            <min-pool-size>5</min-pool-size>

            <max-pool-size>20</max-pool-size>

            <idle-timeout-minutes>0</idle-timeout-minutes>

            <prepared-statement-cache-size>32</prepared-statement-cache-size>

         </no-tx-datasource>

      <datasources>

       

      And create modules for PostgreSQL on $JBOSS_HOME/modules/com/postgresql/main/module.xml

       

      <module xmlns="urn:jboss:module:1.1" name="com.postgresql">

          <resources>

              <resource-root path="postgresql-9.2-1002.jdbc4.jar"/>

              <!-- Insert resources here -->

          </resources>

          <dependencies>

              <module name="javax.api"/>

              <module name="javax.transaction.api"/>

              <!--<module name="javax.servlet.api" optional="true"/>-->

          </dependencies>

      </module>

       

      when i start give this error

      ---------------------------------------------------

      ERROR

      ---------------------------------------------------

      16:11:07,476 ERROR [exo.kernel.container.RootContainer] (MSC service thread 1-8) Cannot create the portal container 'portal' . ServletContext: org.apache.catalina.core.ApplicationContextFacade@5d553b8d: java.lang.RuntimeException: Cannot instantiate component key=org.exoplatform.portal.config.UserPortalConfigService type=org.exoplatform.portal.config.UserPortalConfigService found at jndi:/default-host/portal/WEB-INF/conf/portal/portal-configuration.xml

                at org.exoplatform.container.jmx.MX4JComponentAdapter.getComponentInstance(MX4JComponentAdapter.java:135) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.management.ManageableComponentAdapter.getComponentInstance(ManageableComponentAdapter.java:68) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.getInstance(ConcurrentPicoContainer.java:468) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.getComponentInstancesOfType(ConcurrentPicoContainer.java:366) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.CachingContainer.getComponentInstancesOfType(CachingContainer.java:111) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.LifecycleVisitor.visitContainer(LifecycleVisitor.java:151) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.accept(ConcurrentPicoContainer.java:615) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_09]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_09]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]

                at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]

                at org.picocontainer.defaults.AbstractPicoVisitor.traverse(AbstractPicoVisitor.java:32)

                at org.exoplatform.container.LifecycleVisitor.traverse(LifecycleVisitor.java:90) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.LifecycleVisitor.start(LifecycleVisitor.java:170) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.start(ConcurrentPicoContainer.java:554) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ExoContainer.start(ExoContainer.java:269) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.PortalContainer.start(PortalContainer.java:656) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ExoContainer.start(ExoContainer.java:257) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.RootContainer.createPortalContainer(RootContainer.java:674) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.RootContainer.createPortalContainers(RootContainer.java:342) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.gatein.integration.jboss.as7.web.StartupService.start(StartupService.java:50)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_09]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_09]

                at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09]

      Caused by: java.lang.RuntimeException: Cannot instantiate component key=org.exoplatform.services.organization.OrganizationService type=org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl found at jndi:/default-host/portal/WEB-INF/conf/organization/idm-configuration.xml

                at org.exoplatform.container.jmx.MX4JComponentAdapter.getComponentInstance(MX4JComponentAdapter.java:135) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.management.ManageableComponentAdapter.getComponentInstance(ManageableComponentAdapter.java:68) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.getInstance(ConcurrentPicoContainer.java:468) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.getComponentInstanceOfType(ConcurrentPicoContainer.java:422) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.CachingContainer.getComponentInstanceOfType(CachingContainer.java:139) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ExoContainer.createComponent(ExoContainer.java:411) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.jmx.MX4JComponentAdapter.getComponentInstance(MX4JComponentAdapter.java:97) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                ... 25 more

      Caused by: java.lang.RuntimeException: Cannot instantiate component key=org.exoplatform.services.organization.idm.PicketLinkIDMService type=org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl found at jndi:/default-host/portal/WEB-INF/conf/organization/idm-configuration.xml

                at org.exoplatform.container.jmx.MX4JComponentAdapter.getComponentInstance(MX4JComponentAdapter.java:135) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.management.ManageableComponentAdapter.getComponentInstance(ManageableComponentAdapter.java:68) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.getInstance(ConcurrentPicoContainer.java:468) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ConcurrentPicoContainer.getComponentInstanceOfType(ConcurrentPicoContainer.java:422) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.CachingContainer.getComponentInstanceOfType(CachingContainer.java:139) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.ExoContainer.createComponent(ExoContainer.java:411) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.jmx.MX4JComponentAdapter.getComponentInstance(MX4JComponentAdapter.java:97) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                ... 31 more

      Caused by: java.lang.reflect.InvocationTargetException

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.7.0_09]

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [rt.jar:1.7.0_09]

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.7.0_09]

                at java.lang.reflect.Constructor.newInstance(Constructor.java:525) [rt.jar:1.7.0_09]

                at org.exoplatform.container.ExoContainer.createComponent(ExoContainer.java:421) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.container.jmx.MX4JComponentAdapter.getComponentInstance(MX4JComponentAdapter.java:97) [exo.kernel.container-2.4.0-GA.jar:2.4.0-GA]

                ... 37 more

      Caused by: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [org.hibernate.dialect.PostgreSQLDialect]

                at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:234) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:91) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                at org.exoplatform.services.organization.idm.CustomHibernateServiceImpl.buildSessionFactory(CustomHibernateServiceImpl.java:85) [exo.portal.component.identity-3.5.0.Final.jar:3.5.0.Final]

                at org.exoplatform.services.organization.idm.CustomHibernateServiceImpl$1.run(CustomHibernateServiceImpl.java:58) [exo.portal.component.identity-3.5.0.Final.jar:3.5.0.Final]

                at org.exoplatform.services.organization.idm.CustomHibernateServiceImpl$1.run(CustomHibernateServiceImpl.java:56) [exo.portal.component.identity-3.5.0.Final.jar:3.5.0.Final]

                at org.exoplatform.commons.utils.SecurityHelper.doPrivilegedAction(SecurityHelper.java:290) [exo.kernel.commons-2.4.0-GA.jar:2.4.0-GA]

                at org.exoplatform.services.organization.idm.CustomHibernateServiceImpl.getSessionFactory(CustomHibernateServiceImpl.java:56) [exo.portal.component.identity-3.5.0.Final.jar:3.5.0.Final]

                at org.exoplatform.services.organization.idm.PicketLinkIDMServiceImpl.<init>(PicketLinkIDMServiceImpl.java:132) [exo.portal.component.identity-3.5.0.Final.jar:3.5.0.Final]

                ... 43 more

      Caused by: javax.naming.NameNotFoundException: org.hibernate.dialect.PostgreSQLDialect -- service jboss.naming.context.java."org.hibernate.dialect.PostgreSQLDialect"

                at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)

                at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)

                at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:113)

                at javax.naming.InitialContext.lookup(InitialContext.java:415) [rt.jar:1.7.0_09]

                at org.gatein.naming.FailoverNamingContext.lookup(FailoverNamingContext.java:42) [gatein-naming-1.1.0.Final.jar:1.1.0.Final]

                at javax.naming.InitialContext.lookup(InitialContext.java:415) [rt.jar:1.7.0_09]

                at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:65) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]

                ... 62 more

       

       

       

      What's wrong?

       

      Anybody can help me

        • 1. Re: Gatein 3.5 with PostgreSQL 9.2 on Mac
          nfilotto

          Hi,

           

          I never tried with PGSQL 9.2 since it is not a supported version as you can see here https://access.redhat.com/site/articles/119833, but anyway I don't think that your issue is related to PGSQL but more because you obviously don't seem to know how to configure a datasource on jboss as 7. You should read articles like this one http://www.mastertheboss.com/jboss-datasource/how-to-configure-a-datasource-with-jboss-7

           

          So for example to test gatein with PGSQL 9.1, here is what I did:

           

           

          <?xml version="1.0" encoding="UTF-8"?>

          <module xmlns="urn:jboss:module:1.0" name="org.postgresql">

            <resources>

              <resource-root path="postgresql-9.1-902.jdbc4.jar"/>

            </resources>

            <dependencies>

            </dependencies>

          </module>

          • Then I configured the datasources into the file standalone/configuration/standalone.xml in the subsystem related to datasources as next:

           

                  <subsystem xmlns="urn:jboss:domain:datasources:1.0">

                      <datasources>

                         <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">

                              <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>

                              <driver>h2</driver>

                              <security>

                                  <user-name>sa</user-name>

                                  <password>sa</password>

                              </security>

                          </datasource>

                          <datasource jndi-name="java:/jdbcidm_portal" pool-name="IDMPortalDS" enabled="true" use-java-context="true">

                              <connection-url>jdbc:postgresql://localhost:5432/gtn5</connection-url>

                              <driver>postgres</driver>

                              <security>

                                  <user-name>postgres</user-name>

                                  <password>eXoAdmin</password>

                              </security>

                          </datasource>

                          <datasource jndi-name="java:/jdbcjcr_portal" pool-name="JCRPortalDS" enabled="true" use-java-context="true">

                              <connection-url>jdbc:postgresql://localhost:5432/gtn5</connection-url>

                              <driver>postgres</driver>

                              <security>

                                  <user-name>postgres</user-name>

                                  <password>eXoAdmin</password>

                              </security>

                          </datasource>

                          <drivers>

                              <driver name="postgres" module="org.postgresql"/>

                              <driver name="h2" module="com.h2database.h2">

                                  <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                              </driver>

                          </drivers>

                      </datasources>

                  </subsystem>

          • The I started my server by launching ./standalone.sh in the bin directory

           

          And that's it,

          I hope it will help,

          BR,

          Nicolas