share in 2 project...

0 views
Skip to first unread message

os2be

unread,
Mar 31, 2008, 10:29:59 AM3/31/08
to Google Web Toolkit
hi

i have a project X (java application)

with some javabean...

i have a project Y (web project)

can i return the javabean of the project X in a rpc call?

thanks

Isaac Truett

unread,
Mar 31, 2008, 11:23:58 AM3/31/08
to Google-We...@googlegroups.com
As long as the class from project X meets the criteria for GWT
serialization[1], yes.

[1] http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.RemoteProcedureCalls.html#SerializableTypes

os2be

unread,
Apr 1, 2008, 4:04:47 AM4/1/08
to Google Web Toolkit
ok i include the first project like a jar in the second projet....

my project y return a javabean (its class is in project X), when i
build, they said my, it can't import it... so it don't find my
javabean...

On 31 mar, 17:23, "Isaac Truett" <itru...@gmail.com> wrote:
> As long as the class from project X meets the criteria for GWT
> serialization[1], yes.
>
> [1]http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.De...

os2be

unread,
Apr 1, 2008, 5:07:13 AM4/1/08
to Google Web Toolkit
in my jar X

in the package

org.server.domain, i have a class User.java

in this package i added: User.gwt.xml who contain this code

<?xml version="1.0" encoding="UTF-8"?>
<module>
<inherits name="com.google.gwt.user.User"/>
<source path="/user"/>
</module>


In project Y

i added

<inherits name="org.server.domain.user"/>


gwt don't find user.gwt.xml from my classpath...

any idea?

gregor

unread,
Apr 1, 2008, 7:39:16 AM4/1/08
to Google Web Toolkit
Hi os2be,

Further to Izaac link, there a lot of posts that might help with this
on the group. Search with, e.g. "inherit second module" for a
reasonable selection. Also there is a good FAQ in the incubator that
describes how GWT finds files, including secondary modules:

http://code.google.com/p/google-web-toolkit-incubator/wiki/PathsHandlingFAQ

The Incubator download is also full of JAR's that do basically what
you want to do so you may find it useful to poke around them to see
how they use *gwt.xml files. Providing your domain classes (e.g. User)
that you want to use client side are compatible with the GWT Emulation
Library, you can definitely do what you want to do, but you have to
set it up right for your own project structure and your dev
environment, including making sure your classpath is correct.

regards
gregor

os2be

unread,
Apr 1, 2008, 8:55:00 AM4/1/08
to Google Web Toolkit
ok now for that it's ok... but i get strange result...

i call my function... it return a user object...

public void onSuccess(Object result) {
Window.alert("ok");
}

i get the windows message...

if i write...

public void onSuccess(Object result) {
User2 user = (User2)result;
Window.alert(user.getName());
Window.alert("ok");
}

i get no message...

any idea?

On 1 avr, 13:39, gregor <greg.power...@googlemail.com> wrote:
> Hi os2be,
>
> Further to Izaac link, there a lot of posts that might help with this
> on the group. Search with, e.g. "inherit second module" for a
> reasonable selection. Also there is a good FAQ in the incubator that
> describes how GWT finds files, including secondary modules:
>
> http://code.google.com/p/google-web-toolkit-incubator/wiki/PathsHandl...

os2be

unread,
Apr 1, 2008, 9:08:18 AM4/1/08
to Google Web Toolkit
when i debug i get

[ERROR] Uncaught exception escaped
java.lang.ClassCastException: java.lang.String
at org.yournamehere.client.MainEntryPoint
$2.onSuccess(MainEntryPoint.java:58)
at org.yournamehere.client.MyService_Proxy
$1.onCompletionImpl(transient source for
org.yournamehere.client.MyService_Proxy:68)
at org.yournamehere.client.MyService_Proxy
$1.onCompletionAndCatch(transient source for
org.yournamehere.client.MyService_Proxy:44)
at org.yournamehere.client.MyService_Proxy$1.onCompletion(transient
source for org.yournamehere.client.MyService_Proxy:38)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:
126)
at
com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:
150)
at
com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:
293)

walden

unread,
Apr 1, 2008, 10:44:06 AM4/1/08
to Google Web Toolkit
It means the object you hoped was a User is actually a String.

On Apr 1, 9:08 am, os2be <coll...@laboiteaprog.com> wrote:
> when i debug i get
>
> [ERROR] Uncaught exception escaped
> java.lang.ClassCastException: java.lang.String
>         at org.yournamehere.client.MainEntryPoint
> $2.onSuccess(MainEntryPoint.java:58)
>         at org.yournamehere.client.MyService_Proxy
> $1.onCompletionImpl(transient source for
> org.yournamehere.client.MyService_Proxy:68)
>         at org.yournamehere.client.MyService_Proxy
> $1.onCompletionAndCatch(transient source for
> org.yournamehere.client.MyService_Proxy:44)
>         at org.yournamehere.client.MyService_Proxy$1.onCompletion(transient
> source for org.yournamehere.client.MyService_Proxy:38)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp­l.java:

robert_trudel

unread,
Apr 1, 2008, 4:43:10 PM4/1/08
to Google Web Toolkit
i have the same problem.... i beginned today with gwt i tried to use 2
project... and i don't find the documentation very clear about that
subject...

you can see a picture of the first project here:

http://imagebin.ca/img/A_UTHaF.png

the structure is very basic...

now in my second project

i would like to use my bean in my second project to display its
information

so i added the java class in the jar of the first project...

so where i need to put the gwt.xml file in the first project...
what's name i need to give it...

in my second project, in the gwt.xml file i willl add

<inherits name=.""/>

which name i will need to use?


any help would be very appreciate



On 1 avr, 13:39, gregor <greg.power...@googlemail.com> wrote:
> Hi os2be,
>
> Further to Izaac link, there a lot of posts that might help with this
> on the group. Search with, e.g. "inherit second module" for a
> reasonable selection. Also there is a good FAQ in the incubator that
> describes how GWT finds files, including secondary modules:
>
> http://code.google.com/p/google-web-toolkit-incubator/wiki/PathsHandl...
>
> The Incubator download is also full of JAR's that do basically what
> you want to do so you may find it useful to poke around them to see
> how they use *gwt.xml files. Providing your domain classes (e.g. User)
> that you want to use client side are compatible with the GWT Emulation
> Library, you can definitely do what you want to do, but you have to
> set it up right for your ownprojectstructure and your dev
> environment, including making sure your classpath is correct.
>
> regards
> gregor
>
> On Apr 1, 10:07 am, os2be <coll...@laboiteaprog.com> wrote:
>
> > in my jar X
>
> > in the package
>
> > org.server.domain, i have a class User.java
>
> > in this package i added: User.gwt.xml who contain this code
>
> > <?xml version="1.0" encoding="UTF-8"?>
> > <module>
> > <inherits name="com.google.gwt.user.User"/>
> > <source path="/user"/>
> > </module>
>
> > InprojectY
>
> > i added
>
> > <inherits name="org.server.domain.user"/>
>
> > gwt don't find user.gwt.xml from my classpath...
>
> > any idea?
>
> > On 1 avr, 10:04, os2be <coll...@laboiteaprog.com> wrote:
>
> > > ok i include the firstprojectlike a jar in the second projet....
>
> > > myprojecty return a javabean (its class is inprojectX), when i
> > > build, they said my, it can't import it... so it don't find my
> > > javabean...
>
> > > On 31 mar, 17:23, "Isaac Truett" <itru...@gmail.com> wrote:
>
> > > > As long as the class fromprojectX meets the criteria for GWT
> > > > serialization[1], yes.
>
> > > > [1]http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.De...
>
> > > > On Mon, Mar 31, 2008 at 10:29 AM, os2be <coll...@laboiteaprog.com> wrote:
>
> > > > > hi
>
> > > > > i have aprojectX (java application)
>
> > > > > with some javabean...
>
> > > > > i have aprojectY (webproject)
>
> > > > > can i return the javabean of theprojectX in a rpc call?
>
> > > > > thanks
Reply all
Reply to author
Forward
0 new messages