gpt4 book ai didi

exception - 加载文件 struts-default.xml 时捕获异常

转载 作者:行者123 更新时间:2023-12-04 19:04:44 25 4
gpt4 key购买 nike

我对 Java 并不陌生。我以前用它做过很多事情。但是我正在从 PHP 迁移到 Java Servlet/JSP(我是新手),我无法弄清楚这个错误来挽救我的生命。我使用 Ubuntu 9.04 的 Synaptic 包管理器安装了 Tomcat6,它的运行就像一个魅力。但是当我将 struts 放入我的 WEB-INF/lib 目录并尝试制作一个 struts 应用程序时,我在日志文件中得到以下内容。

我使用struts-blank.war 启动项目,所以web.xml 与struts 2.1.8.1 中提供的相同。

读取 struts-default.xml 文件似乎存在一些问题。

提前致谢

SEVERE: Exception starting filter struts2 Unable to load configuration. - Class: java.security.AccessControlContext File: AccessControlContext.java Method: checkPermission Line: 342 - java/security/AccessControlContext.java:342:-1 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:123) at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:145) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:769) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177) Caused by: Unable to load configuration. - Class: java.security.AccessControlContext File: AccessControlContext.java Method: checkPermission Line: 342 - java/security/AccessControlContext.java:342:-1 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418) ... 36 more Caused by: Caught exception while loading file struts-default.xml - Class: java.security.AccessControlContext File: AccessControlContext.java Method: checkPermission Line: 342 - java/security/AccessControlContext.java:342:-1 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:902) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:143) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:110) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:168) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55) ... 38 more Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission xwork.saxParserFactory read) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:342) at java.security.AccessController.checkPermission(AccessController.java:553) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302) at java.lang.System.getProperty(System.java:669) at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:78) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:893) ... 42 more

最佳答案

我有一个头脑 Storm ,并自己解决了这个问题。虽然我不认为这是最安全的解决方案,但它适用于我的目的,我并不担心,因为它是一个仅监听环回接口(interface) (127.0.0.1) 的本地开发服务器。

无论如何,解决方案是将其添加到/etc/tomcat6/policy.d/50local.policy 的底部

grant codeBase "file:${catalina.base}/webapps/-" { permission java.security.AllPermission; };

关于exception - 加载文件 struts-default.xml 时捕获异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2016855/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com