LSIR / gsn

Global Sensor Networks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GSN configuration error

AndreaLCN opened this issue · comments

Hi all,

I'm trying to build GSN project but something get wrong.
I do not Know if I'm making some mistake building it. The procedure that produce the errors is:

I use SBT. First step a build it with sbt command. (obviously in the correct directory - gsn directory).
Second step, I type project webui and then StartDjango.
Third step I typeproject core and then re-start. Here the first error. Attached file: project_core_error.
project_core_error

Forth step. I type project servicer and then run. Here an other error. attached files --> project_services_error_1, project_services_error_2, project_services_error_3.
project_services_error_1
project_services_error_2
project_services_error_3.

Last step i try localhost:9000, and here a configuration error, maybe due to the others error. Attached file: configuration_error.
configuration_error

I would like to know if these errors are due to a wrong procedure that i'm doing to build the project or to something else.
Can somebody help me to fix them?

thanks,
Andrea.

Hi Andrea,

The first error, which could be actually a warning, is just because some configuration files are missing in the gsn-core project, and it is using the default parameters, which are just fine.

The second error is because of this configuration line: https://github.com/LSIR/gsn/blob/master/gsn-services/conf/application.conf#L15 . It is meant for when the application is packaged and installed, but for running it from the sources, you will have to change it to point to the gsn-core folder.

I'll keep this issue open to remind me to change that next time I have some time to update it. :)

Hi Julien,

I did what you suggested but it doesn't work! I mean, I hope that I have correctly understood what you mean. So I change in tha applicantion.conf file the line:
gsn.location="/usr/share/gsn-core/" with --> gsn.location="/home/ubuntu/Desktop/gsn-master/gsn-core/"
Is it correct?

oh, my bad. The "conf" folder is at the root in the repository. the path should be then: gsn.location="/home/ubuntu/Desktop/gsn-master/"

Well, you was right. Tha correct path was the last you wrote, but now an other problem occurs. I'm so sorry.
unexpected_exception
Have you ever seen an error like that? How can I fix it? I saw that an error like that was just post in an other issues tab but without any answer. I'd really appreciate if you can still help me.

This looks like an error of the gsn-services. The default database is an H2 file in /tmp/GsnAuthDb. It should be initialized and all tables created with the evolution scripts. Maybe deleting this file and restarting the services could work ?

Yes, it looks like an error due to that file, but if I delete it the problem is not fixed!
Have a look! it's a kind of problem due to play and to this database. And there is still this internal server error.
play_error
application_error
database_default_error

I remember I already had this issue. The evolution scripts in gsn-services/conf/evolutions/default/
were automatically re-generated according to the database driver that was selected in the application.conf . But at some point they stopped being updated and the current version looks like the postgresql one. According to https://stackoverflow.com/questions/9964266/how-to-enable-ddl-generation-in-playframework-2-0 this is when I added the second file there. A quick hack could be to remove the 2.sql file, run the service, and add it back and restart the service. Let me know if it works...

I tried but it does not work! But I was reading the error, is it a syntax error in SQL statement, right?

Yes, the syntax is slightly different between the DB systems. In this case, you can also manually edit the file 1.sql to fix it. (I remember postgres had issue with names longer than 31 char, but I don't remember the issue with H2). Actually the file you have now in gsn-services/conf/evolutions/default/ is different from the one here https://github.com/LSIR/gsn/blob/master/gsn-services/conf/evolutions/default/1.sql
If you can figure out what is wrong, I'd be happy to update the repository or add it in the documentation ;-)

Ok, I checked my 1.sql file and it is different from which one you linked. I tried to modify it but when I re-run the program the file 1.sql return the same as before it was modified. How can I effectively modify it? Do you want that I point you out the differences?

I think if you remove the comments at the beginning of the file it would stop rewriting it. To be tested

ok, I tried to fix these errors, I mean those in 1.sql file. Now it gives me an error in the 2.sql file. It is an error due to security_role. Maybe because security_role has 2 arguments instead of 3!?
Have a look
security_role_error

well the security_role table should be correct with 2 columns: https://github.com/LSIR/gsn/blob/master/gsn-services/conf/evolutions/default/1.sql#L75. I'm not really sure that the 1.sql really created everything then.

Have a look.
security_role_enexpected_error

1.sql evolution does create the tables and 2.sql populates them with some initial users and clients. If a table is missing, it is most likely that 1.sql failed somewhere at creating the given table.
How does 1.sql looks like now that you fixed the issues with it?
Is this error happening also when you delete the /tmp/GsnAuthDb?

The last screen that I posted appears because I deleted the /tmp/GsnAuthDb, but it still doesn't find the security_role table.

And which modifications did you do in 1.sql?

I exactly copied this one: https://github.com/LSIR/gsn/blob/master/gsn-services/conf/evolutions/default/1.sql
without comments, I mean without "#"

Hi Julien,
do you have any news about that problem? But if you build the project in yout PC, does it work?

Hi Andrea, sorry for the delay. So I managed to run it locally on my new laptop (configuring everything from scratch). For the evolution to work you have to edit the file 1.sql:

  • remove the two first lines of comment that says that it was generated by ebean DDL
  • around the lines 34 and 42, change "unique (group, data_source)" to "unique (group_id, data_source_id)"
  • around lines 109 and 117 change "(user, data_source))" to "(user_id, data_source_id))"
    Then remove the database file in /tmp and start the service.

It seems that the ebean generator for the evolution has a bug when the column names are reserved words (which I agree is not supposed to happen to a well coded project :-P ). and when writing the unique constraints it doesn't append the "_id" to the identifiers.

Let me know if this solves the problem

Don't worry if you answerd me late =p. Anyway it doesn't work because my 1.sql file was just correct with that modifications. I exactly copied the code in https://github.com/LSIR/gsn/blob/master/gsn-services/conf/evolutions/default/1.sql that it looks like correct.
It's strange :(

From the file in https://github.com/LSIR/gsn/blob/master/gsn-services/conf/evolutions/default/1.sql you still need to remove the two first lines. Otherwise it will get overwritten by the ebean evolution.

Yes, I tried also deleting them, but the error or better this unexpected exception still persists. But you said that you built the project in your laptop and it works, right?

Dear all,
I also managed to make the application correctly run by performing the changes mentioned by Julien.
I think that the key point here is that the line with the "ups" stuff must be kept in the file (like Julien said, only the first two should be deleted). Besides, it is crucial to delete the contents of the /tmp/ folder related to the dabatase before re-running the service.

I am attaching the file that worked for me.
1.zip

Hope it solves the problem.
Best,
Davide

Hi Julien,
thanks to dmairoca I fixed all the problems to build the project. Now when I try to log in in localhost with root@localhost as username and changeme as password it appears this sentence: "This client is not registered for accessing GSN, please contact the administrator if you need to add it." What exactly do i have to do to log in? Thank you.

Hi Julien,

sorry for my infinite questions XD
When I go, after I launched Django in localhost:8000, the page it apears like the following image:
screenshot from 2017-10-07 11-53-06
Is it correct that it apperas the white blank or it has to appear the world map where I should find sensors?
Thanks a lot and have a nice day.

Hi Andrea,
It looks like the javascript and css libraries are not loaded. How did you start the django app? Maybe the "bower install" step didn't complete successfully ?