using dyuproject on gae java

14 views
Skip to first unread message

Don

unread,
Nov 15, 2009, 7:46:31 AM11/15/09
to dyuproject
Hi,

I am trying to use openid/hybrid in app engine, but so far, no luck.

No success with openid4java (because it creates socket etc), and no
luck with dyuproject either.

How do it deploy dyuproject into my java appengine?
I just could not understand the different structure of the code in
http://dyuproject.googlecode.com/files/dyuproject.appspot.com-source-2009-10-08.zip
It is just so different than the default new google web application.

Many thanks..

I have been struggling the whole week...

David Yu

unread,
Nov 15, 2009, 8:37:48 PM11/15/09
to dyupr...@googlegroups.com
What web framework are you using?
If you look at the sample webapp, it interacts with the servlet api directly ... no high level abstraction.
The RequestContext basically wraps HttpServletRequest and HttpServletResponse.

Can you give a link about this new google web application you mentioned?
As far as I know, on appengine any servlet-based war/webapp can be deployed.
And java webapps are all servlet-based.

Cheers


--

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





--
When the cat is away, the mouse is alone.
- David Yu

Don

unread,
Nov 16, 2009, 12:38:57 PM11/16/09
to dyuproject
Hi,

Also I put the webdefault.xml under WEB-INF directory along with
web.xml
I assume it's safe?

Many thanks

On Nov 16, 10:37 am, David Yu <david.yu....@gmail.com> wrote:
> What web framework are you using?
> If you look at the sample webapp, it interacts with the servlet api directly
> ... no high level abstraction.
> The RequestContext basically wraps HttpServletRequest and
> HttpServletResponse.
>
> Can you give a link about this new google web application you mentioned?
> As far as I know, on appengine any servlet-based war/webapp can be deployed.
> And java webapps are all servlet-based.
>
> Cheers
>
>
>
> On Sun, Nov 15, 2009 at 8:46 PM, Don <lydonchan...@gmail.com> wrote:
> > Hi,
>
> > I am trying to use openid/hybrid in app engine, but so far, no luck.
>
> > No success with openid4java (because it creates socket etc), and no
> > luck with dyuproject either.
>
> > How do it deploy dyuproject into my java appengine?
> > I just could not understand the different structure of the code in
>
> >http://dyuproject.googlecode.com/files/dyuproject.appspot.com-source-...
> > It is just so different than the default new google web application.
>
> > Many thanks..
>
> > I have been struggling the whole week...
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "dyuproject" group.
> > To post to this group, send email to dyupr...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > dyuproject+...@googlegroups.com<dyuproject%2Bunsu...@googlegroups.com>
> > .

Don

unread,
Nov 16, 2009, 12:31:47 PM11/16/09
to dyuproject

Hi,

my url: http://3.latest.dontestjava.appspot.com/
I copied and pasted your dyuproject 1.1.6 files into a new project
using war directory.

I can access http://localhost:8080/hybrid/ in localhost, but not on
app engine..in localhost i got redirected to google to signin, altough
then I got 401 Unauthorized (presumably because it's in localhost?)

i got this exception when trying to access /hybrid (http://
3.latest.dontestjava.appspot.com/hybrid) on app engine..i dread to
think that this is another config error :(
please help...
# 1.
11-16 09:24AM 18.369 /hybrid 500 239ms 310cpu_ms 0kb Mozilla/5.0
(Windows; U; Windows NT 5.2; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/
3.5.5,gzip(gfe)
See details

220.245.169.46 - - [16/Nov/2009:09:24:18 -0800] "GET /hybrid
HTTP/1.1" 500 0 "http://3.latest.dontestjava.appspot.com/" "Mozilla/
5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.5) Gecko/20091102
Firefox/3.5.5,gzip(gfe)" "3.latest.dontestjava.appspot.com"

2.
W 11-16 09:24AM 18.579

failed
com.google.apphosting.utils.jetty.RuntimeAppEngineWebAppContext@15a2dc4
{/,/base/data/home/apps/dontestjava/3.337797084084587486}
java.lang.NoClassDefFoundError: Could not initialize class
com.dyuproject.demos.showcase.OAuthGoogleService
at sun.reflect.NativeConstructorAccessorImpl.newInstance0
(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mortbay.util.ajax.JSONPojoConvertor.fromJSON
(JSONPojoConvertor.java:161)
at org.mortbay.util.ajax.JSON.convertTo(JSON.java:528)
at com.dyuproject.json.StandardJSON.parseObject
(StandardJSON.java:164)
at org.mortbay.util.ajax.JSON.parse(JSON.java:721)
at org.mortbay.util.ajax.JSON.parseArray(JSON.java:867)
at org.mortbay.util.ajax.JSON.parse(JSON.java:723)
at com.dyuproject.json.StandardJSON.parseObject
(StandardJSON.java:149)
at org.mortbay.util.ajax.JSON.parse(JSON.java:721)
at com.dyuproject.json.StandardJSON.parseObject
(StandardJSON.java:149)
at org.mortbay.util.ajax.JSON.parse(JSON.java:721)
at com.dyuproject.ioc.DefaultParser.parse(DefaultParser.java:
63)
at com.dyuproject.ioc.ApplicationContext.load
(ApplicationContext.java:102)
at com.dyuproject.ioc.ApplicationContext.load
(ApplicationContext.java:61)
at
com.dyuproject.web.rest.ApplicationServletContextListener.contextInitialized
(ApplicationServletContextListener.java:68)
at org.mortbay.jetty.handler.ContextHandler.startContext
(ContextHandler.java:530)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:
135)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart
(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:40)
at
com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler
(AppVersionHandlerMap.java:191)
at
com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler
(AppVersionHandlerMap.java:168)
at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:127)
at com.google.apphosting.runtime.JavaRuntime.handleRequest
(JavaRuntime.java:239)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:5135)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:5133)
at
com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication
(RpcUtil.java:363)
at com.google.net.rpc.impl.Server$2.run(Server.java:814)
at com.google.tracing.LocalTraceSpanRunnable.run
(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
(LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
at com.google.net.rpc.impl.Server.processRequest(Server.java:
351)
at com.google.net.rpc.impl.ServerConnection.messageReceived
(ServerConnection.java:437)
at com.google.net.rpc.impl.RpcConnection.parseMessages
(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived
(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent
(Connection.java:436)
at com.google.net.async.EventDispatcher.processNetworkEvents
(EventDispatcher.java:762)
at com.google.net.async.EventDispatcher.internalLoop
(EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop
(EventDispatcher.java:101)
at com.google.net.rpc.RpcService.runUntilServerShutdown
(RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run
(JavaRuntime.java:396)
at java.lang.Thread.run(Unknown Source)

3.
C 11-16 09:24AM 18.585

Uncaught exception from servlet
java.lang.NoClassDefFoundError: Could not initialize class
com.dyuproject.demos.showcase.OAuthGoogleService
at sun.reflect.NativeConstructorAccessorImpl.newInstance0
(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance
(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mortbay.util.ajax.JSONPojoConvertor.fromJSON
(JSONPojoConvertor.java:161)
at org.mortbay.util.ajax.JSON.convertTo(JSON.java:528)
at com.dyuproject.json.StandardJSON.parseObject
(StandardJSON.java:164)
at org.mortbay.util.ajax.JSON.parse(JSON.java:721)
at org.mortbay.util.ajax.JSON.parseArray(JSON.java:867)
at org.mortbay.util.ajax.JSON.parse(JSON.java:723)
at com.dyuproject.json.StandardJSON.parseObject
(StandardJSON.java:149)
at org.mortbay.util.ajax.JSON.parse(JSON.java:721)
at com.dyuproject.json.StandardJSON.parseObject
(StandardJSON.java:149)
at org.mortbay.util.ajax.JSON.parse(JSON.java:721)
at com.dyuproject.ioc.DefaultParser.parse(DefaultParser.java:
63)
at com.dyuproject.ioc.ApplicationContext.load
(ApplicationContext.java:102)
at com.dyuproject.ioc.ApplicationContext.load
(ApplicationContext.java:61)
at
com.dyuproject.web.rest.ApplicationServletContextListener.contextInitialized
(ApplicationServletContextListener.java:68)
at org.mortbay.jetty.handler.ContextHandler.startContext
(ContextHandler.java:530)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:
135)
at org.mortbay.jetty.webapp.WebAppContext.startContext
(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart
(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart
(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start
(AbstractLifeCycle.java:40)
at
com.google.apphosting.runtime.jetty.AppVersionHandlerMap.createHandler
(AppVersionHandlerMap.java:191)
at
com.google.apphosting.runtime.jetty.AppVersionHandlerMap.getHandler
(AppVersionHandlerMap.java:168)
at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:127)
at com.google.apphosting.runtime.JavaRuntime.handleRequest
(JavaRuntime.java:239)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:5135)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:5133)
at
com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication
(RpcUtil.java:363)
at com.google.net.rpc.impl.Server$2.run(Server.java:814)
at com.google.tracing.LocalTraceSpanRunnable.run
(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
(LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
at com.google.net.rpc.impl.Server.processRequest(Server.java:
351)
at com.google.net.rpc.impl.ServerConnection.messageReceived
(ServerConnection.java:437)
at com.google.net.rpc.impl.RpcConnection.parseMessages
(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived
(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent
(Connection.java:436)
at com.google.net.async.EventDispatcher.processNetworkEvents
(EventDispatcher.java:762)
at com.google.net.async.EventDispatcher.internalLoop
(EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop
(EventDispatcher.java:101)
at com.google.net.rpc.RpcService.runUntilServerShutdown
(RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run
(JavaRuntime.java:396)
at java.lang.Thread.run(Unknown Source)



On Nov 16, 10:37 am, David Yu <david.yu....@gmail.com> wrote:
> What web framework are you using?
> If you look at the sample webapp, it interacts with the servlet api directly
> ... no high level abstraction.
> The RequestContext basically wraps HttpServletRequest and
> HttpServletResponse.
>
> Can you give a link about this new google web application you mentioned?
> As far as I know, on appengine any servlet-based war/webapp can be deployed.
> And java webapps are all servlet-based.
>
> Cheers
>
>
>
> On Sun, Nov 15, 2009 at 8:46 PM, Don <lydonchan...@gmail.com> wrote:
> > Hi,
>
> > I am trying to use openid/hybrid in app engine, but so far, no luck.
>
> > No success with openid4java (because it creates socket etc), and no
> > luck with dyuproject either.
>
> > How do it deploy dyuproject into my java appengine?
> > I just could not understand the different structure of the code in
>
> >http://dyuproject.googlecode.com/files/dyuproject.appspot.com-source-...
> > It is just so different than the default new google web application.
>
> > Many thanks..
>
> > I have been struggling the whole week...
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "dyuproject" group.
> > To post to this group, send email to dyupr...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > dyuproject+...@googlegroups.com<dyuproject%2Bunsu...@googlegroups.com>
> > .

Don

unread,
Nov 17, 2009, 12:08:33 PM11/17/09
to dyuproject
Hi,
It's all good now..just a matter of file locations...

Thanks

On Nov 17, 2:31 am, Don <lydonchan...@gmail.com> wrote:
> Hi,
>
> my url:http://3.latest.dontestjava.appspot.com/
> I copied and pasted your dyuproject 1.1.6 files into a new project
> using war directory.
>
> I can accesshttp://localhost:8080/hybrid/in localhost, but not on
> read more »

Don

unread,
Nov 17, 2009, 12:51:04 PM11/17/09
to dyuproject
Hi again,

Now that the hybrid+oauth are working, is there a tutorial that guides
me of how to use the OauthGoogleService and the other services?

Basically i want to use hybrid openid+oauth as authentication for my
website,
and somehow i have to save the openid, accesstoken, and email address
on gae datastore.
It's not really clear from reading the code of how to do this..please
provide guidance..

many thanks

On Nov 18, 2:08 am, Don <lydonchan...@gmail.com> wrote:
> Hi,
> It's all good now..just a matter of file locations...
>
> Thanks
>
> On Nov 17, 2:31 am, Don <lydonchan...@gmail.com> wrote:
>
> > Hi,
>
> > my url:http://3.latest.dontestjava.appspot.com/
> > I copied and pasted your dyuproject 1.1.6 files into a new project
> > using war directory.
>
> > I can accesshttp://localhost:8080/hybrid/inlocalhost, but not on
> ...
>
> read more »

David Yu

unread,
Nov 17, 2009, 8:55:49 PM11/17/09
to dyupr...@googlegroups.com
Since you are using the hybrid, you only need to persist the OpenIdUser.
All the other tokens, you can set as attributes of OpenIdUser.
The id of the entity could be:
1. openid.identity -    guaranteed to be unique (this is generated by your openid provider)

2. openid.claimedId - guaranteed to be unique. If the user uses his own site (or blog site) as the claimedId
                               and delegates to a 3rd party openid provider with a local id, that would be the
                               claimedId used. 
                               If the delegate doesn't specifiy a local id, the value of claimedId == openid.identity.
                               If he is not using his own site (or blog site), the value of claimedId == openid.identity.
                              
Advantages of using #2:
- if the user opts to change his delegated openid provider, he will not need to re-register to your site.
If using #1, he will have to re-register. 
Basically #2 is the most flexible.

The value of the entity (
1.  Serialize it with JSON. 
     Entity.setProperty("openid_user", StandardJSON.toJSON(OpenIdUser));
2.  Serialize it with default java serialization.
     Entity.setProperty("openid_user", new Blob(serialized_bytes));
    
     Where the serialized_bytes is generated from:
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       ObjectOutputStream out = new ObjectOutputStream(baos);
       out.writeObject(OpenIdUser);
       byte[] serialized_bytes = baos.toByteArray();

I suggest you use the low level api of the datastore for this.

In the very near future, I will be removing the dependency on jetty-util.
For that release, the default serialization will be protobuf. (which can transparently be transformed to JSON as well).

Hope that helps


> ...
>
> read more »

--

You received this message because you are subscribed to the Google Groups "dyuproject" group.
To post to this group, send email to dyupr...@googlegroups.com.
To unsubscribe from this group, send email to dyuproject+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/dyuproject?hl=.


Don

unread,
Nov 20, 2009, 11:27:03 AM11/20/09
to dyuproject
Thanks for the help!
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages