gson module problem

267 views
Skip to first unread message

Ahmed Shoeib

unread,
Jul 6, 2010, 6:30:58 AM7/6/10
to Google Web Toolkit
Welcome ,

i add gson lib version 1.4

and i face a problem when trying to inherit it in the gwt.xml file

how i can fix this problem ???


thanks ,
ahmed shoeib

Harald Pehl

unread,
Jul 6, 2010, 8:38:08 AM7/6/10
to Google Web Toolkit
You cannot use gson in GWT. See
http://groups.google.com/group/google-gson/browse_thread/thread/6c3d6476113282e/d09bb094eca25a97
for more infos.

If you need a JSON parser for GWT take a look at Piriti (http://
code.google.com/p/piriti/).

- Harald

eggsy84

unread,
Jul 6, 2010, 3:35:31 PM7/6/10
to Google Web Toolkit
Hi all,

With the latest versions of GWT you don't have to use any other
libraries.

GWT now comes with something known as Javascript Overlays that you can
utilise to convert JSON into Objects.

See here:

http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOverlay.html

Also I have made a bit of a discussion on my blog here:

http://eggsylife.co.uk/2010/04/22/gwt-2-jsonp-and-javascript-overlays-with-jsonprequestbuilder/

Hope this helps,

Eggsy

On Jul 6, 1:38 pm, Harald Pehl <harald.p...@googlemail.com> wrote:
> You cannot use gson in GWT. Seehttp://groups.google.com/group/google-gson/browse_thread/thread/6c3d6...

Ahmed Shoeib

unread,
Jul 7, 2010, 12:41:08 PM7/7/10
to Google Web Toolkit
i need to convert JSON to/From Java Object

how to do it ?
i don't know how to use this way

On Jul 6, 10:35 pm, eggsy84 <jimbob...@hotmail.com> wrote:
> Hi all,
>
> With the latest versions of GWT you don't have to use any other
> libraries.
>
> GWT now comes with something known as Javascript Overlays that you can
> utilise to convert JSON into Objects.
>
> See here:
>
> http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsOver...
>
> Also I have made a bit of a discussion on my blog here:
>
> http://eggsylife.co.uk/2010/04/22/gwt-2-jsonp-and-javascript-overlays...

Marcus Vinícius Bastos de Andrade

unread,
Jul 7, 2010, 1:29:24 PM7/7/10
to google-we...@googlegroups.com
Use JSON in GWT ? It looks like PHP programming!


--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
Marcus Vinícius Bastos de Andrade
http://twitter.com/mynameisflaw
+55 31 9823-3606

lineman78

unread,
Jul 7, 2010, 5:54:01 PM7/7/10
to Google Web Toolkit
The easiest way to convert between JSON and GWT objects is to use
overlay objects. Unfortunately, there is no type checking by doing
this, but you get the best performance. Now, if you need to support
older versions of IE you will need to include json2.js in your
project, but you can use the JSON.parse and JSON.stringify functions
to convert between javascript objects and a JSON string.

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


On Jul 7, 10:41 am, Ahmed Shoeib <ahmedelsayed.sho...@gmail.com>
wrote:

Ahmed Shoeib

unread,
Jul 7, 2010, 6:59:33 PM7/7/10
to Google Web Toolkit
i face this problem

Initializing AppEngine server
07/07/2010 10:57:34 م com.google.apphosting.utils.jetty.JettyLogger
info
INFO: Logging to JettyLogger(null) via
com.google.apphosting.utils.jetty.JettyLogger
07/07/2010 10:57:35 م
com.google.apphosting.utils.config.AppEngineWebXmlReader
readAppEngineWebXml
INFO: Successfully processed C:\Documents and Settings\Sho3ebovich\My
Documents\workspace\EventBuddy\war\WEB-INF/appengine-web.xml
07/07/2010 10:57:35 م
com.google.apphosting.utils.config.AbstractConfigXmlReader
readConfigXml
INFO: Successfully processed C:\Documents and Settings\Sho3ebovich\My
Documents\workspace\EventBuddy\war\WEB-INF/web.xml
The server is running at http://localhost:8888/
{"Member_Email":"te...@example.com", "Member_type":"Organizer"}
07/07/2010 10:58:13 م com.google.apphosting.utils.jetty.JettyLogger
warn
WARNING: Error for /eventbuddy/member
java.lang.UnsatisfiedLinkError:
com.apphuset.eventbuddy.server.MembersServiceImpl.asArrayOfMember_JSON(Ljava/
lang/String;)Lcom/google/gwt/core/client/JsArray;
at
com.apphuset.eventbuddy.server.MembersServiceImpl.asArrayOfMember_JSON(Native
Method)
at
com.apphuset.eventbuddy.server.MembersServiceImpl.doPost(MembersServiceImpl.java:
43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
51)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
43)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
122)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
418)
at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
70)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:349)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)


how to solve it ?????

Ahmed Shoeib

unread,
Jul 7, 2010, 7:05:23 PM7/7/10
to Google Web Toolkit
The Problem line
On Jul 7, 8:29 pm, Marcus Vinícius Bastos de Andrade
<mynameisf...@gmail.com> wrote:
> Use JSON in GWT ? It looks like PHP programming!
>
> On Wed, Jul 7, 2010 at 1:41 PM, Ahmed Shoeib
> <ahmedelsayed.sho...@gmail.com>wrote:
> > google-web-tool...@googlegroups.com<google-web-toolkit%2Bunsu...@googlegroups.com>
> > .

lineman78

unread,
Jul 7, 2010, 8:32:59 PM7/7/10
to Google Web Toolkit
Looks like you are using client side code on the server. You need to
make sure you have a clear understanding of how you are handling
communications. It looks to me that you have JSNI is a server class.
Remember, anything that has a nitave method cannot be loaded by the
server unless that native method is JNI not JSNI. My preferred method
of communication is to use Jersey(JAX-RS) for the server-side JSON
generation and use the RequestBuilder/OverlayType method for the
client side. This is not the only way to do this, this is just the
method that I have chosen to use the most modular and open approach.
If you are only going to be communicating back and forthe between your
own application, why not use GWT's RPC. But if you are set on JSON, I
would suggest not writing any client code first, just the server and
use your browser to access the webservice and ensure that you are
indeed getting the expected JSON, then once you have verified that you
can use RequestBuilder to access the same URL and get the JSON as a
string at which point you can process it into an overlay type and use
it within GWT.
Reply all
Reply to author
Forward
0 new messages