4 Replies Latest reply on Jul 22, 2009 4:21 PM by pilhuhn

    Failing to install against postgresql 8.4

    andyredhead

      Hi,

      I'm trying to "evaluate" jopr but I'm having trouble doing the install...

      I'm working on my xp laptop (without admin permissions) with java 1.5.

      I am familiar with postgresql and with jboss.

      I have a working instance of postgresql 8.4 (installed from the zip distribution rather than the msi file, see earlier comment about not having admin permissions).

      I start the jopr server using the console option and when I point a browser at the server I get the page prompting me to complete the installation.

      When I click the "test database connection" button I get an error:

      java.lang.Exception: Unsupported PostgreSQL [postgresql8(postgresql:8)]

      (in the javascript pop-up box)

      In the server console there is a stack trace:

      
      09:57:05,121 WARN [ConfigurationBean] Installer failed to test connection
      java.lang.Exception: Unsupported PostgreSQL [postgresql8(postgresql:8)]
       at org.rhq.enterprise.installer.ServerInformation.ensureDatabaseIsSupported(ServerInformation.java:136)
       at org.rhq.enterprise.installer.ConfigurationBean.testConnection(ConfigurationBean.java:329)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.el.parser.AstValue.invoke(AstValue.java:131)
       at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
       at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
       at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
       at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
       at javax.faces.component.UICommand.broadcast(UICommand.java:387)
       at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
       at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.rhq.helpers.rtfilter.filter.RtFilter.doFilter(RtFilter.java:124)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:595)





      Any idea what is going on?

      How does jopr determine what version of the database it is communicating with?

      Thanks,

      Andy


        • 1. Re: Failing to install against postgresql 8.4
          andyredhead

          I've had a poke about in the code and I think I know whats going on...

          Despite the fact that the pre-requisits section of the install guide at:

          http://www.jopr.org/confluence/display/JOPR2/Prerequisites

          says that postgresql 8.2.4 or higher is required, the db compatibility code only checks for 8.3 and 8.2.

          I'm looking at the class:

          org.rhq.core.db.DatabaseTypeFactory

          in the block:

          if (db_name.indexOf("postgresql") != -1) {
           if (db_version.startsWith("7.")) {
           database_type_class = Postgresql7DatabaseType.class;
           } else if (db_version.startsWith("8.3")) {
           database_type_class = Postgresql83DatabaseType.class;
           } else if (db_version.startsWith("8.2")) {
           database_type_class = Postgresql82DatabaseType.class;
           } else if (db_version.startsWith("8.1")) {
           database_type_class = Postgresql81DatabaseType.class;
           } else if (db_version.startsWith("8.")) {
           database_type_class = Postgresql8DatabaseType.class;
           }
           }


          So I guess postgresql 8.4 isn't supported :(

          I'll have a go against 8.3...

          Cheers, Andy

          • 2. Re: Failing to install against postgresql 8.4
            pilhuhn

            Hello,

            the code section says

            | } else if (db_version.startsWith("8.")) {
            | database_type_class = Postgresql8DatabaseType.class;

            Which should yield true for 8.4.

            But I need to check/verify myself.
            The biggest difference is that in 8.3 we introduce async commit for metrics data, which is not enabled in the PG8DatabaseType

            But: the installer checks for 8.2+ being present, which seems not true for the PG8 type.

            I've opened a JIRA:
            http://jira.rhq-project.org/browse/RHQ-2255

            Heiko

            • 3. Re: Failing to install against postgresql 8.4
              andyredhead

              Hi,

              thanks for your reply :)

              The way I read the code, in

              ServerInformation.ensureDatabaseIsSupported

              there is a block with:

              if (DatabaseTypeFactory.isPostgres(db)) {
               if (version.startsWith("7") || version.equals("8") || version.startsWith("8.0")
               || version.startsWith("8.1")) {
               throw new Exception("Unsupported PostgreSQL [" + db + "]");
               }
               }



              Looking in the database type factory there is:

              if (db_version.startsWith("7.")) {
               database_type_class = Postgresql7DatabaseType.class;
               } else if (db_version.startsWith("8.3")) {
               database_type_class = Postgresql83DatabaseType.class;
               } else if (db_version.startsWith("8.2")) {
               database_type_class = Postgresql82DatabaseType.class;
               } else if (db_version.startsWith("8.1")) {
               database_type_class = Postgresql81DatabaseType.class;
               } else if (db_version.startsWith("8.")) {
               database_type_class = Postgresql8DatabaseType.class;


              I read the above as saying if the jdbc driver reports 8.4 then the database_type_class will be Postgresql8DatabaseType...

              Then in Postgresql8DatabaseType, the code is:

              public class Postgresql8DatabaseType extends Postgresql7DatabaseType {
               /**
               * @see DatabaseType#getName()
               */
               public String getName() {
               return PostgresqlDatabaseType.VENDOR_NAME + "8";
               }
              
               /**
               * @see DatabaseType#getVersion()
               */
               public String getVersion() {
               return "8";
               }
              }



              As it returns just "8" the 2nd if block in ensureDatabaseIsSupported snippet above will match and the not supported exception will be thrown... ?

              Cheers,

              Andy

              • 4. Re: Failing to install against postgresql 8.4
                pilhuhn

                RHQ rev 4560 - meaning it will be in the next Jopr version.