Java org.postgresql.util.PSQLException:致命:数据库;pma springbootdb";

Java org.postgresql.util.PSQLException:致命:数据库;pma springbootdb";,java,spring,postgresql,spring-boot,jdbc,Java,Spring,Postgresql,Spring Boot,Jdbc,我正在开发我的第一个sprinboot应用程序,我试图在sprinboot应用程序中配置postgreSQL数据库的属性。当我运行此应用程序时,我遇到以下错误 **org.postgresql.util.PSQLException: FATAL: database "pma-springbootdb" does not exist** at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecuto

我正在开发我的第一个sprinboot应用程序,我试图在sprinboot应用程序中配置postgreSQL数据库的属性。当我运行此应用程序时,我遇到以下错误

**org.postgresql.util.PSQLException: FATAL: database "pma-springbootdb" does not exist**
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2533) ~[postgresql-42.2.12.jar:42.2.12]
    at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2645) ~[postgresql-42.2.12.jar:42.2.12]
    at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:138) ~[postgresql-42.2.12.jar:42.2.12]
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:255) ~[postgresql-42.2.12.jar:42.2.12]
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.12.jar:42.2.12]
    at org.postgresql.jd
......
2020-06-03 09:33:13.052  WARN 1225 --- [         task-1] o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain connection to query metadata : FATAL: database "pma-springbootdb" does not exist
2020-06-03 09:33:13.078  WARN 1225 --- [  restartedMain] ConfigServletWebServerApplicationContext : **Exception encountered during context initialization - cancelling refresh attempt: nested exception is org.springframework.beans.factory.BeanCreationException:** Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is **org.springframework.beans.BeanInstantiationException: Failed to instantiate** 
**Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'requestMappingHandlerAdapter'** defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Unsatisfied dependency expressed   : Invocation of destroy method failed on bean with name 'entityManagerFactory': org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2020-06-03 09:33:13.079  INFO 1225 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2020-06-03 09:33:13.084  INFO 1225 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2020-06-03 09:33:13.112  INFO 1225 --- [  restartedMain] ConditionEvaluationReportLoggingListener 
**Caused by: org.springframework.beans.factory.BeanCreationException:** Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeRepository' defined in com.jrp.pma.dao.EmployeeRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext'
  • SQL查询

    如果不存在员工,则创建序列

    CREATE TABLE IF NOT EXISTS employee (
    
    employee_id BIGINT NOT NULL DEFAULT nextval('employee_seq') PRIMARY KEY,
    email VARCHAR(100) NOT NULL,
    first_name VARCHAR(100) NOT NULL,
    last_name VARCHAR(100) NOT NULL
    
    );
    
    CREATE SEQUENCE IF NOT EXISTS project_seq;
    
    CREATE TABLE IF NOT EXISTS project (
    
    project_id BIGINT NOT NULL DEFAULT nextval('project_seq') PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    stage VARCHAR(100) NOT NULL,
    description VARCHAR(500) NOT NULL
    
    );
    
    
    CREATE TABLE IF NOT EXISTS project_employee (
    
    project_id BIGINT REFERENCES project, 
    employee_id BIGINT REFERENCES employee
    
    );
    
  • Project.java

    *

    • Employee.java
    *


  • 消息
    数据库“pma springbootdb”不存在
    是不言自明的

    在端口为5432的
    localhost
    上运行的PostgreSQL实例中不存在此数据库。要么是错误的数据库名称,要么是错误的实例


    请仔细检查:pma springbootdb与pma springbootbd

    我添加了postgreSQL数据库的屏幕截图,其中显示了pma springbootdb。我认为这不是问题所在。您真的确定此实例在端口为5432的
    localhost
    上运行吗?请发布
    显示监听地址的输出;显示端口\l
    (将使用
    psql
    CLI运行)。谢谢,我犯了一个拼写错误。即使在更正了文件名之后,我还是得到了“由以下原因引起的:org.springframework.beans.factory.BeanCreationException:”请在Java代码中双重检查您拥有的
    pma springbootdb
    在PostgreSQL中您拥有的
    pma springbootbd
    db
    不同于
    bd
    如果您有另一条错误消息,请询问另一个问题,并显示完整的错误消息。我回滚了您上次的编辑。如果你在修正错别字后有不同的问题,请提出新的问题。不要把你的问题变成完全不同的问题。您可以删除此问题,因为它只是由打字错误引起的。当然可以。非常感谢。
    CREATE TABLE IF NOT EXISTS employee (
    
    employee_id BIGINT NOT NULL DEFAULT nextval('employee_seq') PRIMARY KEY,
    email VARCHAR(100) NOT NULL,
    first_name VARCHAR(100) NOT NULL,
    last_name VARCHAR(100) NOT NULL
    
    );
    
    CREATE SEQUENCE IF NOT EXISTS project_seq;
    
    CREATE TABLE IF NOT EXISTS project (
    
    project_id BIGINT NOT NULL DEFAULT nextval('project_seq') PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    stage VARCHAR(100) NOT NULL,
    description VARCHAR(500) NOT NULL
    
    );
    
    
    CREATE TABLE IF NOT EXISTS project_employee (
    
    project_id BIGINT REFERENCES project, 
    employee_id BIGINT REFERENCES employee
    
    );
    
     @Entity
        public class Project {
    
    @Id
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "project_seq")
    
    private Long projectId;
        ....
        ....
         }
    
    @Entity
    public class Employee {
    @Id
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "employee_seq")
        private long employeeId;
    ...
    ..
    }