5 Replies Latest reply: Nov 27, 2007 4:10 PM by darren hartford RSS

ejb3/seam-gwt-remoting/gwt w/ DTO, JPA?

darren hartford Expert

Is there an example somewhere of using the EJB3/Seam remoting and GWT with a DTO, or preferably JPA(ejb3 entity)?

When trying the DTO approach, it looks like Seam expects the @Name annotation for using the DTO -- at which point, GWT doesn't like the DTO because of the annotation.

Does an example exist, or could someone whip one up to proof from?

thanky,
-D

  • 1. Re: ejb3/seam-gwt-remoting/gwt w/ DTO, JPA?
    darren hartford Expert

    I created a POJO without any annotations (no @NAME) and is only a simple javabean class (DTO).

    I added an empty seam.properties to the root of the jar, and under META-INF I added a components.xml:
    ==========




    ==========


    Unfortunately, I'm getting the following warning when attempting to deploy:
    ==========
    11:49:26,771 WARN [Initialization] namespace declared in components.xml does not resolve to a package annotated @Namespace:
    ==========


    Is this warning something to be concerned about - is @Name annotation a requirement to expose a DTO for Seam-GWT remoting?

  • 2. Re: ejb3/seam-gwt-remoting/gwt w/ DTO, JPA?
    darren hartford Expert

     

    <components>
    
     <component name="com.domain.app.model.SimpleDTO"
     class="com.domain.app.model.SimpleDTO">
     </component>
    
    </components>
    


  • 3. Re: ejb3/seam-gwt-remoting/gwt w/ DTO, JPA?
    darren hartford Expert

    jboss 4.2.1
    seam 2.0.0.ga
    gwt 1.4.60
    jdk6

    Still can not seem to find a way to get a DTO to work with Seam-GWT remoting.

    Using the components.xml approach to avoid annotations on the DTO side, and the problem I'm getting from the GWT service call is:

    java.lang.ClassCastException


    from

     instance.gwtTestDto(new AsyncCallback(){
    
     public void onFailure(Throwable caught) {
     root.add(new Label("gwtTestDto had a failure: " + caught + " === " + caught.fillInStackTrace() + " ==== " + GWT.getTypeName(caught) ));
    
     }
    


    Everything else seems to look o.k., org.jboss.seam DEBUG does not show anything, no errors are displayed in the server log (both console and file).

  • 4. Re: ejb3/seam-gwt-remoting/gwt w/ DTO, JPA?
    darren hartford Expert

    The wireshark/ethereal response to the browser shows (paraphrased):

    //EX[1,["com.domain.app.model.SimpleDTO/2620797990 "],0,3]

    which then shows ClassCastException from the RPC/server side.

  • 5. Re: ejb3/seam-gwt-remoting/gwt w/ DTO, JPA?
    darren hartford Expert

    resolved:

    Although GWT 1.4 supports DTO's implementing java.io.Serializable, the SEAM GWT Remoting does not appear to recognize this and will only work correctly when a DTO implements the com.google.gwt.user.client.rpc.IsSerializable.