Richard, I was missing that initialization to requestFactory as well.
I had to add that, and I had to add the following sections to my
web.xml:
<servlet>
<servlet-name>requestFactoryServlet</servlet-name>
<servlet-
class>com.google.gwt.requestfactory.server.RequestFactoryServlet</
servlet-class>
</servlet>
<servlet>
<servlet-name>remoteapi</servlet-name>
<servlet-
class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-
class>
</servlet>
<servlet-mapping>
<servlet-name>remoteapi</servlet-name>
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>requestFactoryServlet</servlet-name>
<url-pattern>/gwtRequest</url-pattern>
</servlet-mapping>
In addition, I added the appengine-tools-api.jar files to my web-inf/
lib folder.
I had to add the following to my apps gwt.xml file:
<inherits name='com.google.gwt.json.JSON'/>
Finally, I added json.jar to my web-inf/lib folder. I'm not sure
where this file originated, but I finally tracked down a copy at:
http://google-web-toolkit.googlecode.com/svn-history/r7687/trunk/bikeshed/war/WEB-INF/lib/json.jar
Now the app seems to be running without any errors. I think some of
this needs to go into the RequestBuilder/MVP documentation. If it's
there I completely overlooked it.
Nick
On Nov 18, 2:05 pm, Richard Berger <[email protected]> wrote:
> As is typical - after working on this for hours, I think I found my
> problem 10 minutes after posting. Since I am trying to avoid MVP (for
> now, until the brain cell count improves), I had not initialized my
> RequestFactory. Adding:
> final EventBus eventBus = new SimpleEventBus();
> requestFactory.initialize(eventBus);
> has moved me past my NPE. Into other errors of course...
>
> Thanks for listening....
>
> RB
>
> On Nov 18, 11:50 am, Richard Berger <[email protected]> wrote:
>
>
>
>
>
>
>
> > I am having a very similar problem - NullPointerException when I call
> > fire() (the NPE is in AbstractRequestContext.doFire()). So I am
> > wondering if you have found a solution to your problem.
>
> > The code with the fire() is:
> > CommitmentSystemRequestFactory requestFactory =
> > GWT.create(CommitmentSystemRequestFactory.class);
> > requestFactory.commitmentRequest().countCommitments().fire(
> > new Receiver<Long>() {
> > @Override
> > public void onSuccess(Long response) {
> > Window.alert("Done!");
> > }
> > });
>
> > My CommitmentRequest class has:
> > @Service (Commitment.class)
> > public interface CommitmentRequest extends RequestContext {
> > Request<Long> countCommitments();
>
> > My Commitment.java class has:
> > public static long countCommitments() {
> > ....
> > }
>
> > Some other notes...
> > * I have also been going through the Expenses sample app, both the
> > description
> > at:http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.h...
> > and the sample code.
> > * I am NOT using JPA. My first learning project for GWT/GAE was with
> > JPA, but now I wanted to try the RequestFactory and then add
> > Objectify.
> > * I am NOT using MVP. I just don't yet have the critical mass of
> > brain cells necessary.
>
> > Thanks for any updates or advice...
> > RB
>
> > On Nov 18, 9:05 am, Nicholas <[email protected]> wrote:
>
> > > Thanks, you got me on the right rack. I didn't realize that more
> > > information on the exceptions was available in the dev mode console of
> > > eclipse. My domain entity objects had some Boolean accessors which I
> > > had named isProperty() instead of getProperty(). I changed all of
> > > those, and also made the domain service methods 'static' like you
> > > suggested.
>
> > > Now the application is running, but when it fires a request for
> > > UserInformation, I get a null pointer exception. After debugging, it
> > > gets into AbstractRequestContext.doFire(receiver) method, which
> > > attempts to call requestFactory.getRequestTransport().send(...).
> > > requestFactory.getRequestTransport() returns NULL so it throws a Null
> > > Pointer Exception. Do I need to configure the transport somewhere? I
> > > didn't see anything in the documentation or the Expenses sample app.
>
> > > The portion of my code that is initiating this is (~ line 60)
> > > in:http://code.google.com/p/eatright/source/browse/trunk/EatRightApp/src...
>
> > > On Nov 17, 6:28 pm, Thomas Broyer <[email protected]> wrote:
>
> > > > On 17 nov, 21:06, Nicholas <[email protected]> wrote:
>
> > > > > I am working on a small GWT app (I have used GWT in the past but it
> > > > > was a while ago), trying to learn the new MVP and RequestFactory. I
> > > > > am not sure if I am just approaching this wrong, or have some error I
> > > > > can't spot. When I add a call to instantiate my app's RequestFactory,
> > > > > it no longer runs. It gives me "Deferred Binding Failed" for my
> > > > > request factory.
>
> > > > > I went back and double-checked the domain / entity objects and I think
> > > > > I have the required pattern in place (implicit no-arg constructor,
> > > > > getId(), findEntity(id) and getVersion()).
>
> > > > > Some of the relevant code:
>
> > > > > Domain
> > > > > objects:http://code.google.com/p/eatright/source/browse/#svn/trunk/EatRightAp...
>
> > > > > EntityRequest and Proxy
> > > > > objects:http://code.google.com/p/eatright/source/browse/#svn/trunk/EatRightAp...
>
> > > > > This class instantiates the RequestFactory (line 35) and passes it to
> > > > > the Activity (line
> > > > > 41)http://code.google.com/p/eatright/source/browse/trunk/EatRightApp/src...
>
> > > > > This class is where I have a method utilizing the request factory. (~
> > > > > line
> > > > > 49)http://code.google.com/p/eatright/source/browse/trunk/EatRightApp/src...
>
> > > > >http://code.google.com/p/eatright/source/browse/trunk/EatRightApp/src...
>
> > > > > Any ideas?
>
> > > > Your "service methods" in your domain objects aren't static, but
> > > > aren't declared as InstanceRequest in your RequestContext.
> > > > (don't you have more specific errors than "deferred binding failed"?)
--
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.