I'm using Quercus/PHP on AppEngine. When I run a simple script with file_get_contents($url); I get an error:
java.lang.NoClassDefFoundError: java.net.Socket is a restricted class.
Please see the Google App Engine developer's guide for more details.
I've googled and although I find that other's have run into the same error, but the cause seems the vary. What do you think is cousing this error for me?
I'm using the latest AppEngine Java SDK, and the latest Quercus.
olivierlemasle is right, but here is the solution that I found after some more searching; in the comments section, user "Phil" recommend:
import java.net.URL;
define('URLFetchServiceFactory', new Java('com.google.appengine.api.urlfetch.URLFetchServiceFactory'));
$data = URLFetchServiceFactory->getURLFetchService()->fetch(new URL($url))->getContent();
Tested, and it worked!
When using Google AppEngine/Java, you don't really have access to a complete JVM: your applications run in a restricted sandbox. See documentation here :
https://developers.google.com/appengine/docs/java/runtime?hl=en#The_Sandbox
According to this documentation, you cannot open a socket in this sandbox. That's why it's written that "java.net.Socket is a restricted class".
App Engine support for java.net.Socket is starting to roll out on 1.7.2 with trusted tester submissions being taken now.
There will be some limitations but it should support a majority of uses.
Sign ups are here:
https://docs.google.com/a/google.com/spreadsheet/viewform?formkey=dF9QR3pnQ2pNa0dqalViSTZoenVkcHc6MQ#gid=0
It's been popular so only a fraction will be enabled.
According to the homepage of your api (http://quercus.caucho.com/) it can use hibernate. Quick googling gave back this for me: GWT and Hibernate - NoClassDefFoundError when using Hibernate
It says hibernate will not work with google app engine. Maybe this is the answer.
Related
I am unable to get the current application version in my attempt to migrate App Engine to Java 11. In Java 8 I did:
import com.google.appengine.api.utils.SystemProperty;
String version = SystemProperty.applicationVersion.get().split("\\.")[0];
However, this AppEngine API is deprecated in Java 11 version of AppEngine. Does anyone have an idea how to do this? I am unable to find this anywhere, there seems to be no documentation on this.
Any help is greatly appreciated!
Edit: I already tried to get in from the metadata endpoint (see: https://cloud.google.com/appengine/docs/standard/java/accessing-instance-metadata). This works for the project-id and region, but the documentation does not state anything about the version. Maybe it is not documented, but also accessible this way (it would make sense).
The information is available in the environment variables in the app engine. You should be able to get it through GAE_version environment variable.This is mentioned in the migration notes for app engine.
I am trying to understand NASA world wind java application. The developer guide in the website is not loading saying server down. Anywhere I can get the developer's guide for the java application. If possible, the setup instructions would be helpful as well.
Developer guide for WorldWindJava is hosted on https://goworldwind.org (which seems it was unavailable temporarily). Link mentioned by you actually gets its content for developer guide tab from https://goworldwind.org. It is now available: https://worldwind.arc.nasa.gov/index.html?root=java&javatopic=guide
I wanted to write an application on Google App Engine + Google Cloud Storage for some images processing. But I stumble upon the following exception:
java.awt.image.DirectColorModel is a restricted class.
For image processing, I wanted to try out Apache Commons Imaging. My guess is that any libraries for image processing will stumble on similar error, since probably most of them use java.awt.image.* package. Do you have any idea how to solve this problem?
So basically Google AppEngine does not support java.awt.image.* .
However, you can use the Google AppEngine Image API to work with images.
And you can check this link for more details on Image-API: https://developers.google.com/appengine/docs/java/images/
Btw, similar issue at java.awt.* is not supported by GAE? how to resolve this?
I want to get a users calendar events (entries) via the java google calendar API (V3.0). Unfortunately, I was unable to find any working example (tutorial) or successfully run anything. What I did so far:
I checked the APIs Explorer and successfully run some requests via the google website and my developer api key (conclusion: my API access works in theory).
I tried to follow the "Your first App"-guide. There are two ways to invoke the API: REST or client libraries. I want to use the java client library.
So I tried to set up the client library : downloaded the jars and added them to the build path (in eclipse) - as I usually do this with external jars. I now can import the classes without errors.
Here, the guide finishes abruptly if I want to use the java client library instead of directly accessing it via REST...
From here I have absolutely no idea what to do. I found a lot of examples in the web (usually for the v1.0 or v2.0 API), but was unable to run any of them. (On Google Developers I found several examples, but all for Android or AppEngine. Nothing worked...)
Does anyone of you know a very simple example to get a users events via Java library (Google Code API)?
solved it on my own. For all of you who want to start using the Google APIs in Eclipse. I highly recommend using Maven which immensely helps including the right jars (actually, it does it for you). Then try this example code (link) to start (OAuth2 authentication). You also will need a dev account and API key from google: link. Then you can start coding :) enjoy!
I know a lot so far about this exception. But I am wondering, if any of you tried to use AdWords API on GAE. AdWords uses Axis as underlying WS library, which do not work on GAE and unfortunately I cannot find solution to make it working. I tried already this: http://dev.bizo.com/2009/04/calling-soap-web-services-on-google-app.html
Does any of you know if there is a way to use AdWords API on GAE with Java?
Thanks in advance for any help
Konrad
The problem is that the adwords client library uses some things that forbiden in GAE's sandboxed environment.
This was resolved by a patch: http://code.google.com/p/google-api-adwords-java/issues/detail?id=62
For more info look here: http://penumbro.us/post/1135755221/adwords-api-on-app-engine-java-part-3