Thanks Keith. The steps seemed a lot clearer now and I followed it to
set uo my workspace exactly as yours. Now when I start the Tomcat
server, launch the client in DEV mode and go to http://localhost:8080/TestWeb,
everything loads up fine and I get to the client HTML page alright.
However when I click a button, which is tied to an Asynchronous RPC
call, I get the following exception :

SEVERE: Allocate exception for servlet greetServlet
java.lang.ClassNotFoundException: com.foo.client.GreetingService
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1275)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1206)
        at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
1083)
        at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:
806)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
129)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
175)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
128)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
286)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
844)
        at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
447)
        at java.lang.Thread.run(Unknown Source)

The synchronous version of the GreetingService is in com.foo.client
package within the FooShared project(just as you have mentioned). I
have also added FooShared as a proj dependancy of FooClient and a
module dependency of FooServer.

NOTE: I did not do Step 15 in your instructions i.e., haven't really
created a WAR file for deployment yet. Its all running locally.

The error message is not very helpful as well, in terms of when and
where was the exception thrown. any idea what could have caused it.

Thanks,
aish

On Mar 30, 1:51 pm, Keith Platfoot <kplatf...@google.com> wrote:
> Hi aish,
>
> 1) Yes, FooServer would be your existing Dynamic Web project (TestWeb).
>  This project should include anything in the .server package of your GWT app
> (e.g. GreetingServerImpl) as well as any existing server-side code.
>
> Your WAR directory (you'll have just one) will be the WebContent directory
> of TestWeb.  Dynamic Web projects are configured to use the configuration
> and resource files (web.xml, HTML, CSS, JS, etc.) from this directory to
> build your WAR when debugging locally or creating a .war file for
> deployment.  BTW, the default name is "WebContent", but this can be
> customized during the New Dynamic Web project wizard.
>
> Your GWT code (in TestUI) will need to integrate into TestWeb's WAR
> directory when you run/debug locally and when you build a .war file.  For
> running locally, you just need to tell GWT DevMode to run within the context
> of TestWeb's staging WAR directory (see steps 11 and 12 in my checklist).
>  You don't need to copy any files manually, because GWT will pick up all the
> .java and .gwt.xml source files it needs directly from the launch classpath.
>  So there really is no explicit link to TestWeb from TestUI.  The only link
> from TestWeb back to TestUI is that your HTML host page in TestWeb's
> WebContent directory will need to reference your GWT module's bootstrap
> script (the TestUI.nocache.js file, which GWT will automatically insert into
> your staging WAR directory when you launch dev mode).
>
> Creating a .war for deployment, on the other hand, does require moving
> compiled GWT output into TestWeb's WebContent directory.  Select the TestUI
> project and click the GWT Compile button on the toolbar.  Expand the
> Advanced section at the bottom and put "-war
> /absolute/path/to/TestWeb/WebContent".  When you click Compile, the
> artifacts will be written to that location.  Because of a minor bug (to be
> fixed in GPE 1.4), though, you'll need to refresh your TestWeb project to
> see the compiled output under WebContent.  Now, you can go through the WAR
> export wizard (File > Export > Web > WAR file) to create a deployment .war
> file for TestWeb.
>
> 2) TestUI should contain all your GWT module files.  It should also contain
> all GWT code, except for code that is shared between the client and server
> (in my setup, I placed these classes in FooShared).
>
> 3) Attached is a screenshot of my workspace, showing all 3 projects
> described in my checklist.
>
> Hopefully this gets you up and running.  Let me know if you have any other
> questions!
>
> Keith
>
> On Mon, Mar 29, 2010 at 4:49 PM, aish sundar <sunda...@gmail.com> wrote:
> > Hi Keith,
>
> > Thanks a lot for the detailed steps. We are in the process of
> > integrating the projects. However we have some doubts in the process.
>
> > 1) FooServer -(i) I am assuming this can be the pre-existing Dynamic
> > Web project, which we want to integrate with the GWT project. So from
> > my example, this will be TestWeb, right?
> >                    (ii) You wrote "FooServer will contain your server-
> > side code and WAR directory + static resources (HTML, CSS, etc.), " .
> >                                    (a) Does "server-side code" mean
> > the code within the server package of my GWT project i.e.,
> > GreetingServiceImpl.java? I am assuming FooServer will also have the
> > code associated with my pre-existing web project as well.
> >                                    (b) How and from where do I get
> > the "WAR directory"? Is this the WAR folder generated in my GWT
> > project? Should I just simply copy the WAR folder from the GWT project
> > over to my FooServer or is there any other way to generate it?
>
> > 2) Which project should the "TestUI.gwt.xml" file, the one that
> > defines the modules and entry point go?
>
> > 3) It will be great if you can include a SCREENSHOT of your expanded
> > WORKSPACE so that we can clearly see the layout of the various
> > projects and which component goes where.
>
> > Here's an overview of what we have done following your instructions.
> > let us know if anything looks wrong.
>
> > I initially had 2 projects FooServer (web project) and a TestUI (GWT
> > project).
>
> > (1) FooServer (Dynamic Web project, which contains the server side
> > code of the GWT proj)
> >     > src
> >             >> TestUI.gwt.xml ( don't know if this should go here)
> >             >> com.server (newly added GWT server code)
> >                                 >>>GreetingServiceImpl
>
> >     > war (copied from TestUI)
> >             >> testui (which has the generated js etc)
> >             >> WEB-INF
> >                        >>> classes
> >                        >>> lib
> >                        >>>web.xml
> >             >> TestUI.css
> >             >> TestUI.html
>
> >     > WebContent
> >             >> appPages
> >             >> META-INF
> >             >> WEB-INF
> >                         >>>lib
> >                         >>> web.xml
>
> >     > TestUI.html and TestUI.css (static HTML pages and CSS)
>
> > (2) FooClient (to contain the client side code of the GWT proj)
>
> >      > src
> >             >> com.client
> >                               >>>TestUI.java
> >                               >>> GreetingServiceAsync.java (asynch
> > RPC interface)
>
> > (3) FooShared (to contain the shared and the synch interface)
> >      > src
> >             >> com.shared
> >                               >>>Sharedclass1.java
> >                               >>> SharedClass2.java
> >                               >>> GreetingService.java (synch RPC
> > interface)
>
> > Thanks in advance ,
>
> > Aish
>
> > > Hey all,
>
> > > Ok, now that the Google Plugin for Eclipse 1.3.2 is out, here are some
> > > instructions for setting up a GWT application split across multiple
> > projects
> > > (client, server, and shared code in separate projects).  Note that this
> > will
> > > *only *work in *Eclipse for Java EE* with *GPE 1.3.2*, so verify that you
> > > have both installed before attempting.  This procedure *won't* work if
> > > you're using App Engine, since there is no WTP server adapter for App
> > > Engine.
>
> > > Also, I'm assuming that your application uses *GWT 2.0.3* and you're
> > using
> > > GWT RPC, so your server will provide at least one RPC service.  If you're
> > > not using RPC, just skip the relevant parts,
>
> > >    1. Create 3 projects: we'll call them FooServer, FooClient, and
> > FooShared
> > >    for the purposes of this walkthrough.  FooClient will contain your GWT
> > >    client-side code, FooServer will contain your server-side code and WAR
> > >    directory + static resources (HTML, CSS, etc.), and FooShared will
> > contain
> > >    code that is shared between the client and server (e.g. GWT
> > RemoteService
> > >    interfaces).  FooServer should be a Dynamic Web Project; FooClient and
> > >    FooShared can be regular Java projects.
> > >    2. Enable GWT for all 3 projects (project properties > Google > Web
> > >    Toolkit).  *NOTE: If you're not using GWT RPC, you don't need to
> > enable
> > >    GWT on FooServer*).
> > >    3. If your project uses the Apache Tomcat library, ensure that the GWT
> > >    SDK library is above it on your project's classpath (project
> > properties >
> > >    Java Build Path > Order and Export). Otherwise, you may get a
> > >    java.lang.NoSuchMethodError when launching your application in
> > development
> > >    mode.
> > >    4. Add code to FooClient. You'll need at least one GWT module and an
> > >    entrypoint class.  If you're using GWT RPC, you'll also need your
> > service
> > >    async interfaces as well (see the GWT docs for more details).  If
> > don't have
> > >    existing code to work with, just generate a new Web Application
> > project and
> > >    pilfer the files from there (renaming things as necessary, of course).
> > >    5. Add code to FooShared.  If you're using GWT RPC, this is where your
> > >    RPC synchronous interfaces go.  Also, any classes that you use on both
> > the
> > >    client and the server should go here.
> > >    6. Add code to FooServer.  Add your HTML pages, CSS files, etc. to
> > >    WebContent.  If you're using GWT RPC, your RPC servlet code lives in
> > >    FooServer.  Update WebContent/WEB-INF/web.xml to point to your welcome
> > page,
> > >    set your servlet mappings, etc.
> > >    7. Link the projects.  Add FooShared as a project dependency of
> > FooClient
> > >    (project properties > Java Build Path > Projects).  Add FooShared as a
> > >    module dependency of FooServer (projects properties > Java EE Module
> > >    Dependencies).  If you're using GWT RPC, you'll also need to add the
> > >    gwt-servlet.jar as a module dependency of FooServer.  Eclipse will
> > ensure
> > >    that your runtime WAR directory's WEB-INF/lib and WEB-INF/classes will
> > >    always contain up-to-date copies of its module dependencies.
> > >    8. All 3 projects should now compile, but if you're using GWT RPC you
> > >    probably have some errors caused by missing asynchronous interfaces.
> >  Of
> > >    course, ours aren't missing, they're just in a different project
> > >    (FooClient).  Ignore the errors via Preferences > Google >
> > Errors/Warnings >
> > >    GWT Remote Procedure Calls (RPC).
> > >    9. Set up a server for FooServer.  If you don't already have a server
> > >    configured, right-click inside the Servers view and select New >
> > Server.
> > >     Use the server of your choice (I used Tomcat v6) and add FooServer to
> > it.
> > >     If you already have a server, you can link it by right-clicking it
> > and
> > >    selecting Add and Remove.
> > >    10. Start FooServer's server.
> > >    11. Create a Web Application launch configuration for FooClient.  The
> > >    default main type will be GWTShell; change this to
> > com.google.gwt.DevMode.
> > >     On the Server tab, uncheck the box: Run built-in server (we'll use
> > >    FooServer's server instead).  On the GWT tab, enter the URL for the
> > GWT host
> > >    page in the URL field.  This will be the address of FooServer's server
> > plus
> > >    FooServer's context root (project props > Web Project Settings).  In
> > my
> > >    case, the startup URL is:http://localhost:8080/Foo
> > >    12. Run the new launch configuration.  The first time you launch,
>
> ...
>
> read more »
>
>  project explorer.png
> 44KViewDownload

-- 
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-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to