Saturday, July 31, 2010

Re: Where can I put a File to be read/write from RPC Servlet ?

I might be missing something... but, why don't you store it in a
database?

On Jul 28, 9:31 am, Jose Luis Estrella Campaña <jlecamp...@gmail.com>
wrote:
> Katharina,
>
> Hi, and... No, I have not solved it. apparently the file and/or
> directory restrictions are ok, at least according to what I have seen,
> I wonder If there's a problem with the permissions a non-administrator
> user has in Windows vista, but otherwise the file seems to be ok.
> Frankly I don't know what else to do.
>
> Help me Katharina,
>
> Sincerely,
>
> Jose
>
> On Jul 28, 7:47 am, Katharina Probst <kpro...@google.com> wrote:
>
>
>
> > Did you get this solved? It doesn't look to me like it has anything to do
> > with GWT, but it's purely a file permission thing.  Have you set the file
> > permissions on your file properly?  Is your server-side directory somehow
> > read-restricted?
>
> > On Tue, Jul 27, 2010 at 4:25 PM, Jose Luis Estrella Campaña <
>
> > jlecamp...@gmail.com> wrote:
> > > Hello sir !
>
> > > I have already tried all the ways I mentioned previously, including
> > > the ones you suggested, but the problem remains. It is obviously
> > > according to the stack trace launched by the Exception some sort of
> > > File permission error. I would like to know what can I do about it ?
> > > can you help me a little further, I'm lost.
>
> > > Good luck,
>
> > > Jose.
>
> > > On Jul 27, 3:02 pm, skippy <a...@2lehmans.com> wrote:
> > > > I would have tried your last example.
> > > > It look like a access problem to the file.  follow the access denied
> > > > message.  See what that get you.
> > > > Sorry, I know how it does.
>
> > > > On Jul 27, 2:36 pm, Jose Luis Estrella Campaña <jlecamp...@gmail.com>
> > > > wrote:
>
> > > > > Hi skippy !
>
> > > > > I have tried your suggestion but unfortunately it did not work :(
>
> > > > > I changed the java APIs I used this time but the result is the same:
> > > > > ...
> > > > >               try {
> > > > >                         File f = new File("xml/users.xml");
> > > > >                         FileReader reader = new FileReader(f);
> > > > >                         BufferedReader buffer = new
> > > BufferedReader(reader);
> > > > >                         buffer.readLine();
> > > > >                         // Read a line of text
> > > > >                         System.out.println(buffer.readLine());
> > > > >                 }
> > > > > ....
>
> > > > > The generated exception is:
>
> > > > > Caused by: java.security.AccessControlException: access denied
> > > > > (java.io.FilePermission \users.xml read)
>
> > > > > also, If I try it like this: /xml/users.xml with the forward slash a
> > > > > the beginning it goes for the root of the system which is C:/ and it
> > > > > still does not work, which I find weird because that's outside the
> > > > > application's context, right ?
>
> > > > > Anyways, please help me Skippy.
>
> > > > > Sincerely,
>
> > > > > Jose.
>
> > > > > On Jul 27, 2:13 pm, skippy <a...@2lehmans.com> wrote:
>
> > > > > > If that does not work, ping me again and I will provide a code
> > > sample.
>
> > > > > > On Jul 27, 2:09 pm, skippy <a...@2lehmans.com> wrote:
>
> > > > > > > I would put the file in the WEB-INF/XML/
> > > > > > > change the path to the file to xml/users.xml or /xml/user.xml
>
> > > > > > > On Jul 27, 1:57 pm, Jose Luis Estrella Campaña <
> > > jlecamp...@gmail.com>
> > > > > > > wrote:
>
> > > > > > > > Hello dane !
>
> > > > > > > > You're right in assuming something it's not working. Here's the
> > > > > > > > thing... I need to read from the xml file so I can perform some
> > > > > > > > operations on it and then save it again, here's the code I'm
> > > trying to
> > > > > > > > get to work:
>
> > > > > > > > import ....
>
> > > > > > > > public class GreetingServiceImpl extends RemoteServiceServlet
> > > > > > > > implements
> > > > > > > >                 GreetingService {
> > > > > > > >         public String greetServer(String input) throws
> > > > > > > > IllegalArgumentException {
>
> > > > > > > >                 FileInputStream fin;
>
> > > > > > > >                 try {
> > > > > > > >                     fin = new FileInputStream ("users.xml");
> > > > > > > >                     System.out.println( new
> > > DataInputStream(fin).readLine() );
> > > > > > > >                     fin.close();
> > > > > > > >                     } catch (IOException e) {
> > > > > > > >                         System.err.println ("Unable to read from
> > > file");
> > > > > > > >                         System.exit(-1);
> > > > > > > >                     }
> > > > > > > >                 return "success reading file";
>
> > > > > > > >         }
>
> > > > > > > > }
>
> > > > > > > > And here's the exception I'm getting:
>
> > > > > > > > Unable to read from file
> > > > > > > > .
> > > > > > > > .
> > > > > > > > .
> > > > > > > > Caused by: java.security.AccessControlException: access denied
> > > > > > > > (java.lang.RuntimePermission exitVM.-1)
>
> > > ---------------------------------------------------------------------------
> > > ­­-------------------------------------------------------------------------
> > > -­-­--------
>
> > > > > > > > This last test was performed putting the file where you
> > > suggested.
> > > > > > > > (src/org/jose/server. )
>
> > > > > > > > Thank you very much,
>
> > > > > > > > Jose.
>
> > > > > > > > On Jul 27, 1:13 pm, "dane.molotok" <dane.molo...@gmail.com>
> > > wrote:
>
> > > > > > > > > I guess I'm missing something in the question. Have you tried
> > > some
> > > > > > > > > things and it's not working like you'd expect? I would think
> > > you could
> > > > > > > > > put it in src/org/jose/server.
>
> > > > > > > > > On Jul 27, 11:21 am, Jose Luis Estrella Campaña <
> > > jlecamp...@gmail.com>
> > > > > > > > > wrote:
>
> > > > > > > > > > Good day everybody,
>
> > > > > > > > > > I have this particular need, where I need to have a file
> > > (xml) within
> > > > > > > > > > my GWT app. I have some data in this xml I must read, change,
> > > and then
> > > > > > > > > > write (update)
> > > > > > > > > > The file must be delivered or included within the Gwt App.
> > > Can anybody
> > > > > > > > > > please tell me where can I place this file, so I can
> > > read/write it
> > > > > > > > > > using java's file APi from an RPC Servlet.
>
> > > > > > > > > > Here's a brief description of how my App's directory
> > > structure looks
> > > > > > > > > > like:
>
> > > > > > > > > > GwtApp
> > > > > > > > > >             |__ src
> > > > > > > > > >             |          |__org
> > > > > > > > > >             |          |       |__jose
> > > > > > > > > >             |          |                 |__client
> > > > > > > > > >             |          |                 |__server
> > > > > > > > > >             |          |                 |__shared
> > > > > > > > > >             |          |
> > > > > > > > > >             |          |__META-INF
> > > > > > > > > >             |
> > > > > > > > > >             |__ war
> > > > > > > > > >                       |__gwtapp
> > > > > > > > > >                       |__WEB-INF
>
> > > > > > > > > > For my current needs, where would you suggest placing the
> > > file ?
>
> > > > > > > > > > Thank you very much in advance,
>
> > > > > > > > > > Have a nice day,
>
> > > > > > > > > > Jose- Hide quoted text -
>
> > > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Google Web Toolkit" group.
> > > To post to this group, send email to google-web-toolkit@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-web-toolkit+unsubscribe@googlegroups.com<google-web-toolkit%2Bunsubs cribe@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.

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

No comments:

Post a Comment