Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated 4.3.x database to 4.4.0 - GetDataAvailability throws error #557

Closed
ghost opened this issue Jul 20, 2017 · 5 comments
Closed

Migrated 4.3.x database to 4.4.0 - GetDataAvailability throws error #557

ghost opened this issue Jul 20, 2017 · 5 comments

Comments

@ghost
Copy link

ghost commented Jul 20, 2017

Hi,

I installed the recently released 4.4.0 SOS Bundle, and during install I used an existing 4.3.8 database. I asked it to upgrade and it seemed to work, there were no errors that I saw. The installation finished as normal after settings, credentials registration.

On the client provided, I tried a GetDataAvailability request example (both versions that are available) with no filtering criteria. For both I received the following reply:

<ows:Exception exceptionCode="NoApplicableCode"> <ows:ExceptionText>Error while querying data for GetDataAvailability! [EXCEPTION]: Object [id=4] was not of the specified subclass [org.n52.sos.ds.hibernate.entities.feature.AbstractFeatureOfInterest] : Discriminator: T</ows:ExceptionText>

Looking in the log file I get the same error there:

2017-07-20 08:05:57,660 INFO [http-nio-8080-exec-6] [DefaultLoadEventListener.java:159] HHH000327: Error performing load command : org.hibernate.WrongClassException: Object [id=4] was not of the specified subclass [org.n52.sos.ds.hibernate.entities.feature.AbstractFeatureOfInterest] : Discriminator: T

The database works OK when used with the 3.8.15 release, both using the bundled client and REST API. I saw the #554 issue and wondered if it is related to that?

David

@CarstenHollmann
Copy link

Hi David,

in the featureofinterest table an existing column was modified which is not considered by the update functionality. These changes have to be made manually with a SQL script.

Execute the following SQL scripts:

ALTER TABLE featureofinterest ALTER hibernatediscriminator TYPE character varying(255);
ALTER TABLE featureofinterest ALTER hibernatediscriminator DROP NOT NULL;
UPDATE featureofinterest SET hibernatediscriminator = null;

Best,
Carsten

@ghost
Copy link
Author

ghost commented Jul 20, 2017

Thanks Carsten,

I added those lines to my deployment script, and GetDataAvailability now works with both (SOS2.0,POX) versions in the client's examples.

It raised another issue when I tried to add a sensor using the client's example [POX] InsertSensor - with SensorML 2.0 description (SOS 2.0.0). The exception is below and logger code in this gist:

<ows:Exception exceptionCode="NoApplicableCode"> <ows:ExceptionText>Error while inserting sensor data into database! [EXCEPTION]: could not execute batch</ows:ExceptionText> </ows:Exception>

I updated the database with the following and it then inserted OK, and observations were inserted against it OK too. I guess the question is, is it OK to set that to null - I assume so.

ALTER TABLE observableproperty ALTER hibernatediscriminator DROP NOT NULL;

It raises another issue now, but I don't know if I should open a new ticket here, or in your API project.

The API, when using only the imported/modified 4.3.8 database, shows nothing under quantities, e.g. features, procedures, when I use: services?expanded=true, it is like the SOS is empty. The cache and GetDataAvailability however correctly show all the existing data.

After adding the SOS client's example sensor, and some observations under it, the API now shows that example sensor's details in the expanded services.

@CarstenHollmann
Copy link

Hi David,

the REST-API requires a new column in the series table which is created during the update process but not filled with data.

Please run this SQL script to insert the required information into the column.

Then the REAT-API should show data.

Best,
Carsten

@CarstenHollmann
Copy link

I forgot the say a word to the SQL statement you mentiond.
This column is not needed anymore and can be deleted:
ALTER TABLE public.observableproperty DROP COLUMN hibernatediscriminator;

Best,
Carsten

@ghost
Copy link
Author

ghost commented Jul 21, 2017

Hi Carsten - that's it working perfectly now with the client and the API, thanks for the help. :-)

@ghost ghost closed this as completed Jul 21, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant