google-api-java-client
google-api-java-client copied to clipboard
enable instance virtual display
Thanks for stopping by to let us know something could be better!
Need the api support for this feature when creating instance https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display
the feature should be added here -- com.google.api.services.compute.model.Instance
This feature is already available in the google-api-services-compute
library:
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.compute.Compute;
import com.google.api.services.compute.model.DisplayDevice;
import com.google.api.services.compute.model.Instance;
import com.google.api.services.compute.model.Operation;
Compute compute = new Compute.Builder(new NetHttpTransport(), new JacksonFactory(), null)
.setApplicationName("my application")
.build();
DisplayDevice displayDevice = new DisplayDevice().setEnableDisplay(true);
Instance instance = new Instance().setDisplayDevice(displayDevice);
Compute.Instances.Insert insert = compute.instances()
.insert("my-project-id", "zone", instance);
Operation operation = insert.execute();
Thanks for looking into. Can you confirm the maven setup for accessing the import class?
Here is what I have now which doesn't have the import available for me
<version.gcp-api-client>1.30.4</version.gcp-api-client>
<version.gcp-api-services-compute>v1-rev193-1.23.0</version.gcp-api-services-compute>
<version.gcp-google-http-client>1.23.0</version.gcp-google-http-client>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>${version.gcp-api-client}</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-compute</artifactId>
<version>${version.gcp-api-services-compute}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${version.gson}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>${version.gcp-google-http-client}</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>${version.gcp-google-http-client}</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>
Ah, you have a very old version of the compute API and the supporting libraries. google-http-client is on version 1.32.1, google-api-client is on 1.30.4, google-api-services-compute is at v1-rev20190825-1.30.3
Is there a reason you need to pin the dependencies so far back?
For the above, I would recommend:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>2.5.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-compute</artifactId>
<version>${version.gcp-api-services-compute}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${version.gson}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
</dependency>
</dependencies>
where version.gcp-api-services-compute
is v1-rev20190825-1.30.3
. The libraries-bom
is a pom.xml we produce that contains a collection of dependency versions that are known to work together. It also contains more recent versions of these supporting libraries.
@chingor13 Thank for following up. I think another dependency issue I am getting following error:
java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest;
java.lang.IllegalStateException: java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest;
at net.sfdc.ci.suava.util.RetryPolicyMethodInterceptor$1.call(RetryPolicyMethodInterceptor.java:68)
at net.sfdc.ci.suava.util.AbstractRetryableCallable.call(AbstractRetryableCallable.java:71)
at net.sfdc.ci.suava.util.RetryableCallable.call(RetryableCallable.java:169)
at net.sfdc.ci.suava.util.RetryPolicyMethodInterceptor.invoke(RetryPolicyMethodInterceptor.java:73)
at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:75)
at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:55)
@hhansalesforce Can you please make sure you using latest version of google-api-client? See here
@chingor13 Can you please help me here?
java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest; at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:435) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:542) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:475) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:592) at com.surveyconsole.admin.screwdrive.activity.gmail.PushNotificationSubscriber.doService(PushNotificationSubscriber.java:45) at com.bhaskaran.ui.ServletAdapter.doPost(ServletAdapter.java:162) at com.bhaskaran.ui.ServletAdapter.doGet(ServletAdapter.java:82) at javax.servlet.http.HttpServlet.service(HttpServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:97)
I am also getting the above exception - google-api-client is up to date. These dependencies are explicitly defined in my pom.xml and I'm still getting the above error.
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.30.9</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
<version>1.93.3</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.106.0</version>
</dependency>
@chingor13 Can you please help me here?
java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest; at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:435) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:542) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:475) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:592) at com.surveyconsole.admin.screwdrive.activity.gmail.PushNotificationSubscriber.doService(PushNotificationSubscriber.java:45) at com.bhaskaran.ui.ServletAdapter.doPost(ServletAdapter.java:162) at com.bhaskaran.ui.ServletAdapter.doGet(ServletAdapter.java:82) at javax.servlet.http.HttpServlet.service(HttpServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:97)
if you found solution of this problem then please let me know
It's because of the old or some other JAR conflicts. I have removed that JAR's from the project and then it's working fine. Kiran Dongare Software Engineer +91 7588195932
Join us live for Work@Life, your ultimate guide to the Employee Experience. Tuesday @ 1:00 PM ET Subscribe here! https://www.youtube.com/playlist?list=PLEskC-4J0V-_XyIksPlWtQrvK47y8uDgl
Live with Dan shares his unfiltered thoughts on the world of market research every Friday @ 12:00 PM ET Subscribe here! https://www.youtube.com/playlist?list=PLEskC-4J0V-9xaL2i5euptHa3gIQVmFBm
Never miss out on what's new with the customer experience by joining us every Wednesday on CX Forums. Sign up here! https://www.eventbrite.com/o/cx-forums-the-customer-experience-connection-31771064491 How am I doing? Take this 40 Second Survey http://feedback.questionpro.com/?c1=kiran.dongare The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
On Wed, Feb 3, 2021 at 1:02 AM Mahesh Myana [email protected] wrote:
@chingor13 https://github.com/chingor13 Can you please help me here?
java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest; at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:435) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:542) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:475) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:592) at com.surveyconsole.admin.screwdrive.activity.gmail.PushNotificationSubscriber.doService(PushNotificationSubscriber.java:45) at com.bhaskaran.ui.ServletAdapter.doPost(ServletAdapter.java:162) at com.bhaskaran.ui.ServletAdapter.doGet(ServletAdapter.java:82) at javax.servlet.http.HttpServlet.service(HttpServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:97)
if you found solution of this problem then please let me know
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/googleapis/google-api-java-client/issues/1387#issuecomment-771917718, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM6VLMS7NW3ESJPR3C2JLTS5BHNVANCNFSM4I3JMFMA .
It's because of the old or some other JAR conflicts. I have removed that JAR's from the project and then it's working fine. Kiran Dongare Software Engineer +91 7588195932 Join us live for Work@Life, your ultimate guide to the Employee Experience. Tuesday @ 1:00 PM ET Subscribe here! https://www.youtube.com/playlist?list=PLEskC-4J0V-_XyIksPlWtQrvK47y8uDgl Live with Dan shares his unfiltered thoughts on the world of market research every Friday @ 12:00 PM ET Subscribe here! https://www.youtube.com/playlist?list=PLEskC-4J0V-9xaL2i5euptHa3gIQVmFBm Never miss out on what's new with the customer experience by joining us every Wednesday on CX Forums. Sign up here! https://www.eventbrite.com/o/cx-forums-the-customer-experience-connection-31771064491 How am I doing? Take this 40 Second Survey http://feedback.questionpro.com/?c1=kiran.dongare The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, re-transmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. … On Wed, Feb 3, 2021 at 1:02 AM Mahesh Myana @.***> wrote: @chingor13 https://github.com/chingor13 Can you please help me here? java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequest.setResponseReturnRawInputStream(Z)Lcom/google/api/client/http/HttpRequest; at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:435) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:542) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:475) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:592) at com.surveyconsole.admin.screwdrive.activity.gmail.PushNotificationSubscriber.doService(PushNotificationSubscriber.java:45) at com.bhaskaran.ui.ServletAdapter.doPost(ServletAdapter.java:162) at com.bhaskaran.ui.ServletAdapter.doGet(ServletAdapter.java:82) at javax.servlet.http.HttpServlet.service(HttpServlet.java:120) at javax.servlet.http.HttpServlet.service(HttpServlet.java:97) if you found solution of this problem then please let me know — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1387 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM6VLMS7NW3ESJPR3C2JLTS5BHNVANCNFSM4I3JMFMA .
thank you so much i also had same issue