无法在prod配置文件中使用postgreSQL保存数据

时间:2016-07-13 14:04:07

标签: postgresql spring-boot spring-data-jpa jhipster

当我使用prod配置文件启动我的服务器时,我可以在我的JHipster应用程序中连接admin admin,但是当我想创建一个新对象时,我无法保存任何数据(我有一个InternalServerError)。但是在使用相同数据库(PostgreSQL)的dev配置文件中,它运行良好。

此外,在使用prod配置文件了解问题时,我不知道如何获取日志。

我可以添加prod配置文件的配置文件

# ===================================================================
# Spring Boot configuration for the "prod" profile.
#
# This configuration overrides the application.yml file.
# ===================================================================

# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================


spring:
    devtools:
        restart:
            enabled: false
        livereload:
            enabled: false
    datasource:
        url: jdbc:postgresql://localhost:5432/vraiJhipster
        name:
        username: vraiJhipster
        password:
    jpa:
        database-platform: com.mycompany.myapp.domain.util.FixedPostgreSQL82Dialect
        database: POSTGRESQL
        show_sql: false
        properties:
            hibernate.cache.use_second_level_cache: true
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: false
            hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
    data:
        elasticsearch:
            cluster-name:
            cluster-nodes: localhost:9300
    mail:
        host: localhost
        port: 25
        username:
        password:
    thymeleaf:
        cache: true

liquibase:
    contexts: prod

server:
    port: 8080
    compression:
        enabled: true
        mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json
        min-response-size: 1024

# ===================================================================
# JHipster specific properties
# ===================================================================

jhipster:
    http:
        cache: # Used by the CachingHttpHeadersFilter
            timeToLiveInDays: 1461
    cache: # Hibernate 2nd level cache, used by CacheConfiguration
        timeToLiveSeconds: 3600
        ehcache:
            maxBytesLocalHeap: 256M
    security:
        rememberMe:
            # security key (this key should be unique for your application, and kept secret)
            key: *****************************************
    mail: # specific JHipster mail property, for standard properties see MailProperties
        from: vraiJhipster@localhost
    metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
        jmx.enabled: true
        spark:
            enabled: false
            host: localhost
            port: 9999
        graphite:
            enabled: false
            host: localhost
            port: 2003
            prefix: vraiJhipster
        logs: # Reports Dropwizard metrics in the logs
            enabled: false
            reportFrequency: 60 # in seconds
    logging:
        logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
            enabled: false
            host: localhost
            port: 5000
            queueSize: 512
    swagger: # swagger is disabled. It can be disabled by pasing 'no-swagger' profile at run time as well
        enabled: false

谢谢。

如果您对我的配置有所了解,可以提问。

1 个答案:

答案 0 :(得分:0)

我发现问题实际上是弹性搜索。当我在生产模式下使用JHipster时,默认配置在端口9300上使用elasticSearch。但我没有在我的计算机上运行任何elasticSearch。所以我将弹性搜索配置从dev配置文件粘贴到prod配置文件。

data:
    elasticsearch:
        cluster-name:
        cluster-nodes:
        properties:
            path:
              logs: target/elasticsearch/log
              data: target/elasticsearch/data