我在Anylogic 7中创建了一个模型,它从我的localhost mysql数据库中获取了一些值。它在我以独立模式导出时运行,但是当我在浏览器模式下测试时,我收到了错误消息:
CacheEntry[http://XXX.XXX.XXX.XXX/supply/com.xj.anylogic.engine.jar]:
updateAvailable=true,lastModified=Fri Oct 24 08:33:50 EEST 2014,length=1401999
CacheEntry[http://XXX.XXX.XXX.XXX/supply/model.jar]:
updateAvailable=true,lastModified=Fri Oct 24 08:33:50 EEST 2014,length=471484
0
CacheEntry[http://XXX.XXX.XXX.XXX/supply/lib/mysql-connector-java-5.1.33-bin.jar]:
updateAvailable=true,lastModified=Fri Oct 24 08:33:50 EEST 2014,length=959987
Error during model creation:
ExceptionInInitializerError
Caused by: access denied ("java.util.PropertyPermission" "file.encoding" "read")
java.lang.ExceptionInInitializerError
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:307)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.xj.anylogic.engine.connectivity.Database.a(Unknown Source)
at com.xj.anylogic.engine.connectivity.Database.getConnection(Unknown Source)
at supply_chain.Factory.instantiateBaseStructure_xjal(Factory.java:1409)
at supply_chain.Factory.<init>(Factory.java:1394)
at supply_chain.Main.instantiate_factory_xjal(Main.java:589)
at supply_chain.Main.instantiateBaseStructure_xjal(Main.java:2863)
at supply_chain.Main.<init>(Main.java:2850)
at supply_chain.Simulation.createRoot(Simulation.java:3399)
at supply_chain.Simulation.createRoot(Simulation.java:1)
at com.xj.anylogic.engine.Experiment.a(Unknown Source)
at com.xj.anylogic.engine.ExperimentSimulation.b(Unknown Source)
at com.xj.anylogic.engine.ExperimentSimulation.run(Unknown Source)
at supply_chain.Simulation.executeShapeControlAction(Simulation.java:900)
Caused by: java.security.AccessControlException: access denied
("java.util.PropertyPermission" "file.encoding" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at com.mysql.jdbc.StringUtils.<clinit>(StringUtils.java:118)
... 16 more
我不明白错误在哪里。由于JAVA安全策略,无法连接到MySQL?
答案 0 :(得分:0)
在网络小程序中使用Anylogic时,您受到的限制非常严格。 如果您查看anylogic帮助文件,Anylogic help 它说:
根据软件许可协议,您不能从Simulation Applet访问任何类型的数据库或文件。
因此您似乎必须将数据硬编码到模型中