qq_41450341
qq_41450341
7分钟前发布
  • java

linux arm架构 求jdk1.6版本的安装包?感激不尽

0个回复
qq_45250737
qq_45250737
17分钟前发布
  • spring

有大神写过关于基于springboot的在线笔记的相关代码吗?如果可以详细再好不过了。问老师老师也不回,我十分没有方向,希望可以参考一下,灰常感谢

0个回复
xuexinda
xuexinda
31分钟前发布
  • maven
  • java
  • tomcat

cas多属性返回通过连接ldap的方式

通过以上配置,客户端依然无法获取邮箱,在控制台信息可以看出邮箱已经返回了,不知道为什么

2020-11-24 14:14:08,489 WARN [org.apereo.cas.authentication.LdapAuthenticationHandler] - <DN resolution failed. [DN cannot be null]>

2020-11-24 14:14:08,492 ERROR [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentication handler that supports [UsernamePasswordCredential(username=P0888888)] of type [UsernamePasswordCaptchaCredential]. Examine the configuration to ensure a method of authentication is defined and analyze CAS logs at DEBUG level to trace the authentication event.>

2020-11-24 14:14:08,561 WARN [org.apereo.cas.authentication.LdapAuthenticationHandler] - <DN resolution failed. [DN cannot be null]>

2020-11-24 14:14:08,561 ERROR [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentication handler that supports [UsernamePasswordCredential(username=P0888888)] of type [UsernamePasswordCaptchaCredential]. Examine the configuration to ensure a method of authentication is defined and analyze CAS logs at DEBUG level to trace the authentication event.>

2020-11-24 14:14:11,924 INFO [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authenticated principal [P0888888] with attributes [{employeeNumber=[P0888888], mail=[sstest3@pacteraedge.com]}] via credentials [[UsernamePasswordCredential(username=P0888888)]].>

2020-11-24 14:14:11,925 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: Supplied credentials: [UsernamePasswordCredential(username=P0888888)]

ACTION: AUTHENTICATION_SUCCESS

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,926 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: [result=Service Access Granted,service=http://localhost:8088/index.jsp,principal=SimplePrincipal(id=P0888888, attributes={mail=[sstest3@pacteraedge.com], employeeNumber=[P0888888]}),requiredAttributes={}]

ACTION: SERVICE_ACCESS_ENFORCEMENT_TRIGGERED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,938 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: TGT-1-********************************************************l6XExfVJRscBAC1500995-PC

ACTION: TICKET_GRANTING_TICKET_DESTROYED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,939 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: [result=Service Access Granted,service=http://localhost:8088/index.jsp,principal=SimplePrincipal(id=P0888888, attributes={mail=[sstest3@pacteraedge.com], employeeNumber=[P0888888]}),requiredAttributes={}]

ACTION: SERVICE_ACCESS_ENFORCEMENT_TRIGGERED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,941 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: TGT-2-********************************************************4RX9ThrVzn8BAC1500995-PC

ACTION: TICKET_GRANTING_TICKET_CREATED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,945 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: [result=Service Access Granted,service=http://localhost:8088/index.jsp,requiredAttributes={}]

ACTION: SERVICE_ACCESS_ENFORCEMENT_TRIGGERED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,951 INFO [org.apereo.cas.DefaultCentralAuthenticationService] - <Granted ticket [ST-2-tBx3gEKew60rNc2Gtu0spo5LCj4BAC1500995-PC] for service [http://localhost:8088/index.jsp] and principal [P0888888]>

2020-11-24 14:14:11,952 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: ST-2-tBx3gEKew60rNc2Gtu0spo5LCj4BAC1500995-PC for http://localhost:8088/index.jsp

ACTION: SERVICE_TICKET_CREATED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,997 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: audit:unknown

WHAT: [result=Service Access Granted,service=http://localhost:8088/index.jsp,principal=SimplePrincipal(id=P0888888, attributes={}),requiredAttributes={}]

ACTION: SERVICE_ACCESS_ENFORCEMENT_TRIGGERED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

=============================================================

 

>

2020-11-24 14:14:11,997 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: P0888888

WHAT: ST-2-tBx3gEKew60rNc2Gtu0spo5LCj4BAC1500995-PC for http://localhost:8088/index.jsp

ACTION: SERVICE_TICKET_VALIDATED

APPLICATION: CAS

WHEN: Tue Nov 24 14:14:11 CST 2020

CLIENT IP ADDRESS: 127.0.0.1

SERVER IP ADDRESS: 127.0.0.1

1个回复
weixin_44510465
勾 践
1小时前发布
  • spring
  • java
  • mysql

背景:

拉取一百多万tiao的订单信息,每一条都往队列里推送,消费者(开启了容器的多线程)接收到一条后就往数据库插入

 

出现的问题:

发送消息加消息消费持续了将近一个小时,突然控制台就报连接异常,Broken pipe,然后消费者从几十个就将为了0,后续的消息都堆积在了队列里无法消费。

 

异常信息:

org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:321)
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:284)
    at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118)
    at org.springframework.session.web.http.OnCommittedResponseWrapper$SaveContextServletOutputStream.flush(OnCommittedResponseWrapper.java:495)
    at com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1100)
    at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:915)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:285)
    at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:102)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:272)
    at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:224)
    at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:119)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:147)
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:472)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:395)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:254)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:177)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
    at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
    at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
    at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1306)
    at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:726)
    at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:679)
    at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:669)
    at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:646)
    at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:169)
    at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:252)
    at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1561)
    at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:380)
    at org.apache.coyote.Response.action(Response.java:173)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:317)
    ... 46 common frames omitted
2020-11-17 20:29:16.283 [http-nio-8082-exec-9] WARN  o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - Failed to invoke @ExceptionHandler method: public com.yd.core.utils.R com.yd.core.exception.GlobalExceptionHandler.expectHander(java.lang.Exception)
org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:321)
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:284)
    at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118)
    at org.springframework.session.web.http.OnCommittedResponseWrapper$SaveContextServletOutputStream.flush(OnCommittedResponseWrapper.java:495)
    at com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1100)
    at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:915)
    at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:285)
    at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:102)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:272)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:180)
    at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:82)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:119)
    at org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver.doResolveHandlerMethodException(ExceptionHandlerExceptionResolver.java:400)
    at org.springframework.web.servlet.handler.AbstractHandlerMethodExceptionResolver.doResolveException(AbstractHandlerMethodExceptionResolver.java:61)
    at org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.resolveException(AbstractHandlerExceptionResolver.java:136)
    at org.springframework.web.servlet.handler.HandlerExceptionResolverComposite.resolveException(HandlerExceptionResolverComposite.java:78)
    at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1255)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1062)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:147)
    at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:472)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:395)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:254)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:177)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
    at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
    at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
    at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1306)
    at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:726)
    at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:679)
    at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:669)
    at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:646)
    at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:169)
    at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:252)
    at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1561)
    at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:380)
    at org.apache.coyote.Response.action(Response.java:173)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:317)
    ... 49 common frames omitted

0个回复
XL340823
名字就是这个
1小时前发布
  • java
  • mysql

初学小白,今天刚刚学到了数据库连接池,在看视频的时候发现有段代码不是太懂,就是properties pro=new properties();这个,这里面为啥能new,properties不是一个配置文件吗?他又不是一个类

0个回复
nulifendou12
nulifendou12
1小时前发布
  • java
  • jar
  • php

有没有会点击网址强制唤醒手机浏览器打开的,不是微信与QQ
是一款国外的短视频APP

0个回复
qq_27181955
qq_27181955
2小时前发布
  • linux
  • java
  • centos

最近用到jenkins + docker进行部署。但是在推送镜像的过程中花费了大量的时间,不知道有没有办法优化一下这个时间。或者换成harbor会不会好一点。请大佬们指教

0个回复
qq_35316126
FinchWei
3小时前发布
  • spring

Springboot 参数校验 当A=1 时,B能为空 ;不为1时,B可以为空,怎么做?

3个回复
weixin_43843844
沉睡冰山
4小时前发布
  • java

OA系统提交审批时报的错误,问题大概知道是什么意思,但不知道从哪入手解决,而且测试环境可以正常提交,但生产环境不行,679.4是个金额,求大佬帮忙看看..

 

 

1个回复
caiyile
caiyile
5小时前发布
  • spring
  • java
  • java-ee

为啥bean找不到呢

0个回复
weixin_48384182
爱上纯净的蓝天
5小时前发布
  • java

题目描述:

拥有探险精神的你和朋友去探险,到了一个海岛,上面有N件宝物,你想把宝物都运出来,这些宝物需要特制的盒子装送,这种盒子要么不装,要装就得装满。当下你有两类盒子,盒子数目不限,A类盒装1件,B类盒是装3件,请问有多少种不同的装运方式?

 

输入: 只有一个整数N(0<N<=50)此海岛有几个宝物

输出: 有多少种装运方式

提示: 假设宝藏个数是N

N=1 装运方式为1种

N=2 装运方式为1种

  • 1+1=2 (都用A盒装)

N=3 装运方式为2种

  • 1+1+1=3(都用A盒装)

  • 3=3(用B盒装)

N=4 装运方式为3种

  • 1+1+1+1=4(用A盒装)

  • 1+3=4(先用A盒装再用B盒装)

  • 3+1=4(先用B盒装再用A盒装)

1个回复
m0_45490356
m0_45490356
5小时前发布
  • python
  • java

零售行业,寻求供应商爬取小程序商品价格信息。

0个回复
BiJInAiLao
BiJInAiLao
5小时前发布
  • maven
  • java
  • oracle
  • hibernate
  • java-ee

Liferay的门户网站在Control Panel里配置的时候不小心把管理员账号绑定的Role都移除了,导致现在管理员账号变成一般账号了,求解!

尝试过数据库打Patch,但找不到对应的表。因为是从第三方拿过来维护的网站,设计文档也不全。

T_T 还好不是生产环境。。

0个回复
qq_39201064
qq_39201064
5小时前发布
  • spring
  • java

系统中需要一个超级账户,我们内部使用,无论是操作记录还是用户列表,使用用户看不到超级账户的痕迹

而且拥有所有的权限,所以涉及到用户增加权限与角色的时候超级账户与权限、角色的关系一并关联

我的做法是ApplicationRunner项目启动的时候就查询是否有超级账户,没有的话就增加一个账户

相应的权限、角色一并关联,记录操作日志的时候也有一个字段标识,如果是系统账户不予记录

这样就达到了经理的要求

昨晚把代码提交的时候,经理说不是这样的

他说这个超级用户存在于表中,但是拥有所有角色与权限

这我就没头绪了,角色与权限使用用户可以随意添加,如果添加的话,不用代码实现添加,要怎么关联起来,用触发器吗?

9个回复
h2395567938
h2395567938
6小时前发布
  • java

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBconnection {
    Connection conn=null;
    public DBconnection()
    {
        try
        {
            Class.forName("com.mysql.jdbc.Driver");
            
            conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/student?useSSL=false&serverTimezone=CTT","root","root");
            System.out.println("数据库连接成功!");
        }
        catch(ClassNotFoundException e)
        {
            e.printStackTrace();
        }catch(SQLException e){
            e.printStackTrace();
        }
    }

    public static void main(String args[])
    {
        new DBconnection();
    }
}

}

链接数据库一直出现异常,我安装的是8.0数据库,按照网上搜索的使用com.mysql.cj.jbdc.Driver时又会报错出现java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver

数据库驱动程序5.0和8.0我都加了。

3个回复
qq_39024837
无罪之证
14小时前发布
  • maven
  • java
  • oracle
  • mysql

最近再看阿里愚公的迁移工具,但是程序在启动的时候就报空指针异常,请问有谁遇到过么,怎么解决的?求教

0个回复
Perhapsma
Perhapsma
16小时前发布
  • java

 

0个回复
Jimmy45642B
是吉吉米呀
17小时前发布
  • java

老师布置了一个新的作业,在旧的基础上添加几个条件,上课没搞懂现在不太清楚该怎么改。要求如下,附上之前作业写得代码:

Write a program which computes the bill for shipping a group of boxes.

  • Ask for the number of boxes to be shipped. For each box:
  • Ask for the length, width, and height
  • Ask for the weight
  • Ask for the distance to be shipped
  • Ask if they want regular shipping, 2-3 day ground, or next-day air

The cost of shipping each box is calculated as follows:

  • Regular shipping price is 50 cents per pound.
  • 2-3 ground is $1.00 per pound and
  • Next-day air is $1.50 per pound
  • If the distance is greater than 1000 miles there is a $5 charge added onto the cost of the given box.

Print out the cost of each box as well as the total cost of all the boxes.

Add a 6% tax onto the final bill.

On the next page is a sample run.

 

import java.util.Scanner;

public class Program1b
{
    public static void main(String[] args)
    {
        int NUM_BOX; 
        Scanner keyboard = new Scanner(System.in);
        System.out.print("How many boxes are there? ");
        NUM_BOX = keyboard.nextInt();
        
        double[] length = new double[NUM_BOX];
        double[] width = new double[NUM_BOX];
        double[] height = new double[NUM_BOX];
        double[] weight = new double[NUM_BOX];
        double[] cost = new double[NUM_BOX];
        double finalcost;
        double total=0;
        
        System.out.print("\nEnter lengths in inches and weight in pounds.\n\n");
        
             for (int i = 0; i < NUM_BOX;i++)
            {
            do{    
            System.out.print("Box #" + (i + 1) + " length: ");
            length[i] = keyboard.nextDouble();
            }while(length[i]<=0);
            
            do{
            System.out.print("Box #" + (i + 1) + " width: ");
            width[i] = keyboard.nextDouble();
            }while(width[i]<=0);
            
            do{
            System.out.print("Box #" + (i + 1) + " height: ");
            height[i] = keyboard.nextDouble();
            }while(height[i]<=0);
            
            do{
            System.out.print("Box #" + (i + 1) + " weight: ");
            weight[i] = keyboard.nextDouble();
            }while(weight[i]<=0);
            
            if (length[i] * width[i] * height[i] <= 2000) 
                cost[i] = weight[i] * 0.5;             
            else 
                cost[i] = weight[i] * 0.75;
            
            }

            for (int i = 0; i < NUM_BOX; i++)
            {            
            total+=cost[i];
            }
            finalcost=total*1.06;
            System.out.printf("\nThe total cost is $%.2f" , finalcost);
        
    }
}

 

0个回复
tower888
tower888
17小时前发布
  • java

cuba studio创建cuba工程时,gradle报错 

Could not resolve com.haulmont.gradle:cuba-plugin:7.2.10.
         > Could not get resource 'https://maven.aliyun.com/repository/public/com/haulmont/gradle/cuba-plugin/7.2.10/cuba-plugin-7.2.10.pom'.
            > Could not GET 'https://maven.aliyun.com/repository/public/com/haulmont/gradle/cuba-plugin/7.2.10/cuba-plugin-7.2.10.pom'. Received status code 400 from server: Bad Request
 

0个回复
CSDdjudjjd
布鲁氏菌抗体阳性
18小时前发布
  • spring
  • mysql
  • eclipse
  • jar

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.mybatis.spring.SqlSessioSqnFactoryBean] for bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.mybatis.spring.SqlSessioSqnFactoryBean
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1385)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:641)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1007)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:741)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    at com.haust.test.UserTest.init(UserTest.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.ClassNotFoundException: org.mybatis.spring.SqlSessioSqnFactoryBean
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:401)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1432)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1377)
    ... 37 more

1个回复
qq_40424583
qq_40424583
18小时前发布
  • android-studio
  • android
  • java
  • 开发语言

最近在学着写个带有左侧菜单栏的 APP,用 Android Studio 建了一个 navigation drawer activity,在源码基础上改了改。 大概长这样

然后有个需求是,点其中一个菜单项,先跳转到一个弹窗在几个类型中选一下,然后再展示一个对应的 fragment 。为了这个在中间加的步骤,所以我把其中一个菜单项和他对应的 fragment 解绑了,然后给那个 item 绑了一个新 activity 作为 dialog,选择完成后再 finish 掉,并回调到原来的 activity,展示新 fragment 。

如图,点一下用作选择的按钮,结果如下:

这时候出了两问题:

一 .我是直接通过用 FragmentTransaction replace 了原本的 fragment,但是这里出现了 fragment 重叠的现象。 源码是不会出现重叠问题的,它好像也不是用这种动态加载的方式搞的,但是它的那些工具类让我实在搞不懂。

二.

我 finish 掉作为 dialog 的新 activity 后,回调到原本 activity,它虽然已经更换了 fragment,但是左侧的菜单项依然处于打开状态,还需要再点击屏幕其他地方,把它关掉,就感觉多此一举了。有啥办法直接回到主页面时不展示左侧菜单项。难道要搞个模仿屏幕点击事件吗?

希望有人能替我解决一下疑惑,不胜感激

0个回复
pataka
pataka
18小时前发布
  • selenium
  • java
  • jar
  • 测试用例

请问JMeter 5.3.0 启动报如下错是为啥?

java.lang.ClassNotFoundException: org.apache.jmeter.JMeter
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.apache.jmeter.NewDriver.main(NewDriver.java:255)
JMeter home directory was detected as: D:\Program Files\apache-jmeter-5.3

 

Java 版本:

java version "1.8.0_74"
Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

0个回复
m0_52834638
m0_52834638
19小时前发布
  • java

eclipse的控制台怎么调也调不出来 1:Window——Show View——Console,试过没用 2: eclipse重启无用 3:键盘同时按下:Alt + Shift + Q,松开后会在右下角出现一个框,用方向键控制,选中:Show View(Cinsole),最后回车,也试过没用 然后写代码运行时,控制台console会有一闪而过的no console to display at this time,是怎么回事?

0个回复
qq_35527498
qq_35527498
19小时前发布
  • java

设计一个通用的排序算法,作为验证,自定义学生类,矩形类,可以利用该排序算法对学生按照ID以及Name进行排序;对矩形按照面积进行排序。

0个回复
weixin_40303402
ljc9090
21小时前发布
  • java

订单查询接口可以调用,关闭接口报40006,ISV权限不足?

0个回复
hbhjsfda
袁智飞
21小时前发布
  • java
  • eclipse

package jishiben;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Font;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.EventQueue;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import javax.swing.BorderFactory;
import javax.swing.JFileChooser;

import javax.swing.JFrame;

import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.KeyStroke;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;

import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JSeparator;
import com.jgoodies.forms.factories.DefaultComponentFactory;

public class jishiben extends JFrame {

    private JPanel contentPane;
    private JMenuItem menuOpen;
    private JMenuItem menuSave;
    private JMenuItem menuSaveAs;
    private JMenuItem menuClose;
    private JMenu editMenu;
    private JMenuItem menuCut;
    private JMenuItem menuCopy;
    private JMenuItem menuPaste;
    private JMenuItem menuAbout;

    private JTextArea textArea;
    private JLabel stateBar;
    private JFileChooser fileChooser;

     private JPopupMenu popUpMenu;
    /**
     * Launch the application.
     */
     
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        jishiben frame = new jishiben();
                        frame.setUpEventListener();
                        frame.setVisible(true);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
            
        }
    /**
     * Create the frame.
     */
    public jishiben() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 450, 300);
        
        JMenuBar menuBar = new JMenuBar();
        setJMenuBar(menuBar);
        
        JMenu fileMenu = new JMenu("文件");
        menuBar.add(fileMenu);
        
        JMenuItem menuOpen = new JMenuItem("打开");
        fileMenu.add(menuOpen);
        
        JSeparator separator = new JSeparator();
        fileMenu.add(separator);
        
        JMenuItem menuSave = new JMenuItem("保存");
        fileMenu.add(menuSave);
        
        JMenuItem menuSaveAs = new JMenuItem("另存为");
        fileMenu.add(menuSaveAs);
        
        JSeparator separator_1 = new JSeparator();
        fileMenu.add(separator_1);
        
        JMenuItem menuClose = new JMenuItem("关闭");
        fileMenu.add(menuClose);
        
        JMenu editSave = new JMenu("编辑");
        menuBar.add(editSave);
        
        JMenuItem menuCut = new JMenuItem("剪切");
        editSave.add(menuCut);
        
        JMenuItem menuCopy = new JMenuItem("复制");
        editSave.add(menuCopy);
        
        JMenuItem menuPaste = new JMenuItem("粘贴");
        editSave.add(menuPaste);
        
        JMenu aboutMenu = new JMenu("关于");
        menuBar.add(aboutMenu);
        
        JMenuItem menuAbout = new JMenuItem("关于JNotePad");
        aboutMenu.add(menuAbout);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        contentPane.setLayout(new BorderLayout(0, 0));
        setContentPane(contentPane);
        
        JPanel panel = new JPanel();
        contentPane.add(panel, BorderLayout.CENTER);
        
        JTextArea textArea = new JTextArea();
        textArea.setRows(8);
        textArea.setColumns(50);
        panel.add(textArea);
        
        JLabel stateBar = DefaultComponentFactory.getInstance().createTitle("\u672A\u4FEE\u6539");
        contentPane.add(stateBar, BorderLayout.SOUTH);
    }
    private void setUpEventListener() {
     // 按下窗口关闭钮事件处理
     addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {closeFile();}});
     // 菜单 - 打开
     menuOpen.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {openFile();}});
    // 菜单 - 保存
     menuSave.addActionListener(
             new ActionListener() {
             public void actionPerformed(ActionEvent e) {
             saveFile();
             }});
    // 菜单 - 另存为
     menuSaveAs.addActionListener(
     new ActionListener() {
     public void actionPerformed(ActionEvent e) {
     saveFileAs();
     }});
    // 菜单 - 关闭文件
     menuClose.addActionListener(
     new ActionListener() {
     public void actionPerformed(ActionEvent e) {
     closeFile();
     }});
    // 菜单 - 剪切
     menuCut.addActionListener(
     new ActionListener() {
     public void actionPerformed(ActionEvent e) {
     cut();
     }});
     // 菜单 - 复制
     menuCopy.addActionListener(
     new ActionListener() {
     public void actionPerformed(ActionEvent e) {
     copy();
     }});
    // 菜单 - 粘贴
     menuPaste.addActionListener(
             new ActionListener() {
             public void actionPerformed(ActionEvent e) {
             paste();
             }});

             // 菜单 - 关于
             menuAbout.addActionListener(
             new ActionListener() {
             public void actionPerformed(ActionEvent e) {
             // 显示对话框
             JOptionPane.showOptionDialog(null,
             "程序名称:\n JNotePadUI \n" +
             "程序设计:\n \n" +
             "简介:\n 一个简单的文字编辑器\n" +
             " 可作为验收 Java 的实现对象\n" +
             " /"," 关 于 JNotePadUI", JOptionPane.DEFAULT_OPTION,
            JOptionPane.INFORMATION_MESSAGE, null, null, null);
             }});
            // 编辑区键盘事件
             textArea.addKeyListener(
             new KeyAdapter() {
             public void keyTyped(KeyEvent e) {
             processTextArea();
             }});
             // 编辑区鼠标事件
             textArea.addMouseListener(
             new MouseAdapter() {
             public void mouseReleased(MouseEvent e) {
             if(e.getButton() == MouseEvent.BUTTON3)
             popUpMenu.show(editMenu, e.getX(), e.getY());
             }
             public void mouseClicked(MouseEvent e) {
             if(e.getButton() == MouseEvent.BUTTON1)
             popUpMenu.setVisible(false);
             }});

    }
    private void openFile() {
         if(isCurrentFileSaved()) { // 文件是否为保存状态
             open(); // 打开
         } 
         else {
         // 显示对话框
             int option = JOptionPane.showConfirmDialog(null, "文件已修改,是否保存?", "保存文件?", JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE, null);
             switch(option) {
             // 确认文件保存
             case JOptionPane.YES_OPTION:
                 saveFile(); // 保存文件
                 break;
                 // 放弃文件保存
             case JOptionPane.NO_OPTION:
                 open();
                 break;
             }
        }
    }
    private boolean isCurrentFileSaved() {
         if(stateBar.getText().equals("未修改")) {
             return false; 
         }
         else {
             return true;
         } 
    }
    private void open() {
         // fileChooser 是 JFileChooser 的实例
         // 显示文件选取的对话框
         int option = fileChooser.showDialog(null, null);

         // 使用者按下确认键
         if(option == JFileChooser.APPROVE_OPTION) {
         try {
         // 开启选取的文件
         BufferedReader buf =
         new BufferedReader(
         new FileReader(
         fileChooser.getSelectedFile()));
         // 设定文件标题
         setTitle(fileChooser.getSelectedFile().toString());
         // 清除前一次文件
         textArea.setText("");
         // 设定状态栏
         stateBar.setText("未修改");
         // 取得系统相依的换行字符
         String lineSeparator = System.getProperty("line.separator");
         // 读取文件并附加至文字编辑区
         String text;
         while((text = buf.readLine()) != null) {
         textArea.append(text);
         textArea.append(lineSeparator);
         }
         buf.close();
         } catch(IOException e) {
         JOptionPane.showMessageDialog(null,
        e.toString(),
         "开启文件失败", JOptionPane.ERROR_MESSAGE);
         } } }
         private void saveFile() {
         // 从标题栏取得文件名称
         File file = new File(getTitle());
         // 若指定的文件不存在
         if(!file.exists()) {
         // 执行另存为
         saveFileAs();
         } else {
         try {
         // 开启指定的文件
         BufferedWriter buf =
         new BufferedWriter(
         new FileWriter(file));
         // 将文字编辑区的文字写入文件
         buf.write(textArea.getText());
         buf.close();
         // 设定状态栏为未修改
         stateBar.setText("未修改");
         } catch(IOException e) {
         JOptionPane.showMessageDialog(null, e.toString(),
         "写入文件失败", JOptionPane.ERROR_MESSAGE);
         } } }
    private void saveFileAs() {
             // 显示文件对话框
             int option = fileChooser.showSaveDialog(null);
             // 如果确认选取文件
             if(option == JFileChooser.APPROVE_OPTION) {
             // 取得选择的文件
             File file = fileChooser.getSelectedFile();

             // 在标题栏上设定文件名称
             setTitle(file.toString());

             try {
             // 建立文件
             file.createNewFile();
             // 进行文件保存
             saveFile();
             } catch(IOException e) {
             JOptionPane.showMessageDialog(null, e.toString(),
             "无法建立新文件", JOptionPane.ERROR_MESSAGE);
             } } }
    private void closeFile() {
         // 是否已保存文件
         if(isCurrentFileSaved()) {
         // 释放窗口资源,而后关闭程序
         dispose();
         } else {
         int option = JOptionPane.showConfirmDialog(
         null, "文件已修改,是否保存?",
         "保存文件?", JOptionPane.YES_NO_OPTION,
         JOptionPane.WARNING_MESSAGE, null);
         switch(option) {
         case JOptionPane.YES_OPTION:
         saveFile();
         break;
         case JOptionPane.NO_OPTION:
         dispose();
         } } }
    private void cut() {
         textArea.cut();
         stateBar.setText("已修改");
         popUpMenu.setVisible(false);
         }
    private void copy() {
         textArea.copy();
         popUpMenu.setVisible(false);
         }
    private void paste() {
         textArea.paste();
         stateBar.setText("已修改");
         popUpMenu.setVisible(false);
        }
    private void processTextArea() {
         stateBar.setText("已修改"); }
}


    

java.lang.NullPointerException
    at jishiben.jishiben.setUpEventListener(jishiben.java:150)
    at jishiben.jishiben$1.run(jishiben.java:73)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

0个回复
weixin_46407579
不懂剑来陈貂寺
22小时前发布
  • java

分布式微服务框架,多语言开发效率为主好,还是单一语言开发维护容易好

1个回复
DolphinScheduler
DolphinScheduler社区
22小时前发布
  • java

1,首先通过 jps 查看 WorkerServer 服务是否存在,或者从服务监控直接查看 zk 中是否存在 worker 服务

​2,如果 WorkerServer 服务正常,需要 查看 MasterServer 是否把 task 任务放到 zk 队列中 ,需要查看 MasterServer 日志及 zk 队列中是否有任务阻塞

​ 3,如果以上都没有问题,需要定位是否指定了 Worker 分组,但是 Worker 分组的机器不是在线状态

0个回复
weixin_51093972
菜鸡的菜鸡
23小时前发布
  • java












import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections;

import javax.swing.JButton;
import javax.swing.JTextArea;

public class MyActionListener implements ActionListener {
     JButton[] bnte;
     JTextArea jte;
     String str="0";
	public MyActionListener(JButton[] bnte, JTextArea jte) {
		this.bnte=bnte;
		this.jte=jte;
	}
//-------------------------------------------------
	public void actionPerformed(ActionEvent e) {
		for(int i=5;i<bnte.length;i++) {
		if(e.getSource()==bnte[i]) {
		   str+=bnte[i].getText();
		}
	    }
		if(str.charAt(0)=='0'){
			String temp="";
			for(int i=0;i<str.length();i++) {
				if(str.charAt(i)!='0'&&Character.isDigit(str.charAt(i))) {
				    for(int j=i;j<str.length();j++) 
				    	temp+=str.charAt(j);
				    	break;
				    } else if(str.charAt(i)!='0'&&str.charAt(i)=='.') {
				    	String temp1="0";
				    	temp+=temp1;
				    	for(int j=i;j<str.length();j++)
				    		temp+=str.charAt(j);
				    	break;
				    }
				}
	//-----------------------------------------------------		
			if(temp.length()==0) {
				temp+="             0";
				jte.setText(temp);
			}else {
				while(temp.length()<15)
					temp=" "+temp;
				
				temp=temp.substring(0, 15);
				jte.setText("\n\n"+temp);
			}
		}else {
			jte.setText("\n\n"+str);
		}
//-----------------------------------------------------------
		if(e.getSource()==bnte[6]||e.getSource()==bnte[7]) {
			str="0";
			jte.setText("\n\n0");
		}
//-------------------------------------------------------------
		if(e.getSource()==bnte[26]) {
			double x=Double.parseDouble(str);
			if(x!=0) {
				String temp=""+(1/x);
				while(temp.length()<15) 
			    	temp=" "+temp;
				
				temp=temp.substring(0, 15);
				jte.setText(temp);
			}
			else
				jte.setText("null");
		}
	//--------------------------------------------------------------------------	
		String et="0";
		if(e.getSource()==bnte[5]&&!str.equals(et)) {
			str=str.substring(1, str.length()-1);
			jte.setText(" \n\n"+str);
		}
//-----------------------------------------------------------
		if (e.getSource()==bnte[27]) {
			if(str.indexOf("+")!=-1) {
				int i=str.indexOf("+");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1, str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d1+d;
				jte.setText(""+d2);
			}
			else if(str.indexOf("-")!=-1) {
				int i=str.indexOf("-");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1,str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d-d1;
				jte.setText(" "+d2);
			}
			else if(str.indexOf("*")!=-1) {
				int i=str.indexOf("*");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1,str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d*d1;
				jte.setText(" "+d2);
		}
			else if(str.indexOf("/")!=-1) {
				int i=str.indexOf("/");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1,str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d/d1;
				jte.setText(" "+d2);
			
		}
			}
		
	}	
//---------------------------------------------------------
    public static void main(String[] args) {
	    new ApiHomework();

    }
}













import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections;

import javax.swing.JButton;
import javax.swing.JTextArea;

public class MyActionListener implements ActionListener {
     JButton[] bnte;
     JTextArea jte;
     String str="0";
	public MyActionListener(JButton[] bnte, JTextArea jte) {
		this.bnte=bnte;
		this.jte=jte;
	}
//-------------------------------------------------
	public void actionPerformed(ActionEvent e) {
		for(int i=5;i<bnte.length;i++) {
		if(e.getSource()==bnte[i]) {
		   str+=bnte[i].getText();
		}
	    }
		if(str.charAt(0)=='0'){
			String temp="";
			for(int i=0;i<str.length();i++) {
				if(str.charAt(i)!='0'&&Character.isDigit(str.charAt(i))) {
				    for(int j=i;j<str.length();j++) 
				    	temp+=str.charAt(j);
				    	break;
				    } else if(str.charAt(i)!='0'&&str.charAt(i)=='.') {
				    	String temp1="0";
				    	temp+=temp1;
				    	for(int j=i;j<str.length();j++)
				    		temp+=str.charAt(j);
				    	break;
				    }
				}
	//-----------------------------------------------------		
			if(temp.length()==0) {
				temp+="             0";
				jte.setText(temp);
			}else {
				while(temp.length()<15)
					temp=" "+temp;
				
				temp=temp.substring(0, 15);
				jte.setText("\n\n"+temp);
			}
		}else {
			jte.setText("\n\n"+str);
		}
//-----------------------------------------------------------
		if(e.getSource()==bnte[6]||e.getSource()==bnte[7]) {
			str="0";
			jte.setText("\n\n0");
		}
//-------------------------------------------------------------
		if(e.getSource()==bnte[26]) {
			double x=Double.parseDouble(str);
			if(x!=0) {
				String temp=""+(1/x);
				while(temp.length()<15) 
			    	temp=" "+temp;
				
				temp=temp.substring(0, 15);
				jte.setText(temp);
			}
			else
				jte.setText("null");
		}
	//--------------------------------------------------------------------------	
		String et="0";
		if(e.getSource()==bnte[5]&&!str.equals(et)) {
			str=str.substring(1, str.length()-1);
			jte.setText(" \n\n"+str);
		}
//-----------------------------------------------------------
		if (e.getSource()==bnte[27]) {
			if(str.indexOf("+")!=-1) {
				int i=str.indexOf("+");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1, str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d1+d;
				jte.setText(""+d2);
			}
			else if(str.indexOf("-")!=-1) {
				int i=str.indexOf("-");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1,str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d-d1;
				jte.setText(" "+d2);
			}
			else if(str.indexOf("*")!=-1) {
				int i=str.indexOf("*");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1,str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d*d1;
				jte.setText(" "+d2);
		}
			else if(str.indexOf("/")!=-1) {
				int i=str.indexOf("/");
				String s1=str.substring(0, i);
				String s2=str.substring(i+1,str.length());
				Double d=Double.parseDouble(s1.trim());
				Double d1=Double.parseDouble(s2.trim());
				double d2=d/d1;
				jte.setText(" "+d2);
			
		}
			}
		
	}	
//---------------------------------------------------------
    public static void main(String[] args) {
	    new ApiHomework();

    }
}

 

0个回复
weixin_42880655
刘得花
23小时前发布
  • java

两个@FeignClient 接口, A 和 B

代码中有大量的if

if(type="A"){

    return A.xxx();

}else{

    return B.xxx();

}

该如何优化?  求大佬解答

 

 

 

2个回复