* No source code is available for type java.io.BufferedWriter; did you forget to inherit a required module?*

529 views
Skip to first unread message

Manish Kumar

unread,
Sep 27, 2008, 5:53:17 AM9/27/08
to Google-We...@googlegroups.com
Hi everybody,

Thanks all of you for providing continuos support to each other.

I am trying to write a file on GWT Client ( inside the method
onModuleLoad )using BufferedWriter and FileWriter.

The problem is that It is compiled successfuly but on the run time it gives
:

* No source code is available for type java.io.BufferedWriter; did you
forget to inherit a required module?*
* No source code is available for type java.io.FileWriter; did you forget to
inherit a required module?*
* No source code is available for type java.io.IOException; did you forget
to inherit a required module?*

These seem a bit sily errors as I might not have included some required
module or jar file,But troubling me a lot.

I am using eclipse IDE and added all the jars to avoid any compilation
error.

And also is there any certian way to add module/lib/classpath for the same.

Usually I use *configure Build Path* and manual edit of gwt.xml.

Does this make any difference?

Can anybody please help me out to simulate which is the required for the
same?

Thanking in advance.

Regards
Manish

Lothar Kimmeringer

unread,
Sep 27, 2008, 7:47:05 AM9/27/08
to Google-We...@googlegroups.com
Manish Kumar schrieb:

> I am trying to write a file on GWT Client ( inside the method
> onModuleLoad )using BufferedWriter and FileWriter.

GWT compiles Java to Javascript and HTML. With that you're not
able to access the local filesystem of the client (aka browser).

So it's not surprising that there will be problems when trying
to use the corresponding classes of Java to do that. I'm won-
dering that you actually are able to compile that.

> These seem a bit sily errors as I might not have included some required
> module or jar file,But troubling me a lot.

The Java-classes that can be used for a GWT-client is reduced.
Most of the writers and reader (and streams btw) are not
included.

> Can anybody please help me out to simulate which is the required
> for the same?

You can write a Java-Applet. When signing it with an (expensive)
certificate you can access the local filesystem of the client.
Using the Java-To-Javascript-engine and some JSNI-magic, you
should be able to access the filesystem with GWT (or any
other Javascrip-application).


Regards, Lothar

Adam T

unread,
Sep 28, 2008, 11:21:19 AM9/28/08
to Google Web Toolkit
Too add to Lothar's comment, you can find which Java classes you can
use on server side by referring here:
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=RefJreEmulation

BufferedWriter and FileWriter are not included for the reasons already
stated.

//A

Arthur Kalmenson

unread,
Sep 28, 2008, 7:11:49 PM9/28/08
to Google Web Toolkit
That link is for Java classes that can be used on the client side, not
the server side. On the server side you can use any Java classes you
want.

Regards,
Arthur Kalmenson

On Sep 28, 11:21 am, Adam T <adam.t...@gmail.com> wrote:
> Too add to Lothar's comment, you can find which Java classes you can
> use on server side by referring here:http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=goog...

Manish Kumar

unread,
Sep 29, 2008, 2:33:28 AM9/29/08
to Google-We...@googlegroups.com
Hi everybody,

* That link is for Java classes that can be used on the client side, not


the server side. On the server side you can use any Java classes you
want.

*
This seems a bit confusive statement.As per my knowledge ,Packages mention
in JRE Emulation for GWT
on this location
(http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=RefJreEmulation
)are applied to Both server as well as client.

And also,for the same functionalitiy, I came to knew that we can call a
external java script function
(resposible for creating and writing files) inside a GWT Code (client side)
using JSNI .Is this a good solution?

Please correct if I am wrong at any point.

Regards,
Manish

Lothar Kimmeringer

unread,
Sep 29, 2008, 3:27:20 AM9/29/08
to Google-We...@googlegroups.com
Hi Manish,

I corrected your quoting to make it easier to read.

Manish Kumar schrieb:


> Arthur Kalmenson wrote:
>> That link is for Java classes that can be used on the client side, not
>> the server side. On the server side you can use any Java classes you
>> want.
>

> This seems a bit confusive statement.As per my knowledge ,Packages mention
> in JRE Emulation for GWT
> on this location
> (http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=RefJreEmulation
> )are applied to Both server as well as client.

The JRE Emulation is valid for the client-part. Because it's a subset
of the Java Runtime Library, it's of course valid for the server-side
as well. But the server-side isn't limited to that because it's
running inside a Java Virtual Machine, e.g. a Tomcat-server etc.

> And also,for the same functionalitiy, I came to knew that we can call a
> external java script function
> (resposible for creating and writing files) inside a GWT Code (client side)
> using JSNI .Is this a good solution?

There is no Javascript-function that allows you to write to the
local filesystem. There are only hacks taking advantages of bugs
in browsers to achieve that but this kind of thing don't last
very long and is nothing I would expect inside a widget-library.

> Please correct if I am wrong at any point.

The link was correct ;-)


Regards, Lothar

Adam T

unread,
Sep 29, 2008, 4:45:38 AM9/29/08
to Google Web Toolkit
Urgh, Sunday evening mistakes - it is of course a link to classes
available on client side; on server side you can use all of Java.
//A
> > > Manish- Dölj citerad text -
>
> - Visa citerad text -

Manish Kumar

unread,
Sep 29, 2008, 5:06:59 AM9/29/08
to Google-We...@googlegroups.com
Hi Everybody,

Thank you all of providing much needed support.
Though I have implemented this by calling external java script using JSNI ,
I would like to change the way if it doesn't last long.
Actually,I wanted to send the request parameters for file information to
Tomcat webserver( already implemented for whole application. ). But The main
problem is that
I have to use already existing jsp which takes only file path.So,

1) Would this be good if I write a servlet on webserver which would write
the file and use sendredirect to jsp?
2) Can I make a call rpc call to my own servlet in gwt tomcat server which
will write a file and sendredirect to my jsp on application web server.?
But , As per my study , rpc call is only for debugging so, it wouldn't
valid for production server.is this correct.?
3) or, as one of u suggested , write a applet with extended signature and
use some magic of JSNI.( for this, can anybody provide some more detail. )

please provide the suggestions and ideas if any others.

Regards
Manish

----- Original Message -----
From: "Lothar Kimmeringer" <j...@kimmeringer.de>
To: <Google-We...@googlegroups.com>
Sent: Monday, September 29, 2008 12:57 PM
Subject: Re: * No source code is available for type java.io.BufferedWriter;
did you forget to inherit a required module?*


>

Lothar Kimmeringer

unread,
Sep 29, 2008, 5:30:24 AM9/29/08
to Google-We...@googlegroups.com
Manish Kumar schrieb:

> Actually,I wanted to send the request parameters for file information to
> Tomcat webserver( already implemented for whole application. ). But The main
> problem is that
> I have to use already existing jsp which takes only file path.So,

If you have to call an existing servlet/JSP-page, you can use
RequestBuilder where you can construct your own HTTP-requests
and interpret the result as you like.

> 1) Would this be good if I write a servlet on webserver which would write
> the file and use sendredirect to jsp?

Not really. The only exception I see here is if you have to
perform WebService-requests or if you have to contact a
different server than the one your GWT-application has been
loaded from (by default this is restricted).

> 2) Can I make a call rpc call to my own servlet in gwt tomcat server which
> will write a file and sendredirect to my jsp on application web server.?
> But , As per my study , rpc call is only for debugging so, it wouldn't
> valid for production server.is this correct.?

No, RPC is the way of choice communicating with the server
from a GWT-application.

> 3) or, as one of u suggested , write a applet with extended signature and
> use some magic of JSNI.( for this, can anybody provide some more detail. )

What exactly do you need the local file-access? If it's for
a file-upload, there is a HTML-tag for that, i.e. you can
use that inside GWT as well (using the FileUpload-widget).
So if it's a file-upload we're talking about, use that,
otherwise you will have to go the Applet-way or try to think
over your concept and find a solution that doesn't need a
local file-system.


Regards, Lothar

Manish Kumar

unread,
Sep 29, 2008, 5:57:23 AM9/29/08
to Google-We...@googlegroups.com
Hi Lothar,

Thank you for providing such great help.
The Actual requirements is to add the comments for each item appeared on the
browser.
I have created a richtextArea with the buttons for entering the comments
for each clicked item shown on the browser.
Now, once click over the buttons, It should be submitted to web server(
tomcat ) already running for the whole product to save in the server
filesystem.This is external webserver
not gwt tomcat web server.

The main issue is that jsp existed on external webserver accepts only file
path to save the comments content.
So I am force to create file having comments for each clicked item on the
browser.For avoiding the creating files on client, I had suggested no (1)
mentioned below.
Is this right fit? .

Sorry to ask Once more about (2) as I am bit confused , does RPC mechanisnm
work on production environment also. If yes ,Can I process as mention in
(2).

Please provide your views for the same.

Regards,
Manish


----- Original Message -----
From: "Lothar Kimmeringer" <j...@kimmeringer.de>
To: <Google-We...@googlegroups.com>
Sent: Monday, September 29, 2008 3:00 PM
Subject: Re: * No source code is available for type java.io.BufferedWriter;
did you forget to inherit a required module?*


>

Lothar Kimmeringer

unread,
Sep 29, 2008, 7:46:09 AM9/29/08
to Google-We...@googlegroups.com
Manish Kumar schrieb:

> The main issue is that jsp existed on external webserver accepts only file
> path to save the comments content.

I think you confuse PATH_INFO with file path. The path-info of a URL is
everything in the URL after the actual resource, so given a JSP-page
that is accessed
via http://www.example.com/servletpath/process.jsp/my/path/info/hello.txt
the PATH_INFO in that case would be /my/path/info/hello.txt (I write
PATH_INFO that way because this is the variable being used when using
the CGI-gateway.

In servlets (i.e. in JSP-pages as well) you can access the path-info-
value with getPathInfo() provided by the HttpServletRequest (that
can be accessed with the variable request inside JSP-pages).

> So I am force to create file having comments for each clicked item on the
> browser.

I still don't see a need for the creation of files but it is looking
more like a special URL to be constructed. Again RequestBuilder would
be the class of choice in that case. On the other hand, if your JSP-
page expects a previous file-upload, you're screwed. In that case,
before starting a Signed Applet Project, you should consider extending
your JSP-page/servlet to accept the "file" as content of a POST-request.

> Sorry to ask Once more about (2) as I am bit confused , does RPC mechanisnm
> work on production environment also. If yes ,Can I process as mention in

RPC works on production systems as well. gwt-servlet.jar and your server-
classes must be in the classpath of your web-application/server. As well,
your web.xml must contain a servlet-entry for your servlet. If you want
to use the PATH_INFO-functionality, you might need two entries, one
with the URL-pattern /MyServletPattern and /MyServletPattern/*


Regards, Lothar

Manish Kumar

unread,
Sep 29, 2008, 11:51:49 AM9/29/08
to Google-We...@googlegroups.com
Hi Lothar and all,

Thank all of you very much for much needed stuffs and great support.
Atlast, I implemented by writing a separate servlet in our web
container(external) which accepts the request URL (contains all file
information and comment text )and write the file inside the server.

Regards
Manish


----- Original Message -----
From: "Lothar Kimmeringer" <j...@kimmeringer.de>
To: <Google-We...@googlegroups.com>
Sent: Monday, September 29, 2008 5:16 PM
Subject: Re: * No source code is available for type java.io.BufferedWriter;
did you forget to inherit a required module?*


>

Manish Kumar

unread,
Sep 30, 2008, 2:45:34 AM9/30/08
to Google-We...@googlegroups.com
Hi everybody,

Thanks all for great co-operation and support.

I am a bit new to GWT Though i have learnt a lot from this mailing-list in
last couple of weeks

I am stuck up with How to call GWT component ( mean to say ,give the the
control to GWT entry point class for excuting onModuleLoad )
from extrenal HTML document.

While working on integartion of GWT with external component, I am bit
confused.
My requirement is like this : I have a html displayed in the browser which
is having mutiple buttons.
This HTML is not part of GWT .This is being displayed in browser by some
other component(currently .Net).
On click of HTML Button in the browser I want to call gwt component that
makes a call either to external tomcat server
or displayes GWT widgets (widget button click , it also makes a call to
external tomcat).

One more thing is that can I have mutiple HTML for a single entry point so I
can display various widget on requirement.I want to handle mutiple condition
in a single own entrypoint class( inside the method onModuleLoad ) .

Can anybody please provide ideas to get rid of this.

Regards
Manish


----- Original Message -----
From: "Lothar Kimmeringer" <j...@kimmeringer.de>
To: <Google-We...@googlegroups.com>
Sent: Monday, September 29, 2008 5:16 PM
Subject: Re: * No source code is available for type java.io.BufferedWriter;
did you forget to inherit a required module?*


>

Reply all
Reply to author
Forward
0 new messages