【问题标题】:Jhipster application error first run首次运行 Jhipster 应用程序错误
【发布时间】:2016-06-07 17:47:24
【问题描述】:

在成功生成新的 Jshipster 3 应用程序后,我无法使用 gulp serve 为应用程序提供服务。

我使用的是 Ubuntu 16.04 和 npm 3.9,当我尝试运行 gulp serve 时,出现以下错误:

enter image description here

当我访问 http://localhost:9000/ 时,我在浏览器上收到以下消息:

    Error: connect ECONNREFUSED 127.0.0.1:8080
   at Object.exports._errnoException (util.js:870:11)
   at exports._exceptionWithHostPort (util.js:893:20)
   at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)

有什么建议吗? :(

【问题讨论】:

    标签: javascript node.js jhipster yo


    【解决方案1】:

    错误提示 gulp 无法连接到127.0.0.1:8080 地址上的后端,这很可能意味着您尚未启动后端。

    您应该使用mvn spring-boot:runmvn 命令启动Spring 应用程序,这会在http://localhost:8080 地址上启动应用程序。

    在此处阅读更多信息:https://jhipster.github.io/development/

    【讨论】:

      【解决方案2】:

      添加@ComponentScan注解和基础包名

      @ComponentScan(basePackages={"com.example"})

      见下面的代码。

      package com.example.SampleProject;
      
      import org.springframework.boot.SpringApplication;
      import org.springframework.boot.autoconfigure.SpringBootApplication;
      import org.springframework.context.annotation.ComponentScan;
      
      @SpringBootApplication
      @ComponentScan(basePackages={"com.example"})
      
      public class SampleProjectApplication {
      
      public static void main(String[] args) {
          SpringApplication.run(SampleProjectApplication.class, args);
        }
      
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-06-04
        • 2023-03-09
        • 1970-01-01
        • 2014-10-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多