[Apiman-user] Strange exception trying to initialize apiman database with Postgres

Eric Wittmann eric.wittmann at redhat.com
Thu Dec 10 07:40:55 EST 2015


OK no worries.  I should probably add this to an FAQ somewhere.  Happens 
more than you'd think.

On 12/9/2015 6:07 PM, Paul Blair wrote:
> OK, I see what's happening. I changed the dialect in the apiman.properties
> file that was supposed to be
> copied into the Docker container, but it wasn't actually being copied in,
> so the old H2 version was still there.
>
> Thanks for the tip; this really helped.
>
> On 12/9/15, 9:20 AM, "Eric Wittmann" <eric.wittmann at redhat.com> wrote:
>
>> OK - so I did some testing with not quite the same version of postgres.
>>   I think perhaps you didn't change the hibernate dialect?
>>
>> In the apiman.properties file (or in your case in the
>> standalone-apiman.xml file) you need to set the dialect via this property:
>>
>> apiman.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
>>
>> I tried using postgres without changing the dialect and I got the same
>> errors you did.  So I'm hoping that's the issue. :)
>>
>> -Eric
>>
>> On 12/8/2015 9:09 PM, Paul Blair wrote:
>>> I was able to work around this problem with the auditlog data column and
>>> a few other columns using the ALTER TABLE statements below to convert to
>>> a VARCHAR of shorter length than the error message demanded. However,
>>> I'm now stymied by a subsequent error: "Wrong column type in
>>> public.service_defs for column data. Found: oid, expected: blob" -- I
>>> tried converting the type to bytea but this doesn't satisfy Hibernate.
>>>
>>> I feel like I've got the wrong version of a script here, but I was
>>> careful to get the PostgreSQL script for apiman 1.1.9.Final.
>>>
>>> ALTER TABLE auditlog
>>> ALTER COLUMN data TYPE varchar(10485760);
>>>
>>> ALTER TABLE gateways
>>> ALTER COLUMN configuration TYPE varchar(10485760);
>>>
>>> ALTER TABLE policies
>>> ALTER COLUMN configuration TYPE varchar(10485760);
>>>
>>>
>>>
>>> From: "pblair at clearme.com <mailto:pblair at clearme.com>"
>>> <pblair at clearme.com <mailto:pblair at clearme.com>>
>>> Date: Wed, 9 Dec 2015 01:53:05 +0000
>>> To: "apiman-user at lists.jboss.org <mailto:apiman-user at lists.jboss.org>"
>>> <apiman-user at lists.jboss.org <mailto:apiman-user at lists.jboss.org>>
>>> Subject: [Apiman-user] Strange exception trying to initialize apiman
>>> database with Postgres
>>>
>>> I'm getting a weird data type exception when issuing a request to the
>>> API manager running against a Postgres instance:
>>>
>>> I'm using apiman 1.1.9 with the DDL for Postgres found here:
>>>
>>> https://raw.githubusercontent.com/apiman/apiman/apiman-1.1.9.Final/distro
>>> /wildfly8/src/main/resources/overlay/apiman/ddls/apiman_postgresql9.ddl
>>>
>>> The DDL does make that into a text column; I'm not sure why Hibernate
>>> doesn't like it and instead wants a VARCHAR that is too big for
>>> Postgres. This is on PostgreSQL 9.4.4; my driver configuration in the
>>> standalone-apiman.xml uses postgresql-9.3-1102-jdbc41.jar and doesn't
>>> have any particular validation configuration.
>>>
>>> Relevant stack:
>>>
>>> UT005023: Exception handling request to /apiman/currentuser/info:
>>> org.jboss.resteasy.spi.UnhandledException:
>>> org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke
>>> public void
>>> io.apiman.manager.api.jpa.EntityManagerFactoryAccessor.postConstruct()
>>> on io.apiman.manager.api.jpa.EntityManagerFactoryAccessor at 325203f1
>>> Š
>>> Caused by: javax.persistence.PersistenceException: Unable to build
>>> entity manager factory
>>> Š
>>> Caused by: org.hibernate.HibernateException: Wrong column type in
>>> public.auditlog for column data. Found: text, expected
>>> : varchar(2147483647)
>>>           at org.hibernate.mapping.Table.validateColumns(Table.java:372)
>>> [hibernate-core-4.3.7.Final.jar:4.3.7.Final]
>>>           at
>>> org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1338)
>>> [hibernate-core-4.3.7.Final.jar:4.3.7
>>> .Final]
>>> Š
>>>
>>>
>>> _______________________________________________ Apiman-user mailing list
>>> Apiman-user at lists.jboss.org <mailto:Apiman-user at lists.jboss.org>
>>> https://lists.jboss.org/mailman/listinfo/apiman-user
>>>
>>>
>>> _______________________________________________
>>> Apiman-user mailing list
>>> Apiman-user at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/apiman-user
>>>
>


More information about the Apiman-user mailing list