Page 1 of 1

rg.postgresql.util.PSQLException: ERROR: relation "informati

Posted: Tue Oct 11, 2011 4:08 pm
by rhab
Hello... I am trying to get the BL Starter Project (viewtopic.php?f=7&t=400) running locally against Postgres. I have been able to get the M2 demo app running against it, but I cannot get the latest BL Starter Project with M4 to use the Postgres Dialect. I have replaced every mention of HSQL I could find in the application context xml files, but BL still seems to want to use the wrong dialect. What has changed in M4 that I may be missing or don't see?? I have even added the lastest Postgres Drive to my pom, but I still get errors.

Thanks for any help you may be able to give me.

~Ron


// Console Output

[ INFO] 14:03:57 InjectedDataSourceConnectionProvider - Using provided datasource
[ INFO] 14:03:57 SettingsFactory - Database ->
name : PostgreSQL
version : 8.3.8
major : 8
minor : 3
[ INFO] 14:03:57 SettingsFactory - Driver ->
name : PostgreSQL Native Driver
version : PostgreSQL 8.2 JDBC3 with SSL (build 505)
major : 8
minor : 2
[ INFO] 14:03:57 Dialect - Using dialect: org.hibernate.dialect.HSQLDialect
[ INFO] 14:03:57 JdbcSupportLoader - Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4


// My webDS

<bean id="webDS" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://127.0.0.1/phoenix_ecom" />
<property name="username" value="pw" />
<property name="password" value="pw" />
</bean>

// persistence-admin.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/ ... ce_2_0.xsd"
version="2.0">

<persistence-unit name="blPU" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>jdbc/web</non-jta-data-source>
<exclude-unlisted-classes/>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>

<persistence-unit name="blSecurePU" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>jdbc/webSecure</non-jta-data-source>
<exclude-unlisted-classes/>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
</persistence>

Re: rg.postgresql.util.PSQLException: ERROR: relation "informati

Posted: Tue Oct 11, 2011 4:32 pm
by jefffischer
From your description, I'm not sure If you're loading both the admin and the regular site, or just the admin. Nonetheless, there is another persistence xml (persistence-mycompany.xml) that would need the dialect change.

There's nothing about this milestone build that would have broken this functionality (it's working for us and others). If you're using the ant tasks to start up as described in the forum post, then you can check the actual persistence xml file contents in ../WEB-INF/classes/META-INF in the target directories of site and site-admin that are being used by the container on startup to make sure your desired dialect is making it all the way.

Re: rg.postgresql.util.PSQLException: ERROR: relation "informati

Posted: Tue Oct 11, 2011 4:51 pm
by rhab
Currently I am only trying to load the admin, but that file has also been updated to use the Postgres Dialect. I am not running the app from the build scripts. I am doing 'mvn clean install' and then trying to deploy the admin.war in Tomcat. Does the order of the context files matter in the web.xml?

// My persistence-mycompany.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/ ... ce_2_0.xsd"
version="2.0">

<persistence-unit name="blPU" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>jdbc/web</non-jta-data-source>
<exclude-unlisted-classes/>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>

<persistence-unit name="blSecurePU" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>jdbc/webSecure</non-jta-data-source>
<exclude-unlisted-classes/>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
</persistence>

Re: rg.postgresql.util.PSQLException: ERROR: relation "informati

Posted: Tue Oct 11, 2011 4:56 pm
by jefffischer
yes, the order of context files in web.xml does matter. Last one wins. You need to make sure the app context files that reference your persistence xml files with the changed dialect are mentioned last.

Re: rg.postgresql.util.PSQLException: ERROR: relation "informati

Posted: Tue Oct 11, 2011 5:01 pm
by rhab
Okay... The one that shipped in the ZIP looks like this...

<context-param>
<param-name>patchConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext-admin.xml
/WEB-INF/applicationContext-security.xml
classpath:/mycompany-applicationContext.xml
classpath:/bl-open-admin-applicationContext.xml
classpath:/bl-admin-applicationContext.xml
</param-value>
</context-param>

<servlet>
<servlet-name>admin</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/applicationContext-servlet-admin.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

I've changed mine to this thinking that might be the issue but still no love. =(

<context-param>
<param-name>patchConfigLocation</param-name>
<param-value>
classpath:/bl-open-admin-applicationContext.xml
classpath:/bl-admin-applicationContext.xml
classpath:/mycompany-applicationContext.xml
/WEB-INF/applicationContext-security.xml
/WEB-INF/applicationContext-admin.xml
</param-value>
</context-param>

Re: rg.postgresql.util.PSQLException: ERROR: relation "informati

Posted: Tue Oct 11, 2011 5:43 pm
by rhab
PROBLEM SOLVED....

It seems to be a class path conflict. In the ZIP files' "site-admin" project you are loading "persistence-admin.xml". This XML file also exists in the M4 open-admin-module sources. The way it is configured is loading that XML file off the classpath instead of the one in the site-admin's META-INF. Changing the name of the file in the site-admin project solves my issue.

Thanks for the help... I am not sure if this is a bug or not though?