Git Product home page Git Product logo

Comments (5)

ezazpi avatar ezazpi commented on September 17, 2024

There may be a couple of issues; one having to do with manual routing (no mapping error) and the other having to do with the organizations table (organizations does not exist). I checked the repository code and the table in the annotation is organizations. I followed the chapter 8 .md mvn clean and docker UP using docker/docker-compose.yml instructions.

licensingservice_1 | 2020-09-13 20:12:20.196 WARN 1 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound : No mapping for GET /organization/v1/organization/958aa1bf-18dc405c-b84a-b69f04d98d4f
gatewayserver_1 | 2020-09-13 20:12:30.680 DEBUG 1 --- [or-http-epoll-3] c.o.gateway.filters.TrackingFilter : tmx-correlation-id found in tracking filter: TEST-CORRELATION-ID.
organizationservice_1 | 2020-09-13 20:12:31.083 INFO 1 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
organizationservice_1 | 2020-09-13 20:12:31.083 INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
organizationservice_1 | 2020-09-13 20:12:31.101 INFO 1 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 18 ms
organizationservice_1 | Hibernate: select organizati0_.organization_id as organiza1_0_0_, organizati0_.contact_email as contact_2_0_0_, organizati0_.contact_name as contact_3_0_0_, organizati0_.contact_phone as contact_4_0_0_, organizati0_.name as name5_0_0_ from organizations organizati0_ where organizati0_.organization_id=?
database_1 | 2020-09-13 20:12:31.223 UTC [54] ERROR: relation "organizations" does not exist at character 230
database_1 | 2020-09-13 20:12:31.223 UTC [54] STATEMENT: select organizati0_.organization_id as organiza1_0_0_, organizati0_.contact_email as contact_2_0_0_, organizati0_.contact_name as contact_3_0_0_, organizati0_.contact_phone as contact_4_0_0_, organizati0_.name as name5_0_0_ from organizations organizati0_ where organizati0_.organization_id=$1
organizationservice_1 | 2020-09-13 20:12:31.229 WARN 1 --- [nio-8081-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 42P01
organizationservice_1 | 2020-09-13 20:12:31.229 ERROR 1 --- [nio-8081-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: relation "organizations" does not exist
organizationservice_1 | Position: 230
organizationservice_1 | 2020-09-13 20:12:31.242 INFO 1 --- [nio-8081-exec-1] o.h.e.internal.DefaultLoadEventListener : HHH000327: Error performing load command
organizationservice_1 |
organizationservice_1 | org.hibernate.exception.SQLGrammarException: could not extract ResultSet

from manning-smia.

ihuaylupo avatar ihuaylupo commented on September 17, 2024

Please verify that the organization and license tables are created in the PostgreSQL database. In order to use the services you have to create the database tables, you can find the script in the docker's folder.

from manning-smia.

ezazpi avatar ezazpi commented on September 17, 2024

I didn't have any problems with those tables in previous chapters. I thought the database.sql script was automatically processed. Is there something different I need to do that I haven't done previously?

I was going to also mention that with respect to routing, I also used the URL in Figure 8.14, but also got the 404 error. I know that's unrelated to the missing organizations table. Thank you.

from manning-smia.

ihuaylupo avatar ihuaylupo commented on September 17, 2024

The URL can change depending on the organization and license ID records you have on the database. Remember, the URL is created by using http://localhost:8072/organization-service/v1/organization/${Organization_ID}

The organization_ID is the auto-generated ID of the record in the database.

The database.sql script is not automatically processed instead you have to run it the first time you execute the docker-compose command, in other words, the first time the database container is going to be created.

Please check, the other comments I left on the previous issues, they are also database issues.

from manning-smia.

ezazpi avatar ezazpi commented on September 17, 2024

Hi Illary,

Here's the resolution and someone who knows more about postgresql than me can provide an explanation.  We're using the same postgresql Docker image so one would think things would be consistent.  I am running Docker on Windows 10 with the Windows Subsystem for Linux 2 enabled.  However, this problem wouldn't seem to be related to the host machine.  Either the postgresql image requires a compatible template or the database.sql script requires the LC_COLLATE and LC_CTYPE changes I I outlined below.  Of course, there's no need to separately create the database and the tables - I only did that for troubleshooting.

The database.sql script creates the database as follows:

CREATE DATABASE ostock_dev
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8' <- change to 'en_US.utf8'
LC_CTYPE = 'en_US.UTF-8' <- change to 'en_US.utf8'
TABLESPACE = pg_default
CONNECTION LIMIT = -1;

The above changes allow the ostock_dev database to be created and the tables to be created in the right place.

The LC_COLLATE and LC_CTYPE values are considered to be incompatible as you can see in the next two create database commands (nice when error messages provide a working solution!):

C:\Users\ezazpi\Documents\IntelliJ\manning-smia\chapter9>echo create database ostock_dev with owner = postgres encoding = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8' TABLESPACE = pg_default CONNECTION LIMIT = -1; | docker exec -i 2352673e6083 psql -U postgres
ERROR:  new collation (en_US.UTF-8) is incompatible with the collation of the template database (en_US.utf8)HINT:  Use the same collation as in the template database, or use template0 as template.

C:\Users\ezazpi\Documents\IntelliJ\manning-smia\chapter9>echo create database ostock_dev with owner = postgres encoding = 'UTF8' LC_COLLATE = 'en_US.utf8' LC_CTYPE = 'en_US.UTF-8' TABLESPACE = pg_default CONNECTION LIMIT = -1; | docker exec -i 2352673e6083 psql -U postgres
ERROR:  new LC_CTYPE (en_US.UTF-8) is incompatible with the LC_CTYPE of the template database (en_US.utf8)HINT:  Use the same LC_CTYPE as in the template database, or use template0 as template.

from manning-smia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.