java - FileAccessException in Struts2 with Google AppEngine -
i trying integrate struts2 google appengine. following steps codeproject link here
the code compiles fine when access localhost:8888 throws following fileaccessexception
warning: / java.security.accesscontrolexception: access denied ("java.io.filepermission" "jar:file:\e:\appenginesampleproject\war\web-inf\lib\struts2-core-2.3.14.2.jar" "read") @ java.security.accesscontrolcontext.checkpermission(accesscontrolcontext.java:366) @ java.security.accesscontroller.checkpermission(accesscontroller.java:560) @ java.lang.securitymanager.checkpermission(securitymanager.java:549) @ com.google.appengine.tools.development.devappserverfactory$customsecuritymanager.checkpermission(devappserverfactory.java:383) @ java.lang.securitymanager.checkread(securitymanager.java:888) @ java.util.zip.zipfile.<init>(zipfile.java:205) @ java.util.zip.zipfile.<init>(zipfile.java:144) @ java.util.jar.jarfile.<init>(jarfile.java:153) @ java.util.jar.jarfile.<init>(jarfile.java:90) @ com.opensymphony.xwork2.util.fs.jarentryrevision.needsreloading(jarentryrevision.java:76) @ com.opensymphony.xwork2.util.fs.defaultfilemanager.fileneedsreloading(defaultfilemanager.java:66) @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.needsreload(xmlconfigurationprovider.java:394) @ org.apache.struts2.config.strutsxmlconfigurationprovider.needsreload(strutsxmlconfigurationprovider.java:169) @ com.opensymphony.xwork2.config.configurationmanager.needreloadcontainerproviders(configurationmanager.java:215) @ com.opensymphony.xwork2.config.configurationmanager.conditionalreload(configurationmanager.java:179) @ com.opensymphony.xwork2.config.configurationmanager.getconfiguration(configurationmanager.java:73) @ org.apache.struts2.dispatcher.dispatcher.getcontainer(dispatcher.java:942) @ org.apache.struts2.dispatcher.ng.prepareoperations.createactioncontext(prepareoperations.java:77) @ org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:78) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.api.socket.dev.devsocketfilter.dofilter(devsocketfilter.java:74) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.responserewriterfilter.dofilter(responserewriterfilter.java:123) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.headerverificationfilter.dofilter(headerverificationfilter.java:34) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.api.blobstore.dev.serveblobfilter.dofilter(serveblobfilter.java:63) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.apphosting.utils.servlet.transactioncleanupfilter.dofilter(transactioncleanupfilter.java:43) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.staticfilefilter.dofilter(staticfilefilter.java:125) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ com.google.appengine.tools.development.devappservermodulesfilter.dodirectrequest(devappservermodulesfilter.java:368) @ com.google.appengine.tools.development.devappservermodulesfilter.dodirectmodulerequest(devappservermodulesfilter.java:351) @ com.google.appengine.tools.development.devappservermodulesfilter.dofilter(devappservermodulesfilter.java:116) @ org.mortbay.jetty.servlet.servlethandler$cachedchain.dofilter(servlethandler.java:1157) @ org.mortbay.jetty.servlet.servlethandler.handle(servlethandler.java:388) @ org.mortbay.jetty.security.securityhandler.handle(securityhandler.java:216) @ org.mortbay.jetty.servlet.sessionhandler.handle(sessionhandler.java:182) @ org.mortbay.jetty.handler.contexthandler.handle(contexthandler.java:765) @ org.mortbay.jetty.webapp.webappcontext.handle(webappcontext.java:418) @ com.google.appengine.tools.development.devappenginewebappcontext.handle(devappenginewebappcontext.java:97) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ com.google.appengine.tools.development.jettycontainerservice$apiproxyhandler.handle(jettycontainerservice.java:485) @ org.mortbay.jetty.handler.handlerwrapper.handle(handlerwrapper.java:152) @ org.mortbay.jetty.server.handle(server.java:326) @ org.mortbay.jetty.httpconnection.handlerequest(httpconnection.java:542) @ org.mortbay.jetty.httpconnection$requesthandler.headercomplete(httpconnection.java:923) @ org.mortbay.jetty.httpparser.parsenext(httpparser.java:547) @ org.mortbay.jetty.httpparser.parseavailable(httpparser.java:212) @ org.mortbay.jetty.httpconnection.handle(httpconnection.java:404) @ org.mortbay.io.nio.selectchannelendpoint.run(selectchannelendpoint.java:409) @ org.mortbay.thread.queuedthreadpool$poolthread.run(queuedthreadpool.java:582)
my struts.xml file
<?xml version="1.0" encoding="utf-8" ?> <!doctype struts public "-//apache software foundation//dtd struts configuration 2.0//en" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.action.excludepattern" value="/_ah/.*"/> <constant name="struts.devmode" value="false" /> <constant name="struts.configuration.xml.reoload" value="false"></constant> <package name="default" extends="struts-default"> <default-action-ref name="index"/> <action name="index" class="org.hanbo.sample.helloworld"> <result name="success">/jsp/helloworld.jsp</result> </action> </package> </struts>
and web.xml file
<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <filter> <filter-name>struts2</filter-name> <filter-class>org.hanbo.sample.gaeprepareandexecutefilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>com.struts2.gae.listener.ognllistener</listener-class> </listener> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> </web-app>
i have tried put
<constant name="struts.devmode" value="false" />
but exception still there. please help.
as first step try this:
but aware unsafe , see if reason current problem! may try while beeing offline , imediatly remove after test!
go jre installed = {jre_home} go subfolder:
/lib/security/java.policy (e.g. {jre_home}/lib/security/java.policy)
inside file add: grant { permission java.security.allpermission; };
this allow programm executed jvm basicially anything!
so if should work know has java-permissions have read , configure according needs.
in case needs never grant above general permission make sure not leave above entry in java.policy files after quick check if that!
Comments
Post a Comment