Hello GWT developers,

Can anyone please help me with the Error Message I am getting form the GWT 
Request Factory. I have 2 Entities “NameData” and “Address” with OneToOne 
relation between them. (See the entities below.) I can persist NameData 
when there is no OneToOne Address relation. This works fine, means 
RequestFactory is working. I can also persist Address directly on server 
side (hardcoded in NameData.persist() method) which means that JPA on 
Datanucleus is working fine.

Unfortunately, it does not work on client side. When I try to create 
NameData using NameDataProxy and put AddressProxy into it (see client call 
below), I am getting the error message:

My code is based on the following example: 
http://code.google.com/p/gwt-examples/wiki/DemoRequestFactory

I have extended it using “Adress” JPA entity and “AddressProxy”

Thank you for your help!!

Nermin


======= ERROR Message ===========

12:35:30.708 [ERROR] [nerminsrequestfactoryproject] Uncaught exception 
escaped

com.google.web.bindery.event.shared.UmbrellaException: One or more 
exceptions caught, see full set in UmbrellaException#getCauses
    at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.fail(AbstractRequestContext.java:727)
    at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$5.onTransportFailure(AbstractRequestContext.java:1104)
    at 
com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:140)
    at 
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    at 
com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at 
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at 
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at 
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at 
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at 
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
    at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at 
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Server Error 500 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; 
charset=ISO-8859-1"/>
<title>Error 500 INTERNAL_SERVER_ERROR</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /gwtRequest. Reason:
<pre>    INTERNAL_SERVER_ERROR</pre></p><hr 
/><i><small>Powered by 
Jetty://</small></i><br/>                                     
           

<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                

</body>
</html>

    at 
com.google.web.bindery.requestfactory.shared.Receiver.onFailure(Receiver.java:44)
    at com.test.client.view.NameInput$1.onFailure(NameInput.java:95)
    at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequest.onFail(AbstractRequest.java:118)
    at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext.fail(AbstractRequestContext.java:707)
    at 
com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$5.onTransportFailure(AbstractRequestContext.java:1104)
    at 
com.google.web.bindery.requestfactory.gwt.client.DefaultRequestTransport$1.onResponseReceived(DefaultRequestTransport.java:140)
    at 
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
    at 
com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at 
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
    at 
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at 
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at 
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
    at 
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
    at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
    at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at 
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at 
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at 
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source)


============ Entities =================

@Entity
public class NameData {

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Version
    @Column(name = "version")
    private Integer version;
    
    @OneToOne(cascade=CascadeType.ALL)
    private Address address;

    private String name;

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Integer getVersion() {
        return version;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public NameData persist() {
        EntityManager em = entityManager();
        try {
            em.persist(this);
        } finally {
            em.close();
        }
        return this;
    }
}
===================

import com.google.appengine.api.datastore.Key;

@Entity
public class Address {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key id;
    
    private String street;
    private String city;
    private Long version;
    
    public String getStreet() {
        return street;
    }
    public void setStreet(String street) {
        this.street = street;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }

    public void setId(Key id) {
        this.id = id;
    }

    public Key getId() {
        return id;
    }
    public Long getVersion() {
        return version;
    }
    public void setVersion(Long version) {
        this.version = version;
    }
}

======== GWT RequestFactory Proxies ===========

@ProxyFor(NameData.class)
public interface NameDataProxy extends EntityProxy {
    Long getId();
    Integer getVersion();
    void setName(String name);
    String getName();
    AddressProxy getAddress();
    void setAddress(AddressProxy address);
}

==============

@ProxyFor(Address.class)
public interface AddressProxy extends EntityProxy {
    String getCity();
    void setCity(String city);
}


============ Client Side call =============

    private void save(String name) {

        // get requestfactory piping
        NameDataRequest nameDataRequest = cp.getRequestFactory()
                .nameDataRequest();

        // create new entity
        NameDataProxy newName = nameDataRequest.create(NameDataProxy.class);
        newName.setName(name);
        
        AddressProxy pAddress = nameDataRequest.create(AddressProxy.class);
        pAddress.setCity("My City");
        newName.setAddress(pAddress);

        // persist the entity
        nameDataRequest.persist().using(newName)
                .fire(new Receiver<NameDataProxy>() {
                    public void onSuccess(NameDataProxy data) { // on 
success
                        process(data);
                    }

                    public void onFailure(ServerFailure error) {
                        super.onFailure(error);
                        Window.alert("Oops, I couldn't save that name for 
some reason.");
                    }

                });
    }


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Xrzee_v-MQ0J.
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