sun0x00 / redtorch

Kotlin(Java)开源量化交易开发框架
http://redtorch.io
758 stars 371 forks source link

dev分支访问不了网页 #36

Closed ssh352 closed 5 years ago

ssh352 commented 5 years ago
❯ java -jar  ./rt-front-web/build/libs/rt-front-web-0.1.war

顺利启动有如下的log

2018-11-21 09:50:41.113 [main] INFO  Jdk14Logger >>> Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.css] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.html] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.js] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.jsx] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.114 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.png] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.ttf] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.woff] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO  Jdk14Logger >>> Mapped URL path [/**/*.woff2] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.115 [main] INFO  Jdk14Logger >>> Root mapping to handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 09:50:41.292 [main] INFO  Jdk14Logger >>> Registering beans for JMX exposure on startup
2018-11-21 09:50:41.389 [main] INFO  Jdk14Logger >>> Undertow started on port(s) 9099 (http) with context path ''
2018-11-21 09:50:41.393 [main] INFO  Jdk14Logger >>> Started RtApplication in 3.675 seconds (JVM running for 4.091)
2018-11-21 09:50:41.394 [main] INFO  SocketIOServer >>> Session store / pubsub factory used: MemoryStoreFactory (local session store only)
2018-11-21 09:50:41.558 [main] INFO  SocketIOCommandLineRunner >>> SocketIO服务启动成功!
2018-11-21 09:50:41.558 [nioEventLoopGroup-2-1] INFO  SocketIOServer$1 >>> SocketIO server started at port: 9098

但是 不能通过 http://127.0.0.1:9099/static/html/index.html 访问 有如下错误

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Nov 21 09:51:23 CST 2018
There was an unexpected error (type=Not Found, status=404).
Not Found

master branch 没问题

sun0x00 commented 5 years ago

直接使用http://127.0.0.1:9099/ 访问,新的版本已经完全重构了页面结构。

ssh352 commented 5 years ago

还是一样的错误,telnet 证实9099端口确实已经打开

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Nov 21 13:47:06 CST 2018
There was an unexpected error (type=Not Found, status=404).
Not Found
harryzzp commented 5 years ago

@ssh352 换eclipse部署。 @sun0x00 我在IDEA里面部署访问不了static资源的问题,无论是main分支还是dev分支。。。

ssh352 commented 5 years ago

@harryzzp 是指用eclipse 启动 RtApplication吗?谢谢~

harryzzp commented 5 years ago

@ssh352 刚试了下dev分支,在eclipse下启动RtApplication后,确实也不能正常访问http://127.0.0.1:9099/。 同样报404错误。

2018-11-21 16:18:58.136 [main] INFO  Jdk14Logger >>> Root mapping to handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-11-21 16:18:59.608 [main] INFO  Jdk14Logger >>> Registering beans for JMX exposure on startup
2018-11-21 16:19:00.370 [main] INFO  Jdk14Logger >>> Undertow started on port(s) 9099 (http) with context path ''
2018-11-21 16:19:00.380 [main] INFO  Jdk14Logger >>> Started RtApplication in 24.171 seconds (JVM running for 25.508)
2018-11-21 16:19:00.383 [main] INFO  SocketIOServer >>> Session store / pubsub factory used: MemoryStoreFactory (local session store only)
2018-11-21 16:19:07.437 [XNIO-2 task-1] INFO  ServletContextImpl >>> Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-11-21 16:19:07.441 [XNIO-2 task-1] INFO  Jdk14Logger >>> FrameworkServlet 'dispatcherServlet': initialization started
2018-11-21 16:19:07.509 [XNIO-2 task-1] INFO  Jdk14Logger >>> FrameworkServlet 'dispatcherServlet': initialization completed in 67 ms
2018-11-21 16:19:10.046 [nioEventLoopGroup-2-1] INFO  SocketIOServer$1 >>> SocketIO server started at port: 9098
2018-11-21 16:19:10.051 [main] INFO  SocketIOCommandLineRunner >>> SocketIO服务启动成功!
ssh352 commented 5 years ago

@harryzzp, 确实是这样~ 期待@sun0x00更新

sun0x00 commented 5 years ago

@ssh352 @harryzzp 这个问题是这样的,gitignore文件中配置了规则,忽略了所有dist文件夹。在RedTorch\rt-front-web\src\main\webapp\static\ReactSPA\下有个dist文件夹。这个文件夹是Node.js的npm build自动生成的。

ReactSPA实际是一个单独的项目。

推荐安装Node.js,然后使用vscode直接打开这个目录,这是一个完整的前端项目。

harryzzp commented 5 years ago

@ssh352 @harryzzp 这个问题是这样的,gitignore文件中配置了规则,忽略了所有dist文件夹。在RedTorch\rt-front-web\src\main\webapp\static\ReactSPA\下有个dist文件夹。这个文件夹是Node.js的npm build自动生成的。

ReactSPA实际是一个单独的项目。

推荐安装Node.js,然后使用vscode直接打开这个目录,这是一个完整的前端项目。

我在vscode下npm install && npm start 后可以打开http://localhost:8000/user/login?redirect=http%3A%2F%2Flocalhost%3A8000%2Ftrade%2Fbasic%2FtradeBoard 然后登陆报错 image 后台看token是1:

2018-11-22 14:42:58.822 [main] INFO  Jdk14Logger >>> Registering beans for JMX exposure on startup
2018-11-22 14:42:59.280 [main] INFO  Jdk14Logger >>> Undertow started on port(s) 9099 (http) with context path ''
2018-11-22 14:42:59.300 [main] INFO  Jdk14Logger >>> Started RtApplication in 25.432 seconds (JVM running for 26.539)
2018-11-22 14:42:59.344 [main] INFO  SocketIOServer >>> Session store / pubsub factory used: MemoryStoreFactory (local session store only)
2018-11-22 14:43:06.486 [main] INFO  SocketIOCommandLineRunner >>> SocketIO服务启动成功!
2018-11-22 14:43:06.486 [nioEventLoopGroup-2-1] INFO  SocketIOServer$1 >>> SocketIO server started at port: 9098
2018-11-22 14:43:35.032 [XNIO-2 task-1] INFO  ServletContextImpl >>> Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-11-22 14:43:35.121 [XNIO-2 task-1] INFO  Jdk14Logger >>> FrameworkServlet 'dispatcherServlet': initialization started
2018-11-22 14:43:35.198 [XNIO-2 task-1] INFO  Jdk14Logger >>> FrameworkServlet 'dispatcherServlet': initialization completed in 69 ms
2018-11-22 14:44:08.147 [nioEventLoopGroup-3-1] WARN  RtApplication$1 >>> SocketIO认证失败,Token-[1] Address-[/0:0:0:0:0:0:0:1:56122]
2018-11-22 14:44:58.263 [nioEventLoopGroup-3-2] WARN  RtApplication$1 >>> SocketIO认证失败,Token-[1] Address-[/0:0:0:0:0:0:0:1:56157]
sun0x00 commented 5 years ago

@harryzzp 如果你使用npm运行,应该使用npm run start:no-mock命令。默认npm start是mock的,模拟后台操作的,这个我在最初开发的时候用了,后面成型后就弃用了。 所以build之后打包在war里,用9099端口访问最佳。开发的时候用这种形式比较好,webpack热更新方便快捷。

sun0x00 commented 5 years ago

暂时不关闭这个问题,让更多朋友看到