Hi aish,

1. Ah, it looks like I was mistaken: it is correct that you are not seeing
the com/foo/server folder in your runtime WAR directory's WEB-INF/classes
directory.  Eclipse does not actually push class files from dependent
projects into WEB-INF/classes, but rather, creates a jar and pushes that to
WEB-INF/lib.  So, check <runtime WAR>/WEB-INF/lib for FooShared.jar, which
should contain the compiled classes from FooShared.  If the jar is missing,
or does not have the expected class files, then something is probably wrong
with the configuration of your FooShared project.

2. Your WEB-INF folder inside FooServer is correct.  The WAR folder inside
your project (WebContent by default) should only contain input files and
resources: HTML, JSP, CSS, etc.).  Eclipse will take care of populating the
WEB-INF/lib and WEB-INF/classes of your runtime WAR directory (or exported
WAR file) automatically, based on your Java EE module dependencies.  No need
to create an ant task to do so manually.

I can zip up my Foo* projects and upload them here, if it would help get you
going.

Keith

On Mon, Apr 5, 2010 at 12:34 PM, aish sundar <[email protected]> wrote:

> Hey Keith,
>
> I am seeing a couple of things off here.
>
> 1. after I start Tomcat, I do not see "client" folder under the war
> directory "<WAR>/WEB-INF/classes/com/foo/". I just see the "server"
> folder there. Do you know how to get the client there? I have added
> FooShared as a Java EE module dependency of FooServer. The -war
> argument in the GWT launch config is set to <eclipse
> workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/
> wtpwebapps/FooServer.
>
> 2. Another thing I noticed is that the WEB-INF folder within FooServer
> does not have any 'classes' folder within it. All it has is
>   (i) lib folder
>   (ii) web.xml
>
>  As I said, I have added FooShared as a Java EE module dependency of
> FooServer. Should we create a build.xml for FooServer (or some other
> procedure) to copy all the client and shared classes manually into
> WebContent/WEB-INF of FooServer?
>
> Thanks,
> Aishwarya
>
> On Apr 2, 2:39 pm, Keith Platfoot <[email protected]> wrote:
> > Hi aish,
> >
> > After you start Tomcat, see if the runtime WAR directory (the one
> specified
> > with -war argument in your GWT launch configuration) has the
> > GreetingService.class file under <WAR>/WEB-INF/classes/com/foo/client.
>  If
> > it's not there, that would explain the ClassNotFoundException.  Then the
> > only question is how to get it there.
> >
> > Your configuration as you described it sounds correct.  GreetingService
> > should be copied into FooServer's WEB-INF/classes by means of it being
> > declared an Java EE module dependency.  FooServer also needs
> gwt-servlet.jar
> > as a module dependency, but if you were missing that you would get a
> > different error.
> >
> > If you can't make any headway getting things to work, I could probably
> zip
> > up my sample projects and you could try importing those.  Just let me
> know.
> >
> > Keith
> >
> > On Wed, Mar 31, 2010 at 2:55 PM, aish sundar <[email protected]> wrote:
> > > 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 <[email protected]> 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 <[email protected]>
> 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
> >
> > ...
> >
> > read more ยป
>
> --
> 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]<google-web-toolkit%[email protected]>
> .
> 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 [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