NutzCN Logo
问答 nutz-book-project项目怎么在linux服务器部署
发布于 1856天前 作者 qq_fde051ea 1885 次浏览 复制 上一个帖子 下一个帖子
标签:

请教各位:
nutz-book-project项目在本机通过idea运行是没有问题的,启动方式是直接run MainLauncher.java,可以用localhost访问。
在linux服务器上配置了mysql、redis、jdk、tomcat,按照服务器介绍,直接打包war放到tomcat webapp中,相关的配置也做了,好像没法运行起来。
有没有这方面的操作说明?

18 回复

nutz-book-project是最近个半月前下载的,应该是比较新的版本;
redis 5.0.5
tomcat 8.0
jdk1.8.0_121
MySQL 5.7.27

mvn -Dmaven.test.skip=true -Pyvr -Poauth -Pngrok -Pbeepay -Pshortit -Pdwmaster -Pqqrobot clean package nutzboot:shade

每个-P代表一个模块, 按需设置

在nutzcn-webapp/target下生成一个几十mb的jar文件, 把jar文件传到服务器, 然后执行 java -jar xxx.jar 就可以了

运行出这个错误:

[ERROR] Failed to execute goal on project nutzcn-webapp: Could not resolve dependencies for project net.wendal.nutzcn:nutzcn-webapp:jar:3.1.0: Failed to collect dependencies at net.wendal.nutzcn:nutzcn-ngrok:jar:3.1.0 -> org.nutz:nutz-plugins-ngrok:jar:1.r.67-SNAPSHOT: Failed to read artifact descriptor for org.nutz:nutz-plugins-ngrok:jar:1.r.67-SNAPSHOT: Could not transfer artifact org.nutz:nutz-plugins-ngrok:pom:1.r.67-SNAPSHOT from/to nutz (https://jfrog.nutz.cn/artifactory/jcenter): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1] [ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR] [ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :nutzcn-webapp

jdk8u112以上

-Pngrok把这个去掉就运行过去了 这是是什么原因

mvn clean package nutzboot:shade nutzboot:war
用这个命令打包成war不成功 是什么原因?

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.937 s
[INFO] Finished at: 2019-10-25T17:27:03+08:00
[INFO] Final Memory: 16M/137M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nutz.boot:nutzboot-maven-plugin:2.1.9:war (default-cli) on project nutzcn-parent: Execution default-cli of goal org.nutz.boot:nutzboot-maven-plugin:2.1.9:war failed. NullPointerException -> [Help 1] [ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

需要先在项目根目录执行一下无war的mvn命令,然后cd到webapp目录下,执行一次带war的mvn命令,应该就能得到war文件,不过nutzcn直接跑jar文件的,没仔细测过war的方式

带war的命令还需要含-P参数-Poauth这样的吗?

再webapp目录下执行mvn clean package nutzboot:shade nutzboot:war还是有错

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.623 s
[INFO] Finished at: 2019-10-25T17:36:25+08:00
[INFO] Final Memory: 13M/128M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project nutzcn-webapp: Could not resolve dependencies for project net.wendal.nutzcn:nutzcn-webapp:jar:3.1.0: Failed to collect dependencies at net.wendal.nutzcn:nutzcn-core:jar:3.1.0: Failed to read artifact descriptor for net.wendal.nutzcn:nutzcn-core:jar:3.1.0: Could not transfer artifact net.wendal.nutzcn:nutzcn-core:pom:3.1.0 from/to nutz (https://jfrog.nutz.cn/artifactory/jcenter): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1] [ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

而且要完整的-P的

其实也只有webapp需要-P

@Wizzercn 用jdk_8u192试了还是一样的问题;

@wendal 请问下,在生成jar的时候,好像没有webapp对应的-p文件,只有这些-Paliyuniot -Pyvr -Pbeepay -Pngrok -Pweixin -Pqqrobot -Pdwmaster -Pshortit -Poauth -Pluat,请教下这个命令到底要怎么修改使用合适mvn clean package nutzboot:shade nutzboot:war?

[ERROR] Failed to execute goal on project nutzcn-webapp: Could not resolve dependencies for project net.wendal.nutzcn:nutzcn-webapp:jar:3.1.0: The following artifacts could not be resolved: net.wendal.nutzcn:nutzcn-core:jar:3.1.0, net.wendal.nutzcn:nutzcn-adminlte:jar:3.1.0, net.wendal.nutzcn:nutzcn-luat:jar:3.1.0: Could not find artifact net.wendal.nutzcn:nutzcn-core:jar:3.1.0 in nutz (https://jfrog.nutz.cn/artifactory/jcenter) -> [Help 1]

错误好像有点不一样了,cd到webapp目录下执行命令,找不到其他模块的jar?这个要怎么解决

明显不是一样的问题呀

// 项目顶层执行
mvn clean package install
// 进入webapp项目
cd nutzcn-webapp
// 执行打包
mvn clean package nutzboot:shade nutzboot:war -Pxxx -Pxxx

补全需要用的的-P模块名

用jar运行就好啦,何必搞war文件

感谢大神@wendal @Wizzercn 指导,war算是生成了!!

添加回复
请先登陆
回到顶部