Unable to read class [XXXXXXX]} java.lang. ArrayIndexOutOfBoundsException

2021/12/17 17:19:56

本文主要是介绍Unable to read class [XXXXXXX]} java.lang. ArrayIndexOutOfBoundsException,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

  • Java代码
@Component
public class FcmHelper {
    private static final Logger log = LoggerFactory.getLogger(FcmHelper.class);

    private static String APP_ID = "";
    private static String SECRET_KEY = "";
    private static String CHECK_URL = "";
    private static String QUERY_URL = "";
    private static String REPORT_URL = "";

    private static final Integer REQ_SUCCESS = 0;
    private static final Integer AUTHING = 1;
    private static final String UTF8 = "UTF-8";

    private Long FLAG_TIMESTAMP = 0L;//时间上报里程碑
    private final static Integer DURATION = 120 * 1000;//每组行为数据最早行为发生时间与数据上报时间的差值,规定180秒,取120秒
    private final static Integer MAX = 300;//最大发送条数,规定128条,单集群3个节点的情况下取40条

    /**
     * 每秒钟检查是否需要提交
     * 提交情况(限定在一秒内):
     * 1、提交列表行为条数 < MAX
     * 2、最后一条数据发生的时间 < 上报的时间 <(第一条数据发生的时间 +DURATION)
     */
    @Scheduled(cron = "* * * * * ?")
    public void ifNeedSumbit() {
        for (Map.Entry<String, List<GameActionRequest>> entry : gameMaps.entrySet()) {
            ...
            ...
            ...
            if (lastTs <= now && now <= firstTs + DURATION) {
                if (number < MAX) {
                    report(bizId);
                } else {
                    requests.removeIf(request -> request.getNo() <= MAX);
                    requests.replaceAll(request -> {
                        request.setNo(request.getNo() - MAX);
                        return request;
                    });
                    gameMaps.put(bizId, requests);
                    report(bizId);
                }
            } else {
                gameMaps.get(bizId).clear();
            }

        }
    }
  
  					...
            ...
            ...

}

  • 日志报错
2021-12-17 16:40:17  ERROR [com.opensymphony.xwork2.util.logging.commons.CommonsLogger] - {Unable to read class [com.xysdk.api.job.callback.CallbackMonitor]}
java.lang.ArrayIndexOutOfBoundsException: 52264
	at org.objectweb.asm.xwork.ClassReader.readClass(Unknown Source)
	at org.objectweb.asm.xwork.ClassReader.accept(Unknown Source)
	at org.objectweb.asm.xwork.ClassReader.accept(Unknown Source)
	at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:764)
	at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:149)
	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:352)
	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:317)
	at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.init(StrutsPrepareFilter.java:50)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:106)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4554)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5194)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
	at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1767)
	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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:286)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483)
	at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
	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.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:286)
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
	at com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
	at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
	at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
	at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1408)
	at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
	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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
	at sun.rmi.transport.Transport$1.run(Transport.java:200)
	at sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
  • 原因:struts2所需依赖包asm低版本和java8 Lambda表达式不兼容

  • 解决:不适用Lambda表达式,或者升级依赖版本



这篇关于Unable to read class [XXXXXXX]} java.lang. ArrayIndexOutOfBoundsException的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程