Oh sorry, forgot to mention that your project is also set up for
deploying to App Engine, and that is why this restriction is being
placed on you.  If you have no intent of using App Engine, then you
can remove that support from your project:  Right click on your
project, go to "Properties", expand "Google" on the left, click on
"App Engine", and then uncheck the "Use Google App Engine" checkbox.

jason

On Fri, May 8, 2009 at 11:41 AM, Jason Parekh <[email protected]> wrote:
> Hi Kard,
>
> Writing to files is not supported on App Engine, check out this FAQ:
> http://code.google.com/appengine/kb/java.html#writefile
>
> jason
>
>
> On Fri, May 8, 2009 at 11:29 AM, Kard Raven <[email protected]> 
> wrote:
>>
>> Good morning,
>>
>>
>> I'm using Google Web Toolkit for two weeks, and now, i'm trying to
>> make my own applications.
>> However, there is something wrong with the last one :
>>
>>
>>
>> I have made a client part, and a server part.
>>
>> Client part's code :
>>
>> public class project implements EntryPoint {
>>
>>
>>        public void onModuleLoad() {
>>
>>                GreetingServiceAsync service = (GreetingServiceAsync) 
>> GWT.create
>> (GreetingService.class);
>>                ((ServiceDefTarget) service).setServiceEntryPoint
>> (GWT.getModuleBaseURL () + "server");
>>                service.createXML (new AsyncCallback () {
>>                        public void onFailure (Throwable caught) {
>>                                // Traitement en cas d'erreur
>>                        } // onFailure ()
>>
>>                        public void onSuccess (Object result) {
>>                                // Traitement en cas de succès
>>                                Window.alert ((String) result);
>>                        } // onFailure ()
>>                });
>>
>>        }
>> }
>>
>>
>>
>> Code of "GreetingService.java" :
>>
>> public interface GreetingService extends RemoteService {
>>        String greetServer(String name);
>>        public void createXML ();
>> }
>>
>>
>> Code of "GreetingServiceAsync.java" :
>>
>> public interface GreetingServiceAsync {
>>        void greetServer(String input, AsyncCallback<String> callback);
>>        public void createXML (AsyncCallback callback);
>> }
>>
>>
>> Server part's code :
>>
>> public class GreetingServiceImpl extends RemoteServiceServlet
>> implements GreetingService{
>>        public void createXML () {
>>
>>                File file = new File("test.xml");
>>                try {
>>                        file.createNewFile();
>>                } catch (IOException e) {
>>                        // TODO Auto-generated catch block
>>                        e.printStackTrace();
>>                }
>>
>>
>>
>>        }
>>
>>        public String greetServer(String name) {
>>                // TODO Auto-generated method stub
>>                return null;
>>        }
>>
>>
>>
>> }
>>
>>
>>
>>
>> When I finally run the application in hosted mode, I get :
>>
>> com.google.appengine.tools.development.ApiProxyLocalImpl log
>> SEVERE: [1241796266968000] javax.servlet.ServletContext log: Exception
>> while dispatching incoming RPC call
>> com.google.gwt.user.server.rpc.UnexpectedException: Service method
>> 'public abstract void
>> com.project.project.client.GreetingService.createXML()' threw an
>> unexpected exception: java.security.AccessControlException: access
>> denied (java.io.FilePermission test.xml write)
>>        at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
>> (RPC.java:360)
>>        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
>> (RPC.java:546)
>>        at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
>> (RemoteServiceServlet.java:166)
>>        at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
>> (RemoteServiceServlet.java:86)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>> 487)
>>        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
>> (ServletHandler.java:1093)
>>        at
>> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
>> (TransactionCleanupFilter.java:43)
>>        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
>> (ServletHandler.java:1084)
>>        at org.mortbay.jetty.servlet.ServletHandler.handle
>> (ServletHandler.java:360)
>>        at org.mortbay.jetty.security.SecurityHandler.handle
>> (SecurityHandler.java:216)
>>        at org.mortbay.jetty.servlet.SessionHandler.handle
>> (SessionHandler.java:181)
>>        at org.mortbay.jetty.handler.ContextHandler.handle
>> (ContextHandler.java:712)
>>        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
>> 405)
>>        at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle
>> (DevAppEngineWebAppContext.java:54)
>>        at org.mortbay.jetty.handler.HandlerWrapper.handle
>> (HandlerWrapper.java:139)
>>        at com.google.appengine.tools.development.JettyContainerService
>> $ApiProxyHandler.handle(JettyContainerService.java:306)
>>        at org.mortbay.jetty.handler.HandlerWrapper.handle
>> (HandlerWrapper.java:139)
>>        at org.mortbay.jetty.Server.handle(Server.java:313)
>>        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
>> 506)
>>        at org.mortbay.jetty.HttpConnection$RequestHandler.content
>> (HttpConnection.java:844)
>>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
>>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
>>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
>>        at org.mortbay.io.nio.SelectChannelEndPoint.run
>> (SelectChannelEndPoint.java:396)
>>        at org.mortbay.thread.BoundedThreadPool$PoolThread.run
>> (BoundedThreadPool.java:442)
>> Caused by: java.security.AccessControlException: access denied
>> (java.io.FilePermission test.xml write)
>>        at java.security.AccessControlContext.checkPermission(Unknown Source)
>>        at java.security.AccessController.checkPermission(Unknown Source)
>>        at java.lang.SecurityManager.checkPermission(Unknown Source)
>>        at com.google.appengine.tools.development.DevAppServerFactory
>> $CustomSecurityManager.checkPermission(DevAppServerFactory.java:76)
>>        at java.lang.SecurityManager.checkWrite(Unknown Source)
>>        at java.io.File.createNewFile(Unknown Source)
>>        at com.project.project.server.GreetingServiceImpl.createXML
>> (GreetingServiceImpl.java:35)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>        at java.lang.reflect.Method.invoke(Unknown Source)
>>        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
>> (RPC.java:527)
>>        ... 25 more
>>
>>
>>
>>
>>
>>
>> I really don't know what I can do to create this file, I have heard
>> about editing java.policy, but it doesn't work.
>>
>> Thank you for helping me, and excuse me if my english is not very well
>> (I'm french).
>>
>>
>> Regards,
>> Kard.
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to