Re: [orientdb] Google App Engine and nuvoladb

246 views
Skip to first unread message

Luca Garulli

unread,
Sep 7, 2012, 1:01:32 AM9/7/12
to orient-...@googlegroups.com
Hi Michele,
seems there is a problem with the class loader. Have you deployed all the jars?

Lvc@

On 7 September 2012 04:08, Michele Orsi <doctor...@gmail.com> wrote:
Hi,
I am trying to use nuvolabae with google app engine, but I am stuck ..
I think it's not possible to use such kind of PaaS because it is too strict, but I want in to share with you my errors .. Just in case they are solvable.

This is what I get when I run locally my app:

java.lang.ExceptionInInitializerError
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:69)
	at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
	at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.open(ODatabaseRaw.java:87)
	at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:47)
	at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:108)
	at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:47)
	at com.orientechnologies.orient.core.db.graph.OGraphDatabase.open(OGraphDatabase.java:78)
	at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:370)
	at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:64)
	at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:68)
	at (my row)

.. and here is my code inside  a servlet:
OGlobalConfiguration.CACHE_LEVEL1_ENABLED.setValue(false);
        OGlobalConfiguration.CACHE_LEVEL2_ENABLED.setValue(false);

        Graph graph = new OrientGraph("remote:dashboard.nuvolabase.com:2424/db/free/..", <user>, <password>);
       
        System.out.println("starting delete ..");
        for (Vertex vertex : graph.getVertices()) {
            System.out.println("vertex id: , "+vertex.getId()+", name: "+vertex.getProperty("name"));
            graph.removeVertex(vertex);
        }
        System.out.println("finished delete ..");

If I deploy it's even worse ..
Can I do something? Or just switching to another PaaS? I am looking at Heroku

Thanks,
Michele

--
 
 
 

Michele Orsi

unread,
Sep 9, 2012, 5:51:51 PM9/9/12
to orient-...@googlegroups.com
ok I re-deployed everything, I fixed the application-web.xml with this line:
<system-properties>
        <property name="os.arch" value="x86" />
</system-properties>

.. but now I have a new error:

Nested in java.lang.ExceptionInInitializerError:
java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)
	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:355)
	at java.security.AccessController.checkPermission(AccessController.java:567)
	at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
	at com.google.apphosting.runtime.security.CustomSecurityManager.checkPermission(CustomSecurityManager.java:56)
	at com.google.apphosting.runtime.security.CustomSecurityManager.checkAccess(CustomSecurityManager.java:131)
	at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)
	at java.lang.Thread.init(Thread.java:353)
	at java.lang.Thread.<init>(Thread.java:437)
	at com.orientechnologies.orient.core.OrientShutdownHook.<init>(OrientShutdownHook.java:19)
	at com.orientechnologies.orient.core.Orient.<clinit>(Orient.java:66)
	at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.open(ODatabaseRaw.java:87)
	at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:47)
	at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:108)
	at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:47)
	at com.orientechnologies.orient.core.db.graph.OGraphDatabase.open(OGraphDatabase.java:78)
	at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:370)
	at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:64)
	at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:68)

(my code) at this line Graph graph = new OrientGraph("remote:dashboard.nuvolabase.com:2424/db/free/morsi/"+name, user, pass);

I looked through the source code and the problems seems to be here (Orient.java line 66):

protected static final OrientShutdownHook shutdownHook = new OrientShutdownHook();

.. because the class "OrientShutdownHook" extends a Thread

public class OrientShutdownHook extends Thread { ..

.. and Google App Engine doesn't allow to do this:

https://developers.google.com/appengine/docs/java/runtime#The_Sandbox

.. but it allows to implements runnable.

If you don't have time I would like to help a bit in fixing this issue; which is the best way I can help you?
I created a github project to test the possible fix here:
https://github.com/micheleorsi/orient-gae
.. but I don't yet pushed the code (downloaded from http://orient.googlecode.com/svn/) because I don't want to create problems to your copyright!

I hope I can help in some ways, I really need to have it up&running on GAE! Because I want to use it for our project:
http://www.map2app.com/
.. that is completely hosted on Google App Engine!

Thanks
Michele

Luca Garulli

unread,
Sep 9, 2012, 5:56:04 PM9/9/12
to orient-...@googlegroups.com
Hi Michele,
no problem about the copyright! Apply your patch, test it against your scenario and run the test cases:

> ant clean test

If all the tests pass send us the patch as SVN patch (http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion) and if there aren't problems we will apply in minutes!

Lvc@

--
 
 
 

Michele Orsi

unread,
Sep 14, 2012, 4:22:27 AM9/14/12
to orient-...@googlegroups.com
ok perfect, I investigated a bit the problem and now I need a suggestion from you: I saw the main problem is the usage of Thread in orientdb, that is not allowed in Google App Engine. But if I don't run the Threads the connection to nuvolabase doesn't work anymore ..

So (from the GAE documentation here https://developers.google.com/appengine/docs/java/runtime#The_Sandbox) I should use another class (i.e. com.google.appengine.api.ThreadManager().currentRequestThreadFactory()) that is in a GAE lib. But I think I cannot add dependencies to orientdb-core; so what should I do? Fork the lib? And mantain this new project?

Thanks
Michele

Gabriel Vince

unread,
Sep 14, 2012, 4:47:22 AM9/14/12
to orient-...@googlegroups.com
Hi Michel,

Google Apps is quite restrictive PaaS what concerns Java classes, but I see good reasons behind (well - it his is a source of the love/hate relations between Oracle and Google). I don't know - how much effort would it take you to use REST API?

Gabriel

Michele Orsi

unread,
Sep 14, 2012, 5:11:02 AM9/14/12
to orient-...@googlegroups.com
Hi Gabriel,
yep I understand the concern, but with the needs of my startup (map2app) perfectly fits with this PaaS. And in fact we are really happy about it!
When you speak of REST API, you mean nuvolabase REST API, right? (http://code.google.com/p/orient/wiki/OrientDB_REST)

Well at the moment I am using tinkerpop blueprints API, because this is my first approach to graph DB and I want to understand first the persistence on a graph datastore from a well structured layer (edge and vertices oriented). So, if it is possible, I would prefer to spend time in fixing the orientdb libs more than creating a layer to abstract these concepts.
It would be interesting if nuvolabase has tinkerpop Rexster API, but I don't think so .. Am I wrong?

Gabriel Vince

unread,
Sep 14, 2012, 5:24:47 AM9/14/12
to orient-...@googlegroups.com

Michel,

indeed I meant nuvolabase REST API. In theory - it would be possible to create a OEngine and OStorage to communicate via REST, but it wouldn't solve the problem as lot of core classes are accessing the Thread class (well, there are reasons it is done that way).

you are right, with the REST API you couldn't leverage tinkerpop api directly, nevertheless you will be able to utilize gremlin queries and commands. Personally never tried, but maybe if you try to deploy to the OpenShift PaaS, it could work (it is less restrictive on the class access level).

Gabriel

Op vrijdag 14 september 2012 11:11:02 UTC+2 schreef Michele Orsi het volgende:

Michele Orsi

unread,
Sep 14, 2012, 5:31:01 AM9/14/12
to orient-...@googlegroups.com
ah ok perfect!!!
This is really a good suggestion: I looked at heroku, but for the moment I didn't succeed .. Ok I'll try with OpenShift, it's my first time as well!

Thank you very much!
Michele

Luca Garulli

unread,
Sep 14, 2012, 7:27:36 AM9/14/12
to orient-...@googlegroups.com
Hi,
about the Thread management we use 2 threads in background:
  • Watchdog: that free memory under the hood
  • PushRequest: read requests sent in push mode from the server
We could think to a sort of factory to create threads ;-)

Lvc@

--
 
 
 

Reply all
Reply to author
Forward
0 new messages