序号 | 项目 |
---|---|
1 | Spring Cloud Alibaba |
2 | Springboot 2.3.7 |
3 | spring 5 |
4 | docker 20.10.13 |
5 | k8s 1.23 |
6 | kubesphere 3.0 |
整合JimuReport 和ruoyi 框架时,按官方提供的步骤 *** 作后,开发环境一切顺利,666!可是当要发布到测试环境时,问题来了,能正常编译打包,甚至都能正常启动,但是,但是…,要访问的时候,界面出现了这样的提示:
Sorry, Page Not Found
30707是网关gateway的端口,网关的router 配置如下:
# 报表
- id: sx-jimureport
uri: lb://sx-jimureport
predicates:
- Path=/jmreport/**
filters:
- StripPrefix=1
ok,找到原因了,哈哈哈,原来是router配置错了,过滤器把路径中的/jmreport去掉了,把过滤器去掉。可是改了之后却报如下的错误了,一波未平又来一波。
Gateway 404 not_found
更大的问题的是gateway服务、JimuReport 服务都没有错误日志,我的乖乖啊,到底是啥原因呢,单从日志看无从查起呢,这时想起了一个工具-----spring actuator ,它可以动态地把日志级别改成debug,我只能说这个工具太好用了,哈哈哈! 改完后终于有日志了,如下:
11:02:42.206 [http-nio-9300-exec-4] DEBUG o.a.c.v.RemoteIpValve - [log,173] - Incoming request /jmreport/list with originalRemoteAddr [10.10.220.101], originalRemoteHost=[10.10.220.101], originalSecure=[false], originalScheme=[http], originalServerName=[10.10.220.101], originalServerPort=[30747] will be seen as newRemoteAddr=[10.10.220.101], newRemoteHost=[10.10.220.101], newSecure=[false], newScheme=[http], newServerName=[10.10.220.101], newServerPort=[30747]
11:02:42.206 [http-nio-9300-exec-4] DEBUG o.a.c.a.AuthenticatorBase - [log,173] - Security checking request GET /jmreport/list
11:02:42.206 [http-nio-9300-exec-4] DEBUG o.a.c.r.RealmBase - [log,173] - No applicable constraints defined
11:02:42.207 [http-nio-9300-exec-4] DEBUG o.a.c.a.AuthenticatorBase - [log,173] - Not subject to any constraint
11:02:42.209 [http-nio-9300-exec-4] DEBUG o.a.c.c.C.[.[localhost] - [log,173] - Processing ErrorPage[errorCode=0, location=/error]
11:02:42.213 [http-nio-9300-exec-4] DEBUG o.a.c.c.C.[.[.[.[dispatcherServlet] - [log,173] - Disabling the response for further output
11:02:42.213 [http-nio-9300-exec-4] DEBUG o.a.c.h.Http11InputBuffer - [log,173] - Before fill(): [true], parsingRequestLine: [true], parsingRequestLinePhase: [0], parsingRequestLineStart: [0], byteBuffer.position() [0]
11:02:42.213 [http-nio-9300-exec-4] DEBUG o.a.t.u.n.SocketWrapperBase - [log,173] - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@be38358:org.apache.tomcat.util.net.NioChannel@7c5b6a69:java.nio.channels.SocketChannel[connected local=k8s-salve/10.10.220.102:9300 remote=/10.10.220.101:23092]], Read from buffer: [0]
11:02:42.214 [http-nio-9300-exec-4] DEBUG o.a.t.u.n.NioEndpoint - [log,173] - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@be38358:org.apache.tomcat.util.net.NioChannel@7c5b6a69:java.nio.channels.SocketChannel[connected local=k8s-salve/10.10.220.102:9300 remote=/10.10.220.101:23092]], Read direct from socket: [0]
11:02:42.214 [http-nio-9300-exec-4] DEBUG o.a.c.h.Http11InputBuffer - [log,173] - Received []
11:02:42.214 [http-nio-9300-exec-4] DEBUG o.a.c.h.Http11Processor - [log,173] - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@be38358:org.apache.tomcat.util.net.NioChannel@7c5b6a69:java.nio.channels.SocketChannel[connected local=k8s-salve/10.10.220.102:9300 remote=/10.10.220.101:23092]], Status in: [OPEN_READ], State out: [OPEN]
11:02:42.214 [http-nio-9300-exec-4] DEBUG o.a.c.h.Http11NioProtocol - [log,173] - Pushed Processor [org.apache.coyote.http11.Http11Processor@7dcea70d]
11:02:42.214 [http-nio-9300-exec-4] DEBUG o.a.t.u.n.NioEndpoint - [log,173] - Registered read interest for [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@be38358:org.apache.tomcat.util.net.NioChannel@7c5b6a69:java.nio.channels.SocketChannel[connected local=k8s-salve/10.10.220.102:9300 remote=/10.10.220.101:23092]]
11:02:42.726 [com.alibaba.nacos.naming.failover] DEBUG c.a.n.client.naming - [run,147] - failover switch is not found, failover00-00---000-VIPSRV_FAILOVER_SWITCH-000---00-00
11:02:42.763 [com.alibaba.nacos.naming.beat.sender] DEBUG c.a.n.client.naming - [sendBeat,414] - [BEAT] public sending beat to server: BeatInfo{port=9300, ip='10.10.220.102', weight=1.0, serviceName='DEFAULT_GROUP@@sx-jimureport', cluster='DEFAULT', metadata={preserved.register.source=SPRING_CLOUD}, scheduled=false, period=5000, stopped=false}
11:02:42.763 [com.alibaba.nacos.naming.beat.sender] DEBUG c.a.n.client.naming - [execute,476] - HTTP method: PUT, url: http://10.10.220.101:32108/nacos/v1/ns/instance/beat?app=sx-jimureport&serviceName=DEFAULT_GROUP%40%40sx-jimureport&namespaceId=public&port=9300&clusterName=DEFAULT&ip=10.10.220.102, body: {}
可以定位到问题是在jimureport 里面了,RealmBase No applicable constraints defined这是什么问题呢,没有找到对应的Controller ? 想到jimureport项目,它是把controller 打包成jar引入到项目中,所以是不是spring 启动时没有扫描到controller ,果然,在启动类增加如下配置:
@SpringBootApplication(exclude={MongoAutoConfiguration.class},scanBasePackages = {"org.jeecg.modules.jmreport","com.sx.jimu"})
@EnableDiscoveryClient
public class JimuReportApplication {
可是,加上这句后启动时却报另一个错了…,心碎。
日志如下:
Failed to introspect Class [org.jeecgframework.minidao.aop.MiniDaoHandler]
这个类是在jar中
是不是测试环境打包时没有打包到这个jar呢?
带着这个问题我对比了开发环境和测试环境打的包,发现少了几下这个包,如下图:
纳闷了,少了包编译不会报错?原来项目中没有直接引用编译是不会报错的。
那打包为什么漏掉呢?于是决定仔细看下编译和打包的日志。。。
3.查看编译和打包日志maven 命令增加-e -X选项,就会输出详细的日志:
cd ${workspace}/${service} && mvn -gs ${workspace}/configuration/settings.xml -DskipTests=true clean package -Ptest jib:build -Djib.httpTimeout=200000 -DsendCredentialsOverHttp=true -f pom.xml -e -X"
#查看日志,发现如下信息
[WARNING] The POM for org.jeecgframework.jimureport:jimureport-spring-boot-starter:jar:1.5.0-beta is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for org.jeecgframework.jimureport:jimureport-spring-boot-starter:1.5.0-beta
[FATAL] Non-parseable POM /root/.m2/repository/org/springframework/boot/spring-boot-starter-parent/2.6.6/spring-boot-starter-parent-2.6.6.pom: end tag name </head> must be the same as start tag <link> from line 6 (position: TEXT seen ... href="./css/style.css" rel="stylesheet" type="text/css">\r\n</head>... @7:8) @ /root/.m2/repository/org/springframework/boot/spring-boot-starter-parent/2.6.6/spring-boot-starter-parent-2.6.6.pom, line 7, column 8
果然有问题。。。,在引入jimureport-spring-boot-starter:jar:1.5.0-beta包,传递依赖失败了,而失败的原因是因为spring-boot-starter-parent-2.6.6这个包下载失败了,这个包下载失败的原因可以看我的这个博客下载jar失败处理,处理好这个jar后,再重新打包发布,ok!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)