Marshaling problem with Java 5 Generics

View: New views
12 Messages — Rating Filter:   Alert me  

Marshaling problem with Java 5 Generics

by Dimitris M.-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi I am facing the following problem with beans that use Java 5 Generics:

Generic Interface:

public interface Identifiable<I extends Serializable> {


    I getId();

    void setId(I id);
}

Bean that implements the above generic interface:

public class SomeBean implements Identifiable<Long> {

    private Long id;
   
    public Long getId() {
        return id;
    }

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

    // more stuff ...
}

dwr.xml:

<convert converter="hibernate3" match="xxx.yyy.
SomeBean" javascript="SomeBean" />


DWR cannot convert such an object from Javascript to Java:

org.directwebremoting.extend.MarshallException: Error marshalling java.io.Serializable: No converter found for 'interface java.io.Serializable'. See the logs for more details.
        at org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
        at org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
        at org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
        at org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
        at org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
        at org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
        at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
        at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
        at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
        ........

Expert of the POST request from Firebug:
c0-e2=null:null
c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}


Now if I change the interface's type from Serializable to lets say Long everything works fine. I think that this is because of the way generics work, the compiler creates two setId() methods in the SomeBean class like:

public class SomeBean implements Identifiable<Long> {

    ...

    void setId(Serializable id);

    void setId(Long id);
}



Χρησιμοποιείτε Yahoo!
Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
http://login.yahoo.com/config/mail?.intl=gr

Re: Marshaling problem with Java 5 Generics

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Add a bean converter for serializable (it just has to be there) and use class mappings in the client. And use a build of DWR3

2008/12/1 Dimitris M. <dmenounos@...>
Hi I am facing the following problem with beans that use Java 5 Generics:

Generic Interface:

public interface Identifiable<I extends Serializable> {


    I getId();

    void setId(I id);
}

Bean that implements the above generic interface:

public class SomeBean implements Identifiable<Long> {

    private Long id;
   
    public Long getId() {
        return id;
    }

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

    // more stuff ...
}

dwr.xml:

<convert converter="hibernate3" match="xxx.yyy.
SomeBean" javascript="SomeBean" />


DWR cannot convert such an object from Javascript to Java:

org.directwebremoting.extend.MarshallException: Error marshalling java.io.Serializable: No converter found for 'interface java.io.Serializable'. See the logs for more details.
        at org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
        at org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
        at org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
        at org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
        at org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
        at org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
        at org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
        at org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
        at org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
        ........

Expert of the POST request from Firebug:
c0-e2=null:null
c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}


Now if I change the interface's type from Serializable to lets say Long everything works fine. I think that this is because of the way generics work, the compiler creates two setId() methods in the SomeBean class like:

public class SomeBean implements Identifiable<Long> {

    ...

    void setId(Serializable id);

    void setId(Long id);
}



Χρησιμοποιείτε Yahoo!
Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
http://login.yahoo.com/config/mail?.intl=gr


Re: Marshaling problem with Java 5 Generics

by nbourdeau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do we really need to "use class mappings in the client" ???
Since we have a lot of class, it makes an ugly dwr.xml because we cannot use wildcards to map converters to classes with this technique ...

Have an idea ??

XMaNIaC wrote:
Add a bean converter for serializable (it just has to be there) and use
class mappings in the client. And use a build of DWR3

2008/12/1 Dimitris M. <dmenounos@yahoo.com>

> Hi I am facing the following problem with beans that use Java 5 Generics:
>
> Generic Interface:
>
> public interface Identifiable {
>
>     I getId();
>
>     void setId(I id);
> }
>
> Bean that implements the above generic interface:
>
> public class SomeBean implements Identifiable<Long> {
>
>     private Long id;
>
>     public Long getId() {
>         return id;
>     }
>
>     public void setId(Long id) {
>         this.id = id;
>     }
>
>     // more stuff ...
> }
>
> dwr.xml:
>
> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
> SomeBean" />
>
>
> DWR cannot convert such an object from Javascript to Java:
>
> org.directwebremoting.extend.MarshallException: Error marshalling
> java.io.Serializable: No converter found for 'interface
> java.io.Serializable'. See the logs for more details.
>         at
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
>         at
> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
>         at
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>         at
> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
>         at
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>         at
> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
>         at
> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
>         at
> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
>         at
> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
>         ........
>
> Expert of the POST request from Firebug:
>
> c0-e2=null:null
> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
>
>
>
> Now if I change the interface's type from Serializable to lets say Longeverything works fine. I think that this is because of the way generics
> work, the compiler creates two setId() methods in the SomeBean class like:
>
> public class SomeBean implements Identifiable<Long> {
>
>     ...
>
>     void setId(Serializable id);
>
>     void setId(Long id);
> }
>
>
> ------------------------------
> Χρησιμοποιείτε Yahoo!
> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
> http://login.yahoo.com/config/mail?.intl=gr
>

Re: Marshaling problem with Java 5 Generics

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Do you?  We don't know because we haven't seen the signatures of the methods you are trying to call.  I am assuming you are using class mappings because the parameters of the methods you are trying to call are not concrete.  If that is the case, yes you need the class mappings.  How else is DWR supposed to know what Java object to instantiate?

On Wed, Oct 21, 2009 at 3:35 PM, nbourdeau <nbourdeau@...> wrote:

Do we really need to "use class mappings in the client" ???
Since we have a lot of class, it makes an ugly dwr.xml because we cannot use
wildcards to map converters to classes with this technique ...

Have an idea ??


XMaNIaC wrote:
>
> Add a bean converter for serializable (it just has to be there) and use
> class mappings in the client. And use a build of DWR3
>
> 2008/12/1 Dimitris M. <dmenounos@...>
>
>> Hi I am facing the following problem with beans that use Java 5 Generics:
>>
>> Generic Interface:
>>
>> public interface Identifiable {
>>
>>     I getId();
>>
>>     void setId(I id);
>> }
>>
>> Bean that implements the above generic interface:
>>
>> public class SomeBean implements Identifiable<Long> {
>>
>>     private Long id;
>>
>>     public Long getId() {
>>         return id;
>>     }
>>
>>     public void setId(Long id) {
>>         this.id = id;
>>     }
>>
>>     // more stuff ...
>> }
>>
>> dwr.xml:
>>
>> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
>> SomeBean" />
>>
>>
>> DWR cannot convert such an object from Javascript to Java:
>>
>> org.directwebremoting.extend.MarshallException: Error marshalling
>> java.io.Serializable: No converter found for 'interface
>> java.io.Serializable'. See the logs for more details.
>>         at
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
>>         at
>> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
>>         at
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>>         at
>> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
>>         at
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>>         at
>> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
>>         at
>> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
>>         at
>> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
>>         at
>> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
>>         ........
>>
>> Expert of the POST request from Firebug:
>>
>> c0-e2=null:null
>> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
>>
>>
>>
>> Now if I change the interface's type from Serializable to lets say
>> Longeverything works fine. I think that this is because of the way
>> generics
>> work, the compiler creates two setId() methods in the SomeBean class
>> like:
>>
>> public class SomeBean implements Identifiable<Long> {
>>
>>     ...
>>
>>     void setId(Serializable id);
>>
>>     void setId(Long id);
>> }
>>
>>
>> ------------------------------
>> Χρησιμοποιείτε Yahoo!
>> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
>> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
>> http://login.yahoo.com/config/mail?.intl=gr
>>
>
>

--
View this message in context: http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
Sent from the DWR - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Marshaling problem with Java 5 Generics

by nbourdeau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

thanks for your reply. We are using the exact same bean definition as the original post.
and we have a method in a service like this :

BeanService.save(SomeBean the Bean) {...}

So DWR knows wich class to instanciate. The problem is that he doesn't know that the id is a Long actually.
I'm not an expert with reflection and generics but it seems that we don't know using reflection that
the id is a Long. So my question was : is class mapping the only way to resolve this issue ??

davidmarginian wrote:
Do you?  We don't know because we haven't seen the signatures of the methods
you are trying to call.  I am assuming you are using class mappings because
the parameters of the methods you are trying to call are not concrete.  If
that is the case, yes you need the class mappings.  How else is DWR supposed
to know what Java object to instantiate?
On Wed, Oct 21, 2009 at 3:35 PM, nbourdeau <nbourdeau@diffusion.cc> wrote:

>
> Do we really need to "use class mappings in the client" ???
> Since we have a lot of class, it makes an ugly dwr.xml because we cannot
> use
> wildcards to map converters to classes with this technique ...
>
> Have an idea ??
>
>
> XMaNIaC wrote:
> >
> > Add a bean converter for serializable (it just has to be there) and use
> > class mappings in the client. And use a build of DWR3
> >
> > 2008/12/1 Dimitris M. <dmenounos@yahoo.com>
> >
> >> Hi I am facing the following problem with beans that use Java 5
> Generics:
> >>
> >> Generic Interface:
> >>
> >> public interface Identifiable {
> >>
> >>     I getId();
> >>
> >>     void setId(I id);
> >> }
> >>
> >> Bean that implements the above generic interface:
> >>
> >> public class SomeBean implements Identifiable<Long> {
> >>
> >>     private Long id;
> >>
> >>     public Long getId() {
> >>         return id;
> >>     }
> >>
> >>     public void setId(Long id) {
> >>         this.id = id;
> >>     }
> >>
> >>     // more stuff ...
> >> }
> >>
> >> dwr.xml:
> >>
> >> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
> >> SomeBean" />
> >>
> >>
> >> DWR cannot convert such an object from Javascript to Java:
> >>
> >> org.directwebremoting.extend.MarshallException: Error marshalling
> >> java.io.Serializable: No converter found for 'interface
> >> java.io.Serializable'. See the logs for more details.
> >>         at
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
> >>         at
> >>
> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
> >>         at
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
> >>         at
> >>
> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
> >>         at
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
> >>         at
> >>
> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
> >>         at
> >>
> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
> >>         at
> >> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
> >>         at
> >> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
> >>         ........
> >>
> >> Expert of the POST request from Firebug:
> >>
> >> c0-e2=null:null
> >> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
> >>
> >>
> >>
> >> Now if I change the interface's type from Serializable to lets say
> >> Longeverything works fine. I think that this is because of the way
> >> generics
> >> work, the compiler creates two setId() methods in the SomeBean class
> >> like:
> >>
> >> public class SomeBean implements Identifiable<Long> {
> >>
> >>     ...
> >>
> >>     void setId(Serializable id);
> >>
> >>     void setId(Long id);
> >> }
> >>
> >>
> >> ------------------------------
> >> Χρησιμοποιείτε Yahoo!
> >> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
> >> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
> >> http://login.yahoo.com/config/mail?.intl=gr
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>
>

Re: Marshaling problem with Java 5 Generics

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So you are saying you have theBean and theBean's id is a Long.  How exactly is class mapping helping you here?  I don't get it - you shouldn't need class mapping for this - can you explain?  I don't know why you are saying we can't tell the field is a Long, we certainly can by using introspection/reflection.

On Wed, Oct 21, 2009 at 4:03 PM, nbourdeau <nbourdeau@...> wrote:

Hi,

thanks for your reply. We are using the exact same bean definition as the
original post.
and we have a method in a service like this :

BeanService.save(SomeBean the Bean) {...}

So DWR knows wich class to instanciate. The problem is that he doesn't know
that the id is a Long actually.
I'm not an expert with reflection and generics but it seems that we don't
know using reflection that
the id is a Long. So my question was : is class mapping the only way to
resolve this issue ??


davidmarginian wrote:
>
> Do you?  We don't know because we haven't seen the signatures of the
> methods
> you are trying to call.  I am assuming you are using class mappings
> because
> the parameters of the methods you are trying to call are not concrete.  If
> that is the case, yes you need the class mappings.  How else is DWR
> supposed
> to know what Java object to instantiate?
> On Wed, Oct 21, 2009 at 3:35 PM, nbourdeau <nbourdeau@...> wrote:
>
>>
>> Do we really need to "use class mappings in the client" ???
>> Since we have a lot of class, it makes an ugly dwr.xml because we cannot
>> use
>> wildcards to map converters to classes with this technique ...
>>
>> Have an idea ??
>>
>>
>> XMaNIaC wrote:
>> >
>> > Add a bean converter for serializable (it just has to be there) and use
>> > class mappings in the client. And use a build of DWR3
>> >
>> > 2008/12/1 Dimitris M. <dmenounos@...>
>> >
>> >> Hi I am facing the following problem with beans that use Java 5
>> Generics:
>> >>
>> >> Generic Interface:
>> >>
>> >> public interface Identifiable {
>> >>
>> >>     I getId();
>> >>
>> >>     void setId(I id);
>> >> }
>> >>
>> >> Bean that implements the above generic interface:
>> >>
>> >> public class SomeBean implements Identifiable<Long> {
>> >>
>> >>     private Long id;
>> >>
>> >>     public Long getId() {
>> >>         return id;
>> >>     }
>> >>
>> >>     public void setId(Long id) {
>> >>         this.id = id;
>> >>     }
>> >>
>> >>     // more stuff ...
>> >> }
>> >>
>> >> dwr.xml:
>> >>
>> >> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
>> >> SomeBean" />
>> >>
>> >>
>> >> DWR cannot convert such an object from Javascript to Java:
>> >>
>> >> org.directwebremoting.extend.MarshallException: Error marshalling
>> >> java.io.Serializable: No converter found for 'interface
>> >> java.io.Serializable'. See the logs for more details.
>> >>         at
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
>> >>         at
>> >>
>> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
>> >>         at
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>> >>         at
>> >>
>> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
>> >>         at
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>> >>         at
>> >>
>> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
>> >>         at
>> >>
>> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
>> >>         at
>> >>
>> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
>> >>         at
>> >> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
>> >>         ........
>> >>
>> >> Expert of the POST request from Firebug:
>> >>
>> >> c0-e2=null:null
>> >> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
>> >>
>> >>
>> >>
>> >> Now if I change the interface's type from Serializable to lets say
>> >> Longeverything works fine. I think that this is because of the way
>> >> generics
>> >> work, the compiler creates two setId() methods in the SomeBean class
>> >> like:
>> >>
>> >> public class SomeBean implements Identifiable<Long> {
>> >>
>> >>     ...
>> >>
>> >>     void setId(Serializable id);
>> >>
>> >>     void setId(Long id);
>> >> }
>> >>
>> >>
>> >> ------------------------------
>> >> Χρησιμοποιείτε Yahoo!
>> >> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
>> >> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
>> >> http://login.yahoo.com/config/mail?.intl=gr
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
>> Sent from the DWR - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26001006.html
Sent from the DWR - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Marshaling problem with Java 5 Generics

by davidmarginian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, disregard my response.  For some reason I didn't get the message
history and I did not see your original post.  I have not looked at your
situation in detail but yes you probably do need the class mapping
here.  There is an open issue regarding this:

http://bugs.directwebremoting.org/jira/browse/DWR-416

nbourdeau wrote:

> Hi,
>
> thanks for your reply. We are using the exact same bean definition as the
> original post.
> and we have a method in a service like this :
>
> BeanService.save(SomeBean the Bean) {...}
>
> So DWR knows wich class to instanciate. The problem is that he doesn't know
> that the id is a Long actually.
> I'm not an expert with reflection and generics but it seems that we don't
> know using reflection that
> the id is a Long. So my question was : is class mapping the only way to
> resolve this issue ??
>
>
> davidmarginian wrote:
>  
>> Do you?  We don't know because we haven't seen the signatures of the
>> methods
>> you are trying to call.  I am assuming you are using class mappings
>> because
>> the parameters of the methods you are trying to call are not concrete.  If
>> that is the case, yes you need the class mappings.  How else is DWR
>> supposed
>> to know what Java object to instantiate?
>> On Wed, Oct 21, 2009 at 3:35 PM, nbourdeau <nbourdeau@...> wrote:
>>
>>    
>>> Do we really need to "use class mappings in the client" ???
>>> Since we have a lot of class, it makes an ugly dwr.xml because we cannot
>>> use
>>> wildcards to map converters to classes with this technique ...
>>>
>>> Have an idea ??
>>>
>>>
>>> XMaNIaC wrote:
>>>      
>>>> Add a bean converter for serializable (it just has to be there) and use
>>>> class mappings in the client. And use a build of DWR3
>>>>
>>>> 2008/12/1 Dimitris M. <dmenounos@...>
>>>>
>>>>        
>>>>> Hi I am facing the following problem with beans that use Java 5
>>>>>          
>>> Generics:
>>>      
>>>>> Generic Interface:
>>>>>
>>>>> public interface Identifiable {
>>>>>
>>>>>     I getId();
>>>>>
>>>>>     void setId(I id);
>>>>> }
>>>>>
>>>>> Bean that implements the above generic interface:
>>>>>
>>>>> public class SomeBean implements Identifiable<Long> {
>>>>>
>>>>>     private Long id;
>>>>>
>>>>>     public Long getId() {
>>>>>         return id;
>>>>>     }
>>>>>
>>>>>     public void setId(Long id) {
>>>>>         this.id = id;
>>>>>     }
>>>>>
>>>>>     // more stuff ...
>>>>> }
>>>>>
>>>>> dwr.xml:
>>>>>
>>>>> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
>>>>> SomeBean" />
>>>>>
>>>>>
>>>>> DWR cannot convert such an object from Javascript to Java:
>>>>>
>>>>> org.directwebremoting.extend.MarshallException: Error marshalling
>>>>> java.io.Serializable: No converter found for 'interface
>>>>> java.io.Serializable'. See the logs for more details.
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
>>>      
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
>>>      
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>>>      
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
>>>      
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>>>      
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
>>>      
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
>>>      
>>>>>         at
>>>>>
>>>>>          
>>> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
>>>      
>>>>>         at
>>>>> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
>>>>>         ........
>>>>>
>>>>> Expert of the POST request from Firebug:
>>>>>
>>>>> c0-e2=null:null
>>>>> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
>>>>>
>>>>>
>>>>>
>>>>> Now if I change the interface's type from Serializable to lets say
>>>>> Longeverything works fine. I think that this is because of the way
>>>>> generics
>>>>> work, the compiler creates two setId() methods in the SomeBean class
>>>>> like:
>>>>>
>>>>> public class SomeBean implements Identifiable<Long> {
>>>>>
>>>>>     ...
>>>>>
>>>>>     void setId(Serializable id);
>>>>>
>>>>>     void setId(Long id);
>>>>> }
>>>>>
>>>>>
>>>>> ------------------------------
>>>>> Χρησιμοποιείτε Yahoo!
>>>>> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
>>>>> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
>>>>> http://login.yahoo.com/config/mail?.intl=gr
>>>>>
>>>>>          
>>>>        
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
>>> Sent from the DWR - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>      
>>    
>
>  



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4530 (20091021) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Marshaling problem with Java 5 Generics

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In fact, with 3.0 you can

Regards

On Wed, Oct 21, 2009 at 11:35 PM, nbourdeau <nbourdeau@...> wrote:

Do we really need to "use class mappings in the client" ???
Since we have a lot of class, it makes an ugly dwr.xml because we cannot use
wildcards to map converters to classes with this technique ...

Have an idea ??


XMaNIaC wrote:
>
> Add a bean converter for serializable (it just has to be there) and use
> class mappings in the client. And use a build of DWR3
>
> 2008/12/1 Dimitris M. <dmenounos@...>
>
>> Hi I am facing the following problem with beans that use Java 5 Generics:
>>
>> Generic Interface:
>>
>> public interface Identifiable {
>>
>>     I getId();
>>
>>     void setId(I id);
>> }
>>
>> Bean that implements the above generic interface:
>>
>> public class SomeBean implements Identifiable<Long> {
>>
>>     private Long id;
>>
>>     public Long getId() {
>>         return id;
>>     }
>>
>>     public void setId(Long id) {
>>         this.id = id;
>>     }
>>
>>     // more stuff ...
>> }
>>
>> dwr.xml:
>>
>> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
>> SomeBean" />
>>
>>
>> DWR cannot convert such an object from Javascript to Java:
>>
>> org.directwebremoting.extend.MarshallException: Error marshalling
>> java.io.Serializable: No converter found for 'interface
>> java.io.Serializable'. See the logs for more details.
>>         at
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
>>         at
>> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
>>         at
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>>         at
>> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
>>         at
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>>         at
>> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
>>         at
>> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
>>         at
>> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
>>         at
>> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
>>         ........
>>
>> Expert of the POST request from Firebug:
>>
>> c0-e2=null:null
>> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
>>
>>
>>
>> Now if I change the interface's type from Serializable to lets say
>> Longeverything works fine. I think that this is because of the way
>> generics
>> work, the compiler creates two setId() methods in the SomeBean class
>> like:
>>
>> public class SomeBean implements Identifiable<Long> {
>>
>>     ...
>>
>>     void setId(Serializable id);
>>
>>     void setId(Long id);
>> }
>>
>>
>> ------------------------------
>> Χρησιμοποιείτε Yahoo!
>> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
>> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
>> http://login.yahoo.com/config/mail?.intl=gr
>>
>
>

--
View this message in context: http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
Sent from the DWR - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Marshaling problem with Java 5 Generics

by nbourdeau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm using 3.0 RC1
What exactly can I do ?

XMaNIaC wrote:
In fact, with 3.0 you can
Regards

On Wed, Oct 21, 2009 at 11:35 PM, nbourdeau <nbourdeau@diffusion.cc> wrote:

>
> Do we really need to "use class mappings in the client" ???
> Since we have a lot of class, it makes an ugly dwr.xml because we cannot
> use
> wildcards to map converters to classes with this technique ...
>
> Have an idea ??
>
>
> XMaNIaC wrote:
> >
> > Add a bean converter for serializable (it just has to be there) and use
> > class mappings in the client. And use a build of DWR3
> >
> > 2008/12/1 Dimitris M. <dmenounos@yahoo.com>
> >
> >> Hi I am facing the following problem with beans that use Java 5
> Generics:
> >>
> >> Generic Interface:
> >>
> >> public interface Identifiable {
> >>
> >>     I getId();
> >>
> >>     void setId(I id);
> >> }
> >>
> >> Bean that implements the above generic interface:
> >>
> >> public class SomeBean implements Identifiable<Long> {
> >>
> >>     private Long id;
> >>
> >>     public Long getId() {
> >>         return id;
> >>     }
> >>
> >>     public void setId(Long id) {
> >>         this.id = id;
> >>     }
> >>
> >>     // more stuff ...
> >> }
> >>
> >> dwr.xml:
> >>
> >> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
> >> SomeBean" />
> >>
> >>
> >> DWR cannot convert such an object from Javascript to Java:
> >>
> >> org.directwebremoting.extend.MarshallException: Error marshalling
> >> java.io.Serializable: No converter found for 'interface
> >> java.io.Serializable'. See the logs for more details.
> >>         at
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
> >>         at
> >>
> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
> >>         at
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
> >>         at
> >>
> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
> >>         at
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
> >>         at
> >>
> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
> >>         at
> >>
> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
> >>         at
> >> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
> >>         at
> >> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
> >>         ........
> >>
> >> Expert of the POST request from Firebug:
> >>
> >> c0-e2=null:null
> >> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
> >>
> >>
> >>
> >> Now if I change the interface's type from Serializable to lets say
> >> Longeverything works fine. I think that this is because of the way
> >> generics
> >> work, the compiler creates two setId() methods in the SomeBean class
> >> like:
> >>
> >> public class SomeBean implements Identifiable<Long> {
> >>
> >>     ...
> >>
> >>     void setId(Serializable id);
> >>
> >>     void setId(Long id);
> >> }
> >>
> >>
> >> ------------------------------
> >> Χρησιμοποιείτε Yahoo!
> >> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
> >> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
> >> http://login.yahoo.com/config/mail?.intl=gr
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>
>

Re: Marshaling problem with Java 5 Generics

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Use ** instead of * to map subclasses in a package. IIRC use * as javascript attribute value-

Regards

On Thu, Oct 22, 2009 at 2:53 PM, nbourdeau <nbourdeau@...> wrote:

I'm using 3.0 RC1
What exactly can I do ?


XMaNIaC wrote:
>
> In fact, with 3.0 you can
> Regards
>
> On Wed, Oct 21, 2009 at 11:35 PM, nbourdeau <nbourdeau@...>
> wrote:
>
>>
>> Do we really need to "use class mappings in the client" ???
>> Since we have a lot of class, it makes an ugly dwr.xml because we cannot
>> use
>> wildcards to map converters to classes with this technique ...
>>
>> Have an idea ??
>>
>>
>> XMaNIaC wrote:
>> >
>> > Add a bean converter for serializable (it just has to be there) and use
>> > class mappings in the client. And use a build of DWR3
>> >
>> > 2008/12/1 Dimitris M. <dmenounos@...>
>> >
>> >> Hi I am facing the following problem with beans that use Java 5
>> Generics:
>> >>
>> >> Generic Interface:
>> >>
>> >> public interface Identifiable {
>> >>
>> >>     I getId();
>> >>
>> >>     void setId(I id);
>> >> }
>> >>
>> >> Bean that implements the above generic interface:
>> >>
>> >> public class SomeBean implements Identifiable<Long> {
>> >>
>> >>     private Long id;
>> >>
>> >>     public Long getId() {
>> >>         return id;
>> >>     }
>> >>
>> >>     public void setId(Long id) {
>> >>         this.id = id;
>> >>     }
>> >>
>> >>     // more stuff ...
>> >> }
>> >>
>> >> dwr.xml:
>> >>
>> >> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
>> >> SomeBean" />
>> >>
>> >>
>> >> DWR cannot convert such an object from Javascript to Java:
>> >>
>> >> org.directwebremoting.extend.MarshallException: Error marshalling
>> >> java.io.Serializable: No converter found for 'interface
>> >> java.io.Serializable'. See the logs for more details.
>> >>         at
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
>> >>         at
>> >>
>> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
>> >>         at
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>> >>         at
>> >>
>> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
>> >>         at
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>> >>         at
>> >>
>> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
>> >>         at
>> >>
>> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
>> >>         at
>> >>
>> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
>> >>         at
>> >> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
>> >>         ........
>> >>
>> >> Expert of the POST request from Firebug:
>> >>
>> >> c0-e2=null:null
>> >> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
>> >>
>> >>
>> >>
>> >> Now if I change the interface's type from Serializable to lets say
>> >> Longeverything works fine. I think that this is because of the way
>> >> generics
>> >> work, the compiler creates two setId() methods in the SomeBean class
>> >> like:
>> >>
>> >> public class SomeBean implements Identifiable<Long> {
>> >>
>> >>     ...
>> >>
>> >>     void setId(Serializable id);
>> >>
>> >>     void setId(Long id);
>> >> }
>> >>
>> >>
>> >> ------------------------------
>> >> Χρησιμοποιείτε Yahoo!
>> >> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει την
>> >> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
>> >> http://login.yahoo.com/config/mail?.intl=gr
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
>> Sent from the DWR - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26009370.html
Sent from the DWR - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: Marshaling problem with Java 5 Generics

by nbourdeau :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I tried doing what you said.
I've run into the following problems :

At startup :

[2009-10-22 10:47:22,544][WARN ][http-8080-exec-1][DefaultConverterManager] Could not load class [mypackage.myclass]. Conversion will try to work upon other runtime information

At runtime :

2009-10-22 10:44:06,131][WARN ][http-8080-exec-4][DefaultRemoter] Failed to create class definition for JS class *
java.lang.NullPointerException ...

If I remove javascript="*" from the convert configuration, all seems to be ok.

XMaNIaC wrote:
Use ** instead of * to map subclasses in a package. IIRC use * as javascript
attribute value-

Regards

On Thu, Oct 22, 2009 at 2:53 PM, nbourdeau <nbourdeau@diffusion.cc> wrote:

>
> I'm using 3.0 RC1
> What exactly can I do ?
>
>
> XMaNIaC wrote:
> >
> > In fact, with 3.0 you can
> > Regards
> >
> > On Wed, Oct 21, 2009 at 11:35 PM, nbourdeau <nbourdeau@diffusion.cc>
> > wrote:
> >
> >>
> >> Do we really need to "use class mappings in the client" ???
> >> Since we have a lot of class, it makes an ugly dwr.xml because we cannot
> >> use
> >> wildcards to map converters to classes with this technique ...
> >>
> >> Have an idea ??
> >>
> >>
> >> XMaNIaC wrote:
> >> >
> >> > Add a bean converter for serializable (it just has to be there) and
> use
> >> > class mappings in the client. And use a build of DWR3
> >> >
> >> > 2008/12/1 Dimitris M. <dmenounos@yahoo.com>
> >> >
> >> >> Hi I am facing the following problem with beans that use Java 5
> >> Generics:
> >> >>
> >> >> Generic Interface:
> >> >>
> >> >> public interface Identifiable {
> >> >>
> >> >>     I getId();
> >> >>
> >> >>     void setId(I id);
> >> >> }
> >> >>
> >> >> Bean that implements the above generic interface:
> >> >>
> >> >> public class SomeBean implements Identifiable<Long> {
> >> >>
> >> >>     private Long id;
> >> >>
> >> >>     public Long getId() {
> >> >>         return id;
> >> >>     }
> >> >>
> >> >>     public void setId(Long id) {
> >> >>         this.id = id;
> >> >>     }
> >> >>
> >> >>     // more stuff ...
> >> >> }
> >> >>
> >> >> dwr.xml:
> >> >>
> >> >> <convert converter="hibernate3" match="xxx.yyy.SomeBean" javascript="
> >> >> SomeBean" />
> >> >>
> >> >>
> >> >> DWR cannot convert such an object from Javascript to Java:
> >> >>
> >> >> org.directwebremoting.extend.MarshallException: Error marshalling
> >> >> java.io.Serializable: No converter found for 'interface
> >> >> java.io.Serializable'. See the logs for more details.
> >> >>         at
> >> >>
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
> >> >>         at
> >> >>
> >>
> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
> >> >>         at
> >> >>
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
> >> >>         at
> >> >>
> >>
> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
> >> >>         at
> >> >>
> >>
> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
> >> >>         at
> >> >>
> >>
> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
> >> >>         at
> >> >>
> >>
> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
> >> >>         at
> >> >>
> >> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
> >> >>         at
> >> >> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
> >> >>         ........
> >> >>
> >> >> Expert of the POST request from Firebug:
> >> >>
> >> >> c0-e2=null:null
> >> >> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
> >> >>
> >> >>
> >> >>
> >> >> Now if I change the interface's type from Serializable to lets say
> >> >> Longeverything works fine. I think that this is because of the way
> >> >> generics
> >> >> work, the compiler creates two setId() methods in the SomeBean class
> >> >> like:
> >> >>
> >> >> public class SomeBean implements Identifiable<Long> {
> >> >>
> >> >>     ...
> >> >>
> >> >>     void setId(Serializable id);
> >> >>
> >> >>     void setId(Long id);
> >> >> }
> >> >>
> >> >>
> >> >> ------------------------------
> >> >> Χρησιμοποιείτε Yahoo!
> >> >> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει
> την
> >> >> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
> >> >> http://login.yahoo.com/config/mail?.intl=gr
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
> >> Sent from the DWR - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> >> For additional commands, e-mail: users-help@dwr.dev.java.net
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26009370.html
> Sent from the DWR - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@dwr.dev.java.net
> For additional commands, e-mail: users-help@dwr.dev.java.net
>
>

Re: Marshaling problem with Java 5 Generics

by XMaNIaC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is it working for you then? If not, have you tried javascript="**"?

Regards

On Thu, Oct 22, 2009 at 4:48 PM, nbourdeau <nbourdeau@...> wrote:

I tried doing what you said.
I've run into the following problems :

At startup :

[2009-10-22 10:47:22,544][WARN ][http-8080-exec-1][DefaultConverterManager]
Could not load class [mypackage.myclass]. Conversion will try to work upon
other runtime information

At runtime :

2009-10-22 10:44:06,131][WARN ][http-8080-exec-4][DefaultRemoter] Failed to
create class definition for JS class *
java.lang.NullPointerException ...

If I remove javascript="*" from the convert configuration, all seems to be
ok.


XMaNIaC wrote:
>
> Use ** instead of * to map subclasses in a package. IIRC use * as
> javascript
> attribute value-
>
> Regards
>
> On Thu, Oct 22, 2009 at 2:53 PM, nbourdeau <nbourdeau@...> wrote:
>
>>
>> I'm using 3.0 RC1
>> What exactly can I do ?
>>
>>
>> XMaNIaC wrote:
>> >
>> > In fact, with 3.0 you can
>> > Regards
>> >
>> > On Wed, Oct 21, 2009 at 11:35 PM, nbourdeau <nbourdeau@...>
>> > wrote:
>> >
>> >>
>> >> Do we really need to "use class mappings in the client" ???
>> >> Since we have a lot of class, it makes an ugly dwr.xml because we
>> cannot
>> >> use
>> >> wildcards to map converters to classes with this technique ...
>> >>
>> >> Have an idea ??
>> >>
>> >>
>> >> XMaNIaC wrote:
>> >> >
>> >> > Add a bean converter for serializable (it just has to be there) and
>> use
>> >> > class mappings in the client. And use a build of DWR3
>> >> >
>> >> > 2008/12/1 Dimitris M. <dmenounos@...>
>> >> >
>> >> >> Hi I am facing the following problem with beans that use Java 5
>> >> Generics:
>> >> >>
>> >> >> Generic Interface:
>> >> >>
>> >> >> public interface Identifiable {
>> >> >>
>> >> >>     I getId();
>> >> >>
>> >> >>     void setId(I id);
>> >> >> }
>> >> >>
>> >> >> Bean that implements the above generic interface:
>> >> >>
>> >> >> public class SomeBean implements Identifiable<Long> {
>> >> >>
>> >> >>     private Long id;
>> >> >>
>> >> >>     public Long getId() {
>> >> >>         return id;
>> >> >>     }
>> >> >>
>> >> >>     public void setId(Long id) {
>> >> >>         this.id = id;
>> >> >>     }
>> >> >>
>> >> >>     // more stuff ...
>> >> >> }
>> >> >>
>> >> >> dwr.xml:
>> >> >>
>> >> >> <convert converter="hibernate3" match="xxx.yyy.SomeBean"
>> javascript="
>> >> >> SomeBean" />
>> >> >>
>> >> >>
>> >> >> DWR cannot convert such an object from Javascript to Java:
>> >> >>
>> >> >> org.directwebremoting.extend.MarshallException: Error marshalling
>> >> >> java.io.Serializable: No converter found for 'interface
>> >> >> java.io.Serializable'. See the logs for more details.
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:147)
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.convert.BasicObjectConverter.convertInbound(BasicObjectConverter.java:139)
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.convert.ArrayConverter.convertInbound(ArrayConverter.java:93)
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.dwrp.DefaultConverterManager.convertInbound(DefaultConverterManager.java:159)
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.dwrp.BaseCallMarshaller.marshallInbound(BaseCallMarshaller.java:155)
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:44)
>> >> >>         at
>> >> >>
>> >>
>> org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)
>> >> >>         at
>> >> >>
>> org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)
>> >> >>         ........
>> >> >>
>> >> >> Expert of the POST request from Firebug:
>> >> >>
>> >> >> c0-e2=null:null
>> >> >> c0-e1=Object_SomeBean:{id:reference:c0-e2, ...other-properties...}
>> >> >>
>> >> >>
>> >> >>
>> >> >> Now if I change the interface's type from Serializable to lets say
>> >> >> Longeverything works fine. I think that this is because of the way
>> >> >> generics
>> >> >> work, the compiler creates two setId() methods in the SomeBean
>> class
>> >> >> like:
>> >> >>
>> >> >> public class SomeBean implements Identifiable<Long> {
>> >> >>
>> >> >>     ...
>> >> >>
>> >> >>     void setId(Serializable id);
>> >> >>
>> >> >>     void setId(Long id);
>> >> >> }
>> >> >>
>> >> >>
>> >> >> ------------------------------
>> >> >> Χρησιμοποιείτε Yahoo!
>> >> >> Βαρεθήκατε τα ενοχλητικά μηνύ ματα (spam); Το Yahoo! Mail διαθέτει
>> την
>> >> >> καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων
>> >> >> http://login.yahoo.com/config/mail?.intl=gr
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26000658.html
>> >> Sent from the DWR - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@...
>> >> For additional commands, e-mail: users-help@...
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26009370.html
>> Sent from the DWR - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>

--
View this message in context: http://www.nabble.com/Marshaling-problem-with-Java-5-Generics-tp20779297p26011315.html
Sent from the DWR - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...