云效+EDAS部署遇到的项目问题
云效+EDAS部署遇到的项目问题
1:云效私有库的使用
本地迁移操作说明
通过以上链接下载本地仓库迁移工具migrate-local-repo-tool.jar下载地址
运行该迁移工具(请确保您的JDK版本为1.8及以上),如下所示:
$ java -jar migrate-local-repo-tool.jar -cd "/$HOME/.m2/repository/" -t "http://127.0.0.1/repository/releases/" -u admin -p admin123
参数注解:
-cd 您要迁移的本地目录
-t 目标仓库地址,您可以在云效上点击仓库地址,获取您的目标仓库地址
-p 密码
-u 用户名
注:用户名和密码为您要上传的目标仓库用户名及密码,您可在setting.xml中获取对应仓库的username和password
根据您的实际需求指定合适的参数,执行此命令以迁移您的本地仓库至云效
重点使用方法
1:在pom里配置私有仓库总pom需要配置,父(引用)pom需要配置,父pom最底层配置
<repositories>
<repository>
<id>aliyun-repo</id>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</repository>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>rdc-releases</id>
<url>https://阿里私有库地址/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>rdc-releases</id>
<url>https://阿里私有库地址/</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>rdc-releases</id>
<url>https://阿里私有库地址/</url>
</repository>
</distributionManagement>
云效构建更新云效私有库官方文档:https://help.aliyun.com/document_detail/72471.html?spm=a2c4g.11186623.6.628.ZsmBp3
2.在项目根目录上传"settings.xml"文件,下载地址看下图
2:项目的servlet-api jar包和tomcat 的包冲突
解决方法:就是在你打包的war包模块的pom配置jar包的引入如下:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
/*这个是重点,限制jar包使用范围,只在编译测试的时候使用,就不会和tomcat加载容器时使用servlet-api jar包出现冲突*/
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
3:docker+tomcat 启动时非常慢原因之JRE /dev/random阻塞
打开jdk安装路径 $JAVA_PATH/jre/lib/security/java.security 这个文件,找到下面的内容:
securerandom.source=file:/dev/random
替换成:
securerandom.source=file:/dev/./urandom
百度了好多人的博客也不知道到底是谁解决的,这里我就随便找了一个当做根源
参考博客:http://www.cnblogs.com/lemon-flm/p/7396627.html
4:一直以为卡在了Deploying web application directory xxxxx/xxxxx.xml
INFO: Deploying web application directory xxxxx/xxxxx.xml
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
刚开始以为是使用云效部署配置的问题,因为使用云效EDAS部署就卡在这个,使用tomcat手动启动就能看到错误日志,后来实在没办法了就搜索了日志错误,就感觉是报错了只是错误信息没打印出来,也一直找不到云效EDAS日志在哪配置。最后百度了很久无聊将下面的"log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader)"百度了一下才发现问题,吐血还是太年轻,这个问题只需在项目的resource下面配置了log4j.properties文件,就能看到错误信息了。
以下是log4j.properties的内容:
log4j.rootLogger=DEBUG,A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c]-[%p] %m%n
---------------------
作者:帅校长
来源:****
原文:https://blog.****.net/jtshongke/article/details/79406690
版权声明:本文为博主原创文章,转载请附上博文链接!
参考博客:https://blog.****.net/jtshongke/article/details/79406690