I worry that this may be a naive/obvious thought that probably was
repeated before, but I'll bring it up it anyway: Wouldn't it be
possible, within the App Engine's system classloader implementation,
to attempt to load a local 'stub' implementation of non-whitelisted
JRE classes from the application classpath if it exists, rather than
immediately throwing "X is a restricted class" exceptions?
For the java.rmi.server.UID example, say I packaged java/rmi/server/
UID.class with my deployed application that simply contained:
package java.rmi.server;
public class UID { }
So when the offending deployed library invokes "new java.rmi.server.UID
()", instead of failing on a restricted class load attempt it would
just load my safe stub implementation and the app would carry on as
normal. This would allow developers to provide properly sandboxed
alternatives to restricted classes, and it would allow one to import
packaged/proprietary Java libraries without having to recompile/
package or submit/request changes to the third-party project.
Further along down the line, I would expect a package of "safe" drop-
in replacements for the whole range of restricted JRE classes to
emerge that would make it much easier to drop existing/legacy
libraries into the App Engine without any fuss.
Is there some obvious reason why something like this is not possible/
allowable that I am missing?
On Oct 29, 4:57 pm, Pion <[email protected]> wrote:
> I have just posted the following on Jena group
> -http://tech.groups.yahoo.com/group/jena-dev/message/41935.
>
> --- In [email protected], "pionx2000" <onlee2...@...> wrote:
>
>
>
>
>
> > Thanks Taylor and Andy for your help.
>
> > Now I can get it to work on the Google App Engine per your
> > advice/instructions/sample code!
>
> > Although it works now, I don't know if I did it correctly. I
> > amrelatively new with Jena, Google App Engine, Google Web Toolkit and
> > even Javabuild environments (ant, maven, etc). I only downloaded the
> > compiled Jenabinaries in the past never build from the source directly.
>
> > Anyway, I did the following:
>
> > 1. Update to the latest Jena 2.6.2. My environments: GAE Java
> > 1.2.6, GWT 1.7.1, Eclipse(Galileo), Windows
> > Vista (32-bit).
>
> > 2. " svn cohttps://jena.svn.sourceforge.net/svnroot/jena
> > jena" as shown onhttp://sourceforge.net/projects/jena/develop
> > <http://sourceforge.net/projects/jena/develop> .
>
> > a. Edit
> > D:\download\jena-src-2.6.2\jena-ARQ\ARQ\tags\ARQ-2.8.1\src\com\hp\hpl\je\
> > na\sparql\lib\Metafile.javaas the following:
>
> > public voidaddMetadata(String resourceName)
>
> > {
>
> > resources.add(resourceName) ;
>
> > //read(properties, resourceName) ;
>
> > init();
>
> > }
>
> > static private boolean initialized = false;
>
> > private void init()
>
> > {
>
> > if ( ! initialized )
>
> > {
>
> > initialized = true ;
>
> > properties = new Properties() ;
>
> > }
>
> > }
>
> > b. Build using maven – not ant
>
> > c. Copy the target\arq-2.8.1-jar to war\WEB-INF\lib
>
> > 3. "cvs
> > -z3-d:pserver:anonym...@...:/cvsroot/jena co –P
> > jena2" asshown on as shown on
> >http://sourceforge.net/projects/jena/develop
> > <http://sourceforge.net/projects/jena/develop> .I did this cvs because I
> > could not find AnonId.java on the above tree.
>
> > a. Edit
> > D:\download\jena-src-2.6.2\jena2\src\main\java\com\hp\hpl\jena\rdf\model\
> > \AnonId.java as the following:
>
> > public AnonId() {
>
> > if(JenaParameters.disableBNodeUIDGeneration) {
>
> > synchronized (AnonId.class) {
>
> > id = "A" + idCount++; // +rand.nextLong();
>
> > }
>
> > } else {
>
> > // id = (new UID()).toString();
>
> > id =java.util.UUID.randomUUID().toString();
>
> > }
>
> > }
>
> > b. Build using maven – not ant
>
> > c. Copy the target\jena-2.6.3-SNAPSHOT-jar to war\WEB-INF\lib
>
> > Although there are many hacks, at least I could continueworking for now.
>
> > When are these patches going to be in the next Jena release?
>
> > Again, thanks.
>
> On Oct 29, 9:21 am, Vince Bonfanti <[email protected]> wrote:
>
> > RE: "Since Jena is an open-source (third party) library, I don't have
> > control over it."
>
> > Because Jena is open-source, you *do* have control over it. See what
> > it would take to modify Jena to run on GAE, then submit your patches
> > back to the project owners.
>
> > On Thu, Oct 29, 2009 at 11:20 AM, Pion <[email protected]> wrote:
>
> > > I am using Jena which is an open-source Java framework for building
> > > Semantic Web applications. It's been working fine on my local Eclipse
> > > development. I have just deployed it and it fails because Jena uses
> > > java.rmi.server.UID -- please see the error logs below.
>
> > > java.rmi.server.UID is not listed on
> > >http://code.google.com/intl/de/appengine/docs/java/jrewhitelist.html.
>
> > > Since Jena is an open-source (third party) library, I don't have
> > > control over it. One potential solution is to host Jena outside GAE
> > > such as Amazon EC2. Obviously, it is not ideal.
> > > It solves the limitation of the JRE Class White List but it will
> > > introduce other problems (scalability, another indirection,
> > > maintenance, etc).
>
> > > I am sure this is a common issue as many of us are porting existing
> > > apps/libraries/SDKs to Google App Engine.
>
> > > I'd appreciate your advice on this issue.
> > > Thanks in advance for your help.
>
> > > My environments: GAE Java 1.2.6, GWT 1.7.1, Eclipse(Galileo), Windows
> > > Vista (32-bit).
>
> > > ERROR LOGS
> > > 10-29 07:38AM 59.438 /col/input 500 6020ms 5638cpu_ms 0kb Mozilla/5.0
> > > (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/
> > > 3.5.3 (.NET CLR 3.5.30729),gzip(gfe)
> > > 98.232.111.83 - - [29/Oct/2009:07:39:05 -0700] "POST /col/input HTTP/
> > > 1.1" 500 113 "http://foafan2000.appspot.com/col/
> > > 69AAFD5DE4B9915A24B29439E261B4A5.cache.html" "Mozilla/5.0 (Windows; U;
> > > Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET
> > > CLR 3.5.30729),gzip(gfe)" "foafan2000.appspot.com"
> > > E 10-29 07:39AM 05.433
> > > javax.servlet.ServletContext log: Exception while dispatching incoming
> > > RPC call
> > > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > > 'public abstract java.lang.String com.col.client.CInputService.getFoaf
> > > (java.lang.String)' threw an unexpected exception:
> > > java.lang.NoClassDefFoundError: java.rmi.server.UID is a restricted
> > > class. Please see the Google App Engine developer's guide for more
> > > details.
> > > at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
> > > (RPC.java:360)
> > > at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse
> > > (RPC.java:546)
> > > at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall
> > > (RemoteServiceServlet.java:166)
> > > at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost
> > > (RemoteServiceServlet.java:86)
> > > 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:
> > > 487)
> > > at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > > (ServletHandler.java:1093)
> > > at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
> > > (SaveSessionFilter.java:35)
> > > at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > > (ServletHandler.java:1084)
> > > at
> > > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
> > > (TransactionCleanupFilter.java:43)
> > > at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
> > > (ServletHandler.java:1084)
> > > at org.mortbay.jetty.servlet.ServletHandler.handle
> > > (ServletHandler.java:360)
> > > at org.mortbay.jetty.security.SecurityHandler.handle
> > > (SecurityHandler.java:216)
> > > at org.mortbay.jetty.servlet.SessionHandler.handle
> > > (SessionHandler.java:181)
> > > at org.mortbay.jetty.handler.ContextHandler.handle
> > > (ContextHandler.java:712)
> > > at
> > > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > > 405)
> > > at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
> > > (AppVersionHandlerMap.java:238)
> > > at org.mortbay.jetty.handler.HandlerWrapper.handle
> > > (HandlerWrapper.java:139)
> > > at org.mortbay.jetty.Server.handle(Server.java:313)
> > > at
> > > org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> > > 506)
> > > at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
> > > (HttpConnection.java:830)
> > > at
> > > com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable
> > > (RpcRequestParser.java:76)
> > > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
> > > at
> > > com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
> > > (JettyServletEngineAdapter.java:139)
> > > 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)
> > > Caused by: java.lang.NoClassDefFoundError: java.rmi.server.UID is a
> > > restricted class. Please see the Google App Engine developer's guide
> > > for more details.
> > > at java.rmi.server.UID.<clinit>(UID.java)
> > > at com.hp.hpl.jena.rdf.model.AnonId.<init>(AnonId.java:78)
> > >
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---