wildly 10如何设置临时文件创建权限

How to set temporary file creation permission in wildly 10

我在 standalone.xml 中使用以下配置在 wildly 10 中启用了安全管理器,但是当我开始 wildly 10 应用程序服务器时出现以下异常(添加了完整的异常日志):

   13:49:50,667 INFO  [com.sun.jersey.server.impl.application.WebApplicationImpl] (ServerService Thread Pool -- 57) Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
13:49:51,229 SEVERE [com.sun.jersey.core.spi.component.ProviderFactory] (ServerService Thread Pool -- 57) The provider class, class com.sun.jersey.multipart.impl.MultiPartReaderServerSide, could not b
e instantiated. Processing will continue but the class will not be utilized: java.lang.SecurityException: Unable to create temporary file
        at java.io.File.createTempFile(File.java:2018)
        at java.io.File.createTempFile(File.java:2070)
        at com.sun.jersey.multipart.impl.MultiPartReaderClientSide.createMimeConfig(MultiPartReaderClientSide.java:121)
        at com.sun.jersey.multipart.impl.MultiPartReaderClientSide.<init>(MultiPartReaderClientSide.java:109)
        at com.sun.jersey.multipart.impl.MultiPartReaderServerSide.<init>(MultiPartReaderServerSide.java:71)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:210)
        at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:180)
        at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:166)
        at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
        at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:283)
        at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:163)
        at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:176)
        at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:162)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1338)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.access0(WebApplicationImpl.java:180)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.f(WebApplicationImpl.java:799)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.f(WebApplicationImpl.java:795)
        at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
        at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:509)
        at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:339)
        at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605)
        at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207)
        at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:394)
        at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:577)
        at javax.servlet.GenericServlet.init(GenericServlet.java:244)
        at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
        at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
        at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
        at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:231)
        at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:132)
        at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:526)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
        at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.run(UndertowDeploymentService.java:82)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
        at org.jboss.threads.JBossThread.run(JBossThread.java:320)

我的产品开发环境是-jdk8,jersey 1.19.1和wildly 10。谁能帮我解决我哪里出错了?

<subsystem xmlns="urn:jboss:domain:security-manager:1.0">
            <deployment-permissions>
                <minimum-set>
                    <permission class="java.lang.RuntimePermission" name="getClassLoader" actions="read,write"/>
                    <permission class="java.lang.reflect.ReflectPermission" name="suppressAccessChecks" actions="read,write"/>
                    <permission class="java.util.PropertyPermission" name="*" actions="read"/>
                    <permission class="java.lang.RuntimePermission" name="accessClassInPackage.sun.reflect" actions="read,write"/>
                    <permission class="java.lang.RuntimePermission" name="accessDeclaredMembers" actions="read,write"/>
                    <permission class="java.lang.RuntimePermission" name="shutdownHooks"/>
                    <permission class="javax.management.MBeanPermission" name="*" actions="queryNames"/>
                    <permission class="javax.management.MBeanServerPermission" name="*"/>
                    <permission class="javax.management.MBeanPermission" name="*" actions="registerMBean"/>
                    <permission class="javax.management.MBeanTrustPermission" name="*"/>
                    <permission class="java.io.FilePermission" name="*" actions="read,write"/>
                </minimum-set>
            </deployment-permissions>
        </subsystem>

File.createTempFile() 正试图在 java.io.tmpdir 设置的目录中创建文件。在 FilePermission 中,当您使用 * 作为名称时,它表示 "all files in the current directory"。您可能需要的是 <<ALL FILES>> 作为名称。

<permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write,delete"/>