Including third party jars in Hosted mode

30 views
Skip to first unread message

stri...@gmail.com

unread,
Jun 1, 2006, 12:07:19 PM6/1/06
to Google Web Toolkit
Hi,

I'm working on a custom widget that depends on an external API (
Informa ). When I try to run in Hosted mode the shell can't find any
of the classes that are in the informa jar. I tried putting the new
jar in the classpath of the eclipse launch configuration but it didn't
help.

I get a whole bunch of errors like this:

[ERROR] Errors in
'C:\projects\strickla\wush\smiledeeza\MyDeeza\trunk\src\mil\disa\dp\feedsample\rss\FeedWidget.java'
[ERROR] Line 15: The import de cannot be resolved

"de" is the top level package of the classes in the jar...the full
package of one of the classes I'm importing in FeedWidget is:

de.nava.informa.impl.basic.Item

What do I need to do in order to get the shell to have access to any
third party jars? This has to be a common thing that many people need
to do, right?

one...@gmail.com

unread,
Jun 1, 2006, 1:55:20 PM6/1/06
to Google Web Toolkit
Hosted mode starts a new JVM. Look in the project-shell.cmd (under
Windows) file and edit it to add your informa jar to the -cp option.
You will see a list of other jars in that file, just add yours to it.

stri...@gmail.com

unread,
Jun 1, 2006, 3:45:23 PM6/1/06
to Google Web Toolkit
Yeah I tried before the original post and it didn't help. I think the
problem was that there is no way for the GWT to transform that third
party jar into javascript or something that javascript understands, so
I needed to create a /server directory ( at the same level as the
/client ) and then do RPC to a RemoteServiceServlet (Impl) class.

I have it compiling and running but the page is just blank...goign to
try debugging now that it'll actually load and display the module.

Azzah

unread,
Jun 1, 2006, 4:53:40 PM6/1/06
to Google Web Toolkit
I've been struggling with the same thing and finally got it working
(using the widget library from http://gwtwidgets.blogspot.com/).

>From http://gwt.components.googlepages.com/, what you need to do is:

Create a new file called User.gwt.xml in com.gwt.components package.
Place the following lines in it:

<module>
<inherits name="com.google.gwt.core.Core"/>
</module>


Then add <inherits name="com.gwt.components.User"/> to your module
configuration file.


Of course, the values depend on the packages you're trying to import.
Hope this helps,

Aaron Watkins
----------------------
My Site: http://www.goannatravel.com

stri...@gmail.com

unread,
Jun 1, 2006, 11:19:47 PM6/1/06
to Google Web Toolkit
That doesn't really make sense...I don't see a com.gwt.components
package either in any of the GWT source nor in the gwt-widgets library
from the website you linked to.

Am I supposed to just create an arbitrary package called
com.gwt.components in my own project?

Here's my situation as specific as I would like it to be.

I have a class that extends EntryPoint. It is

mil.disa.dp.gizmo.feedsample.FeedSample

I would like to be able to use the class FeedManager. It is from

de.nava.informa.utils

If I try to do this I get the error:

"[ERROR] Line 11: The import de cannot be resolved"

What do I have to do in order to use this third party jar in my own
EntryPoint module? Is the only way to do this by using an RPC Servlet,
creating a FeedServiceImpl, FeedService, and FeedServiceAsync and
making asynchronous calls to the FeedServiceImpl? This becomes awfully
inconvenient when I want to make simple calls like

feedManager.hasFeed(String feedURI)

before I add a new feed ( or not ). I don't want to have to wait for
asynchronous calls to come back before I make branching logic decisions
in my control logic.

If that is the case it seems awfully complicated and unnecessary when
the FeedManager has nothing to do with what is displayed on the page,
only with managing data for the display behind the scenes.

Mat Gessel

unread,
Jun 1, 2006, 11:51:58 PM6/1/06
to Google Web Toolkit
Ensure that

1) the source for de.nava.informa.utils is in the classpath when
running GWTShell and GWTCompiler

2) the source for de.nava.informa.utils is JRE 1.4 compatible

3) the source for de.nava.informa.utils does not use JRE classes other
than those listed in the documentation
http://code.google.com/webtoolkit/documentation/jre.html

4a) your entrypoint class is in a directory named "client" which is a
child of the module xml file's the parent directory
- or -
4b) your module xml file specifies the source directory for your
entrypoint class (I believe it must be in a descendent directory of the
module).

-= Mat

stri...@gmail.com

unread,
Jun 2, 2006, 9:19:01 AM6/2/06
to Google Web Toolkit
I believe I meet all those conditions, unsure about the "only uses
approved JRE classes" one.

Here's something: I can simply include the import statement for the
aforementioned FeedManager, but not actually use the class at all and I
get the same error. So wouldn't that seem like it can't even find the
class to import, meaning that somehow the jar isn't on the classpath of
the GWTShell?

I'm running in eclipse and I have configured a launch target for the
GWTShell and it does include the informa.jar in the classpath so I
don't know if or why that wouldn't be working.

Scott Blum

unread,
Jun 2, 2006, 6:13:00 PM6/2/06
to Google Web Toolkit
Hi strickla,

The GWT compiler needs you to tell it explicitly where to find source.
Try this:

Create a de/nava/informa/Utils.gwt.xml that contains this:
<module>
<inherits name="com.google.gwt.user.User"/>
<source path="utils"/>
</module>

Add this line to your main app's .gwt.xml file:
<inherits name="de.nava.informa.Utils"/>

Now the GWT compiler will "see" the other package when you go to
compile your app.

As other people have mentioned though, if you're bringing in an
existing (non-GWT) codebase, it is extremely likely that it won't just
work out of the box. But this should get you started.

Scott

Azzah

unread,
Jun 4, 2006, 4:09:24 PM6/4/06
to Google Web Toolkit
Hi Strickla,

Sorry for the late reply - I've been away for the weekend.

Also, sorry if my suggestion was a bit vague - it wasn't meant to be an
exact solution to your particular problem - just a description of what
needs to be done.

I won't bother clearing the air though - Scott's instructions are
better!

Aaron

Reply all
Reply to author
Forward
0 new messages