I'm trying to access an S3 bucket from Google app engine and I get an exception regarding a restricted class trying to initialize the AmazonS3Client client. See code and exception below.
Any idea how to make this work?
Code:
AmazonS3 s3 = new AmazonS3Client(new ClasspathPropertiesFileCredentialsProvider());
Exception:
Caused by: java.lang.NoClassDefFoundError: javax.management.MBeanServerFactory is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at com.amazonaws.jmx.MBeans.getMBeanServer(MBeans.java:111)
at com.amazonaws.jmx.MBeans.registerMBean(MBeans.java:50)
at com.amazonaws.jmx.SdkMBeanRegistrySupport.registerMetricAdminMBean(SdkMBeanRegistrySupport.java:27)
at com.amazonaws.metrics.AwsSdkMetrics.registerMetricAdminMBean(AwsSdkMetrics.java:330)
at com.amazonaws.metrics.AwsSdkMetrics.<clinit>(AwsSdkMetrics.java:308)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at com.google.appengine.tools.development.agent.runtime.RuntimeHelper.checkRestricted(RuntimeHelper.java:70)
at com.google.appengine.tools.development.agent.runtime.Runtime.checkRestricted(Runtime.java:64)
at com.amazonaws.services.s3.AmazonS3Client.<clinit>(AmazonS3Client.java:231)
The error you encountered means that a class used by the AWS SDK is not allowed within App Engine (for some obscure reasons).
Even if you manage to bypass this error, the AWS SDK could not be run on GAE because it uses HttpClient and not URLFetch.
For more information you could read :
http://www.apcjones.com/blog/2010/11/aws-sdk-for-java-modified-to-run-on-google-app-engine.html
Can i use org.apache.http.client.HttpClient in google app engine?
Related
Could someone please mention the exact steps needed to deploy a spring project to GCP.
I tried doing it through eclipse by changing it to a JAR file and pressing Deploy to appengine flexible such as:
but an error occurred which was:
The error was:
(gcloud.app.deploy) Error Response: [8] Flex operation projects/interestcalculation/regions/asia-southeast2/operations/e1ad81d6-c153-4a64-ab95-d5b8c544c7c8 error [RESOURCE_EXHAUSTED]: An internal error occurred while processing task /app-engine-flex/insert_flex_deployment/flex_create_resources>2021-07-27T07:24:30.414Z5288.fk.0: The requested amount of instances has exceeded GCE's default quota. Please see https://cloud.google.com/compute/quotas for more information on GCE resources
This is my app.yaml file:
Please Help, Thank You!
Based on #guillaumeblaquiere, #FerreginaMasalo comments, to mitigate the error in App Engine, you can do the following:
As the error refers to a specific region, try deploying your app in another one as there might be not enough resources to allow VM deployment in the region you selected.
Verify your quota.
Request the quota increase if it's necessary.
I Am integrated Twillio SMS API in my Java web application hosted in Google App Engine. So I also have the purchase account Of Twillio, so I want to store receiving SMS in my database so that why I already written a code and so I already included all Jackson Jar library File(jackson-core-asl ,jackson-mapping) in my project. But this exception remains the same:
Uncaught exception from servlet java.lang.NoClassDefFoundError:
org/codehaus/jackson/JsonParseException at
com.twilio.sdk.TwilioRestResponse.getParser(TwilioRestResponse.java:226)
at
com.twilio.sdk.TwilioRestResponse.toMap(TwilioRestResponse.java:244)
at
com.twilio.sdk.resource.ListResource.parseResponse(ListResource.java:212)
at com.twilio.sdk.resource.Resource.load(Resource.java:53) at
com.twilio.sdk.resource.ListResource.getPageData(ListResource.java:196)
at
com.twilio.sdk.resource.ListResource.iterator(ListResource.java:70)
I try to make a SP hosted on Google app engine, with a third party IdP, and I'm facing multiple problems.
I'm using Spring SAML extension for java. I was able to run the stand alone (not in GAE) demo app, from the official guide http://docs.spring.io/spring-security-saml/docs/1.0.x/reference/html/chapter-quick-start.html using as IdP idp.ssocircle.com.
Now my problem comes whey I tried to integrate this code in my GAE project. When running with GAE I can get to the phase where I'm redirected to do the login on ssocircle.com and from there when I should be redirected back to my page I'm getting this error: "Error 401 Authentication Failed: Error decoding incoming SAML message", and on local GAE server logs I can see this message
"[INFO] Dec 17, 2014 5:21:23 PM org.apache.commons.httpclient.HttpMethodDirector executeWithRetry [INFO] INFO: I/O exception (java.net.SocketException) caught when processing request: Permission denied: Not allowed to issue a socket bind: permission denied."
I was wondering if this is a limitation from GAE regarding sockets: 1) Sockets are available only for paid apps (I don't have a paid app, but could consider this options) 2) You cannot create a listen socket; you can only create outbound sockets. 3) You cannot bind to specific IP addresses or ports. (for me this one sounds like it is my problem).
And whey I tried to deploy on GAE, the app remained in a start-up loop because of other errors regarding "nested exception is java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup")", that sounds like another GAE limitation to me.
At some point I was ready to gave up, because I was thinking that SAML Spring extension can't work with GAE, because of limitations present on GAE. But I see you have the same project running as a demo on GAE (or at least I think it is running on GAE because of the appspot part in domain name). https://saml-federation.appspot.com/saml/discovery?returnIDParam=idp&entityID=saml-federation.appspot.com
I would appreciate if you can give me some hints regarding my problems, and best would be if you could help me with the source code of this demo project (could not find it anywhere), and all configuration that is needed for GAE.
I've created a new repository https://github.com/vschafer/spring-security-saml-gae which includes instructions for deployment of Spring SAML applications on Google Application Engine. It also includes classes helping to avoid issues you're facing (sockets and threads).
In order to use it:
include the jar created from the repo in your project
use the provided org.springframework...StaticFilesystemMetadataProvider for loading of your metadata
in case you are using HTTP-Artifact binding replace bean org.springframework...ArtifactResolutionProfileImpl with org.springframework...google.ArtifactResolutionProfileGAE
Please comment if you spot some mistakes in the documentation or code.
When attempting to run a Java application in the local Google App Engine instance I am getting the following error:
java.lang.NoClassDefFoundError: javax.servlet.FilterChain is a restricted class. Please see the Google App Engine developer's guide for more details.
My RemoteServiceServlet doesn't contain any reference to the FilterChain class.
I actually found the answer (or at least, an answer) to this question before posting it, but thought that it was worth putting it onto SO for anyone else who has the same problem. The solution was to revert back to an earlier JDK. I was using 1.7.0_55, and when I went back to 1.7.0_21 the problem went away. I found the solution here. Using Eclipse the JDK version can be changed in the Debug Configurations dialog, on the JRE tab.
As stated in the title, is there a way of doing this using Google Plugin for eclipse?
I tried to generate it using Generate Cloud Endpoints class in GPE, I got this error in appengine log:
org.datanucleus.metadata.MetaDataManager loadPersistenceUnit: Class com.UserDataEndpoint was specified in persistence-unit transactions-optional but not annotated, so ignoring
All the classes I generate using "Generate Cloud Endpoints class" have this error, and can't do any transactions in the API Explorer.
I read in other thread of Stackoverflow, but there is no clear guide on doing this correctly, so I opened a new thread.
Thank you
EDIT : I forgot to mention that I'm using GPE App Engine Connected Android Project wizard to deal with Objectify 5