Skip to content

Pub/Sub give problem in AppEngine with Standard Environment with Java 7 #2405

Closed

Description

@ahzamfarhan

Pub/Sub give problem in AppEngine with Standard Environment with Java 7

Hi, I have created Google PUB/SUB using topic. I get error in my Subscriber code. my code works on my local tomcat server but when I deployed it on Google cloud AppEngine with standard environment. It gives following error.
Could not initialize class com.google.cloud.pubsub.v1.Subscriber

Initialization of Subscriber instance is failed on Google cloud AppEngine whereas Subscriber is initialized in local tomcat
com.google.cloud.pubsub.v1.Subscriber subscriber = Subscriber.defaultBuilder(subscription,receiver).build();

I have used following Maven dependencies

com.google.appengine
appengine-api-1.0-sdk
1.9.54

com.google.api-client google-api-client-appengine 1.21.0 javax.servlet servlet-api javax.servlet servlet-api com.google.guava guava-jdk5 com.google.apis google-api-services-pubsub v1-rev8-1.21.0 com.google.cloud google-cloud-examples 0.22.0-alpha com.google.appengine.tools appengine-gcs-client 0.5 com.google.http-client google-http-client com.google.appengine appengine-remote-api 1.9.32

Activity

  1. michaelbausor commented on Sep 5, 2017

    @michaelbausor
    Contributor

    @neozwu can you comment on this?

  2. ahzamfarhan commented on Sep 11, 2017

    @ahzamfarhan
    Author

    I did not get the answer of my question. I once again describe my problem in short. I have AppEngine with Standard Environment whenever I deploy my web app on AppEngine on standard environment, it gives me error as "java.lang.NoClassDefFoundError: Could not initialize class com.google.cloud.pubsub.v1.Subscriber" but same webapp application run fine on my local tomcat server. I want to know if AppEngine with Standard Environment supports com.google.cloud.pubsub.v1.Subscriber initialization or not?

  3. michaelbausor commented on Sep 11, 2017

    @michaelbausor
    Contributor

    We do not expect PubSub (or other gRPC-based APIs) to work with Java 7 on AppEngine Standard. (See for example this comment).

    It should work using Java 8 on AppEngine Standard.

    It doesn't look like you have a direct dependency on the google-cloud-pubsub package (see here on github: https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-pubsub). If you are using Java 8 and seeing this problem, you could try adding this dependency.

  4. ahzamfarhan commented on Sep 11, 2017

    @ahzamfarhan
    Author

    Thanks michaelbauso,
    AppEngine Standard by default uses jdk 7. I want to know to change AppEngine Standard to use jdk 8.

  5. michaelbausor commented on Sep 11, 2017

    @michaelbausor
    Contributor

    No worries! For Java 8, take a look at the documentation here: https://cloud.google.com/appengine/docs/standard/java/runtime-java8

  6. ahzamfarhan commented on Sep 11, 2017

    @ahzamfarhan
    Author

    I have followed the steps specified on URL https://cloud.google.com/appengine/docs/standard/java/runtime-java8 for changing from java 7 to java 8 for standard AppEngine. I am getting following error while executing command 'mvn appengine:update'

    java.io.IOException: Cannot run program "C:\jdk1.8.0_144\jre\bin\java.exe": Crea
    teProcess error=206, The filename or extension is too long
    Unable to update app: Cannot run program "C:\jdk1.8.0_144\jre\bin\java.exe": Cre
    ateProcess error=206, The filename or extension is too long
    Please see the logs [C:\Users\farhanm\AppData\Local\Temp\appcfg16888316327372592
    11.log] for further information.

  7. lesv commented on Sep 20, 2017

    @lesv
    Contributor

    @ahzamfarhan Can you post a copy of your log? (if it doesn't have any confidential info in it)

  8. lesv commented on Sep 20, 2017

    @lesv
    Contributor
  9. anthmgoogle commented on Nov 9, 2017

    @anthmgoogle

    Looks like the original issue has been clarified. If there are issues with moving to Java8 it may be best to create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions