Friday, April 29, 2011

Re: Trying to send image to server

On 4/29/2011 9:17 AM, Patssay wrote:
> Hi,
>
> Thanks.
> So I should have the Email class in the shared folder?
Yes
> Also should the module.gwt.xml file be updated?
Yes - it should have:

<source path='shared' />

it it.

But mainly, you need to make sure that your server-side classpath contains the file, because the
server must be able to instantiate it.

That's what your original error seemed to imply. GWT de-serializes classes on the server by looking
for the classname as a string in the RPC payload and then doing a 'Class.forName'. Thus the class
must be available to the server classloader. To be honest, I don't understand why yours isn't if you
are using eclipse, because the typical GWT project setup adds all the classes in the src folder to
the classpath. Are you getting this problem when you are running under the debugger in Eclipse? or
only when you deploy. If its the later, you should check that the *client* and *shared* .class files
are present under WEB-INF/war/classes folder.

HTH

Alan


> Actually I am trying to implement the functionality of sending email
> from my gwt application.
> I have the functionality up and running on the server. All it needs is
> the
> email addresses from the client and the image that should be sent from
> the client to the server.
> Hence the need for class email which has all these attributes
> enclosed.
> From what I read gwt allows the user defined classes to be sent to the
> server provided they are serialized.
> Really appreciate your help.
>
> Cheers,
> Sayali
>
> On Apr 29, 8:36 am, Alan Chaney<a...@mechnicality.com> wrote:
>> You need to make sure that your client class is in the *server's* classpath. The exception below
>> indicates that its not.
>>
>> I make it a practice to have a 'shared' package hierarchy parallel to my client packages and ensure
>> that:
>>
>> A. shared is declared in the module gwt.xml file
>>
>> B. shared is also available to the server C/P
>>
>> HTH
>>
>> Alan
>>
>> On 4/29/2011 6:25 AM, Patssay wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> Hi,
>>> I am trying to send an image from client to server.
>>> I have used ImageResources on client side to load images.
>>> but now i want to send the image to server side and send mail
>>> from the server side?
>>> I tried creating class on client side and made it seriablizable.
>>> but it throws errors.
>>> aused by: java.lang.ClassNotFoundException:
>>> umd.hci.greetingcardmaker.client.Email
>>> at java.lang.ClassLoader.findClass(Unknown Source)
>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>> at java.lang.ClassLoader.loadClass(Unknown Source)
>>> at
>>> org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java :
>>> 352)
>>> at
>>> org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java :
>>> 337)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Unknown Source)
>>> at
>>> com.google.gwt.user.server.rpc.RPC.getClassFromSerializedName(RPC.java:
>>> 700)
>>> at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:290)
>>> ... 22 more
>>> Email is my defined client side class.
>>> Thanks
>>> Sayali
>> --
>> Alan Chaney
>> CTO and Founder, Mechnicality, Inc.www.mechnicality.com


--
Alan Chaney
CTO and Founder, Mechnicality, Inc.
www.mechnicality.com

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment