Anylogic仿真 - 模型创建期间的错误
Posted
技术标签:
【中文标题】Anylogic仿真 - 模型创建期间的错误【英文标题】:Anylogic simulation - Error during Model creation 【发布时间】:2021-04-28 17:39:09 【问题描述】:我正在尝试运行此处提供的机器学习和 Anylogic 模拟示例工作流。 - https://www.anylogic.com/features/artificial-intelligence/h2o-ai/ 我可以运行第二个工作流程,但第一个工作流程(医院规划)不断出错。我也试过在不同的系统上运行它。
我们将不胜感激。
以下是错误代码:
加载 Mojo:pipeline.mojo
Loading Mojo: pipeline.mojo
Error during model creation:
Unable to make protected final java.lang.Class
java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to
unnamed module @44f69442
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class
java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to
unnamed module @44f69442
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:198)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:192)
at javassist.util.proxy.SecurityActions.setAccessible(SourceFile:159)
at javassist.util.proxy.DefineClassHelper$JavaOther.defineClass(SourceFile:213)
at javassist.util.proxy.DefineClassHelper$Java11.defineClass(SourceFile:52)
at javassist.util.proxy.DefineClassHelper.toClass(SourceFile:260)
at javassist.ClassPool.toClass(SourceFile:1232)
at javassist.ClassPool.toClass(SourceFile:1090)
at javassist.ClassPool.toClass(SourceFile:1048)
at javassist.CtClass.toClass(SourceFile:1290)
at ai.h2o.mojos.runtime.c.G.d(SourceFile:118)
at ai.h2o.mojos.runtime.c.G.a(SourceFile:60)
at ai.h2o.mojos.runtime.c.n.a(SourceFile:64)
at ai.h2o.mojos.runtime.readers.b.b.a(SourceFile:135)
at ai.h2o.mojos.runtime.MojoPipelineFactoryImpl.loadFrom(SourceFile:144)
at ai.h2o.mojos.runtime.MojoPipelineFactoryImpl.loadFrom(SourceFile:101)
at ai.h2o.mojos.runtime.MojoPipeline.loadFrom(SourceFile:41)
at hospital_capacity_planning_ml.Main.loadModel(Main.java:690)
at hospital_capacity_planning_ml.Main.setupPlainVariables_Main_xjal(Main.java:1498)
at hospital_capacity_planning_ml.Main.doCreate(Main.java:1421)
at com.anylogic.engine.Agent.createAsEmbedded(Unknown Source)
at com.anylogic.engine.Agent.create(Unknown Source)
at com.anylogic.engine.Engine.start(Unknown Source)
at com.anylogic.engine.ExperimentSimulation.a(Unknown Source)
at com.anylogic.engine.ExperimentSimulation.run(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost.f(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost.executeCommand(Unknown Source)
at com.anylogic.engine.internal.webserver.e.onCommand(Unknown Source)
at com.anylogic.executor.basic.rest.BasicAnimationSessionController.
lambda$null$9(BasicAnimationSessionController.java:112)
at com.anylogic.engine.internal.webserver.i.acceptToAnimationSvgSession(Unknown Source)
at com.anylogic.executor.basic.rest.BasicAnimationSessionController.
lambda$startController$10(BasicAni mationSessionController.java:112)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at com.anylogic.engine.internal.webserver.config.ALServerFactory$1.lambda$0(Unknown Source)
at org.eclipse.jetty.servlets.QoSFilter.doFilter(QoSFilter.java:201)
at com.anylogic.engine.internal.webserver.config.ALServerFactory$1.doHandle(Unknown Source)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:530)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
atorg.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java
:382)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.base/java.lang.Thread.run(Thread.java:834)
Error during drawing animation frame:
java.lang.NullPointerException
at com.anylogic.engine.gui.SVGFrameProducer.n(Unknown Source)
at com.anylogic.engine.gui.SVGFrameProducer.n(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost$1.l(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost$1.n(Unknown Source)
at com.anylogic.engine.gui.SVGFrameCollector.l(Unknown Source)
at com.anylogic.engine.gui.SVGFrameCollector.c(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:834)
【问题讨论】:
【参考方案1】:问题是 AnyLogic 8.7 切换到更新的 Java(从 9 到 11)。 将以下行添加到实验属性中的 Java 机器参数,以使模型在最近的更新 8.7.x 中工作:
--add-opens java.base/java.lang=ALL-UNNAMED
【讨论】:
非常感谢您的回复。我在我的 analylogic.ini 文件中添加了上述行,但仍然出现相同的错误。我还需要在其他位置添加此命令吗? 请打开“Simulation: Main”实验的属性,找到“Advanced Java”部分并将行添加到标题为“Java machine arguments”的字段中以上是关于Anylogic仿真 - 模型创建期间的错误的主要内容,如果未能解决你的问题,请参考以下文章