cloudfoundry / cf-java-client

Java Client Library for Cloud Foundry
Apache License 2.0
328 stars 318 forks source link

Exception: "Could not find an implementation class" #174

Closed chbussler closed 10 years ago

chbussler commented 10 years ago

Hi, when invoking

CloudFoundryClient.streamRecentLogs()

it throws an exception

Could not find an implementation class

Have you seen this before and an idea how to fix this?

Thanks,

Christoph

cf-gitbot commented 10 years ago

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/72001182. This repo is managed by the 'CF Java Experience' team.

ramnivas commented 10 years ago

Can you try running the following (note, to see actual output, you will need to add a line such as System.in.read()):

https://github.com/ramnivas/cloudfoundry-client-sample

On Sun, May 25, 2014 at 2:23 PM, cf-gitbot notifications@github.com wrote:

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/72001182. This repo is managed by the 'CF Java Experience' team.

— Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry/cf-java-client/issues/174#issuecomment-44145895 .

chbussler commented 10 years ago

I am getting

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/christoph/Documents/code/cloudfoundry-client-sample/src/main/java/example/Main.java:[19,39] error: cannot access OAuth2AccessToken
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.028s
[INFO] Finished at: Sun May 25 15:20:59 PDT 2014
[INFO] Final Memory: 10M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project cloudfoundry-client-sample: Compilation failure
[ERROR] /Users/christoph/Documents/code/cloudfoundry-client-sample/src/main/java/example/Main.java:[19,39] error: cannot access OAuth2AccessToken
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
192:cloudfoundry-client-sample christoph$ 

1.0.3.BUILD-SNAPSHOT does not load, however, I have a local 1.0.3.tropo (which I created from cf-java-client master a few days ago on 5/23).

chbussler commented 10 years ago

I started over and created 1.0.3.BUILD-SNAPSHOT of cloudfoundry-client-lib. Then I re-synchronized the cloudfoundry-client-sample to match exactly the remote repository. At this point I can compile the client sample, but not run it:

no main manifest attribute, in cloudfoundry-client-sample-0.0.1-SNAPSHOT.jar

So I added this to the pom.xml:

    <build>
        <plugins>
            <plugin>
                <!-- Build an executable JAR -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>example.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

after 'mvn clean compile package' and 'java -jar cloudfoundry-client-sample-0.0.1-SNAPSHOT.jar' I get:

Exception in thread "main" java.lang.NoClassDefFoundError: org/cloudfoundry/client/lib/ApplicationLogListener
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
    at java.lang.Class.getMethod0(Class.java:2774)
    at java.lang.Class.getMethod(Class.java:1663)
    at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.cloudfoundry.client.lib.ApplicationLogListener
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 6 more

Do you have any input for me? That would be great. Thanks!

ramnivas commented 10 years ago

I just tried again and it worked fine for me. I ran mvn exec:java -Dexec.mainClass="example.Main" after adding the snippet from your comment to my pom.xml (so far I had been running from within the IDE).

While it doesn't explain the CNFE, did you modify the following to match your credentials etc.? https://github.com/ramnivas/cloudfoundry-client-sample/blob/master/src/main/java/example/Main.java#L12-L16

chbussler commented 10 years ago

I used your mvn command and that got me a bit further. 'gcf' output (to check that connectivity and authorization works):

192:revisions christoph$ gcf target
API endpoint: http://api.172.16.227.106.xip.io (API version: 2.4.0)
User:         user1
Org:          acme
Space:        acmeApps
192:revisions christoph$ gcf apps
Getting apps in org acme / space acmeApps as user1...
OK

No apps found
192:revisions christoph$ 

My main:

public static void main(String[] args) throws Exception {
        String email = "user1";
        String password = "password1";
        String org = "acme";
        String space = "acmeApps";
        String app = "";

        CloudFoundryClient client = 
                new CloudFoundryClient(new CloudCredentials(email, password),
                                       new URL("http://api.172.16.227.106.xip.io"), org, space);

        client.login();

        StreamingLogToken token = client.streamRecentLogs(app, new PrintingApplicationLogListener());

    }

And the output of 'mvn clean compile package exec:java -Dexec.mainClass="example.Main" ':

192:cloudfoundry-client-sample christoph$ mvn clean compile package exec:java -Dexec.mainClass="example.Main"
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.cloudfoundry.samples:cloudfoundry-client-sample:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 24, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building cloudfoundry-client-sample 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ cloudfoundry-client-sample ---
[INFO] Deleting /Users/christoph/Documents/code/cloudfoundry-client-sample/target
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ cloudfoundry-client-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/christoph/Documents/code/cloudfoundry-client-sample/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ cloudfoundry-client-sample ---
[INFO] Compiling 2 source files to /Users/christoph/Documents/code/cloudfoundry-client-sample/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ cloudfoundry-client-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/christoph/Documents/code/cloudfoundry-client-sample/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ cloudfoundry-client-sample ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ cloudfoundry-client-sample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/christoph/Documents/code/cloudfoundry-client-sample/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ cloudfoundry-client-sample ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ cloudfoundry-client-sample ---
[INFO] No tests to run.
[INFO] Surefire report directory: /Users/christoph/Documents/code/cloudfoundry-client-sample/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ cloudfoundry-client-sample ---
[INFO] Building jar: /Users/christoph/Documents/code/cloudfoundry-client-sample/target/cloudfoundry-client-sample-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- exec-maven-plugin:1.3:java (default-cli) @ cloudfoundry-client-sample ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
[WARNING] 
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.cloudfoundry.client.lib.CloudFoundryException: 403 Error requesting access token. (error="access_denied", error_description="Error requesting access token.")
    at org.cloudfoundry.client.lib.oauth2.OauthClient.getToken(OauthClient.java:70)
    at org.cloudfoundry.client.lib.rest.CloudControllerClientImpl.login(CloudControllerClientImpl.java:573)
    at org.cloudfoundry.client.lib.rest.CloudControllerClientImpl.<init>(CloudControllerClientImpl.java:164)
    at org.cloudfoundry.client.lib.rest.CloudControllerClientFactory.newCloudController(CloudControllerClientFactory.java:78)
    at org.cloudfoundry.client.lib.CloudFoundryClient.<init>(CloudFoundryClient.java:155)
    at org.cloudfoundry.client.lib.CloudFoundryClient.<init>(CloudFoundryClient.java:137)
    at example.Main.main(Main.java:18)
    ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.073s
[INFO] Finished at: Tue May 27 11:45:00 PDT 2014
[INFO] Final Memory: 26M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3:java (default-cli) on project cloudfoundry-client-sample: An exception occured while executing the Java class. null: InvocationTargetException: 403 Error requesting access token. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
192:cloudfoundry-client-sample christoph$

So I am exactly at the same point as here: https://github.com/cloudfoundry/cf-java-client/issues/170.

ramnivas commented 10 years ago

Do you get log output with the same target with 'cf logs' or 'cf logs --recent'?

On Tue, May 27, 2014 at 11:49 AM, Christoph Bussler < notifications@github.com> wrote:

I used your mvn command and that got me a bit further. 'gcf' output (to check that connectivity and authorization works):

192:revisions christoph$ gcf target API endpoint: http://api.172.16.227.106.xip.io (API version: 2.4.0) User: user1 Org: acme Space: acmeApps 192:revisions christoph$ gcf apps Getting apps in org acme / space acmeApps as user1... OK

No apps found 192:revisions christoph$

My main:

public static void main(String[] args) throws Exception { String email = "user1"; String password = "password1"; String org = "acme"; String space = "acmeApps"; String app = "";

    CloudFoundryClient client =
            new CloudFoundryClient(new CloudCredentials(email, password),
                                   new URL("http://api.172.16.227.106.xip.io"), org, space);

    client.login();

    StreamingLogToken token = client.streamRecentLogs(app, new PrintingApplicationLogListener());

}

And the output of 'mvn clean compile package exec:java -Dexec.mainClass="example.Main" ':

192:cloudfoundry-client-sample christoph$ mvn clean compile package exec:java -Dexec.mainClass="example.Main" [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for org.cloudfoundry.samples:cloudfoundry-client-sample:jar:0.0.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 24, column 12 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building cloudfoundry-client-sample 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ cloudfoundry-client-sample --- [INFO] Deleting /Users/christoph/Documents/code/cloudfoundry-client-sample/target [INFO] [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ cloudfoundry-client-sample --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/christoph/Documents/code/cloudfoundry-client-sample/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ cloudfoundry-client-sample --- [INFO] Compiling 2 source files to /Users/christoph/Documents/code/cloudfoundry-client-sample/target/classes [INFO] [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ cloudfoundry-client-sample --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/christoph/Documents/code/cloudfoundry-client-sample/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ cloudfoundry-client-sample --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ cloudfoundry-client-sample --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/christoph/Documents/code/cloudfoundry-client-sample/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ cloudfoundry-client-sample --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ cloudfoundry-client-sample --- [INFO] No tests to run. [INFO] Surefire report directory: /Users/christoph/Documents/code/cloudfoundry-client-sample/target/surefire-reports


T E S T S

There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ cloudfoundry-client-sample --- [INFO] Building jar: /Users/christoph/Documents/code/cloudfoundry-client-sample/target/cloudfoundry-client-sample-0.0.1-SNAPSHOT.jar [INFO] [INFO] --- exec-maven-plugin:1.3:java (default-cli) @ cloudfoundry-client-sample --- [WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6. [WARNING] java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293) at java.lang.Thread.run(Thread.java:745) Caused by: org.cloudfoundry.client.lib.CloudFoundryException: 403 Error requesting access token. (error="access_denied", error_description="Error requesting access token.") at org.cloudfoundry.client.lib.oauth2.OauthClient.getToken(OauthClient.java:70) at org.cloudfoundry.client.lib.rest.CloudControllerClientImpl.login(CloudControllerClientImpl.java:573) at org.cloudfoundry.client.lib.rest.CloudControllerClientImpl.(CloudControllerClientImpl.java:164) at org.cloudfoundry.client.lib.rest.CloudControllerClientFactory.newCloudController(CloudControllerClientFactory.java:78) at org.cloudfoundry.client.lib.CloudFoundryClient.(CloudFoundryClient.java:155) at org.cloudfoundry.client.lib.CloudFoundryClient.(CloudFoundryClient.java:137) at example.Main.main(Main.java:18) ... 6 more [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.073s [INFO] Finished at: Tue May 27 11:45:00 PDT 2014 [INFO] Final Memory: 26M/245M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3:java (default-cli) on project cloudfoundry-client-sample: An exception occured while executing the Java class. null: InvocationTargetException: 403 Error requesting access token. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 192:cloudfoundry-client-sample http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException192:cloudfoundry-client-sample christoph$

So I am exactly at the same point as here: #170https://github.com/cloudfoundry/cf-java-client/issues/170 .

— Reply to this email directly or view it on GitHubhttps://github.com/cloudfoundry/cf-java-client/issues/174#issuecomment-44318657 .

chbussler commented 10 years ago

Yes, see complete terminal output here:

192:dispEnv christoph$ ls -al
total 16
drwxr-xr-x   4 christoph  staff  136 May 27 11:04 .
drwxr-xr-x  26 christoph  staff  884 May 27 11:04 ..
-rw-r--r--   1 christoph  staff  451 May 27 11:04 index.js
-rw-r--r--   1 christoph  staff  337 May 27 11:04 package.json
192:dispEnv christoph$ gcf push displayEnv
Creating app displayEnv in org acme / space acmeApps as user1...
OK

Creating route displayenv.172.16.227.106.xip.io...
OK

Binding displayenv.172.16.227.106.xip.io to displayEnv...
OK

Uploading displayEnv...
Uploading app: 1K, 2 files
OK

Starting app displayEnv in org acme / space acmeApps as user1...
OK
-----> Downloaded app package (4.0K)

       PRO TIP: Specify a node version in package.json
       See https://devcenter.heroku.com/articles/nodejs-support
-----> Defaulting to latest stable node: 0.10.28
-----> Downloading and installing node
-----> Writing a custom .npmrc to circumvent npm bugs
-----> Installing dependencies
       npm WARN package.json dispEnv@1.0.0 No repository field.
       npm WARN package.json dispEnv@1.0.0 No README data
-----> Cleaning up node-gyp and npm artifacts
-----> No Procfile found; Adding npm start to new Procfile
-----> Building runtime environment

-----> Uploading droplet (5.2M)

1 of 1 instances running

App started

Showing health and status for app displayEnv in org acme / space acmeApps as user1...
OK

requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: displayenv.172.16.227.106.xip.io

     state     since                    cpu    memory        disk          
#0   running   2014-05-27 12:25:23 PM   0.0%   29.2M of 1G   19.7M of 1G   
192:dispEnv christoph$ gcf logs displayEnv --recent
Connected, dumping recent logs for app displayEnv in org acme / space acmeApps as user1...

2014-05-27T12:25:19.69-0700 [STG]     OUT -----> Cleaning up node-gyp and npm artifacts
2014-05-27T12:25:19.70-0700 [STG]     OUT -----> No Procfile found; Adding npm start to new Procfile
2014-05-27T12:25:19.70-0700 [STG]     OUT -----> Building runtime environment
2014-05-27T12:25:19.70-0700 [STG]     ERR 
2014-05-27T12:25:20.72-0700 [STG]     OUT -----> Uploading droplet (5.2M)
2014-05-27T12:25:22.12-0700 [DEA]     OUT Starting app instance (index 0) with guid 5fb493c7-73b2-4f93-b914-413a06ebb79e
2014-05-27T12:25:23.08-0700 [App/0]   OUT 
2014-05-27T12:25:23.08-0700 [App/0]   OUT > dispEnv@1.0.0 start /home/vcap/app
2014-05-27T12:25:23.08-0700 [App/0]   OUT > node index.js
2014-05-27T12:25:23.13-0700 [App/0]   OUT Server running at http://127.0.0.1:8000/
192:dispEnv christoph$ 
ramnivas commented 10 years ago

I see that you are using gcf. Since the new cli client is called just 'cf', are you using an older version? If so, can you try with the latest 'cf' from https://github.com/cloudfoundry/cli#installers

Also, does the Java sample app work fine if you target api.run.pivotal.io?

Just trying to narrow down the issue. We are at least past the CNFE etc.

chbussler commented 10 years ago

There is no specific reason for using gcf. I followed your link and installed 'cf'. This is what I get:

192:dispEnv christoph$ cf --version
cf version 6.1.2-6a013ca
192:dispEnv christoph$ cf target
API endpoint: http://api.172.16.227.106.xip.io (API version: 2.4.0)
Not logged in. Use 'cf login' to log in.
192:dispEnv christoph$ cf login
API endpoint: http://api.172.16.227.106.xip.io
Warning: Insecure http API endpoint detected: secure https API endpoints are recommended

FAILED
Received invalid SSL certificate from uaa.172.16.227.106.xip.io - not valid for the requested host

API endpoint: http://api.172.16.227.106.xip.io (API version: 2.4.0)
Not logged in. Use 'cf login' to log in.
192:dispEnv christoph$ 

Not sure what to make of it.

maxbrunsfeld commented 10 years ago

@chbussler

It looks like your uaa has an invalid or self-signed SSL certificate. You can suppress this error by using the --skip-ssl-validation flag to cf login.

Thanks, CF Community Pair Jesse and Max (@d, @maxbrunsfeld)

chbussler commented 10 years ago

@maxbrunsfeld, thanks.

@ramnivas,

192:dispEnv christoph$ ls -al
total 16
drwxr-xr-x   4 christoph  staff  136 May 27 14:49 .
drwxr-xr-x  26 christoph  staff  884 May 27 14:49 ..
-rw-r--r--   1 christoph  staff  451 May 27 14:49 index.js
-rw-r--r--   1 christoph  staff  337 May 27 14:49 package.json
192:dispEnv christoph$ cf push displayEnv
Creating app displayEnv in org acme / space acmeApps as user1...
OK

Using route displayenv.172.16.227.106.xip.io
Binding displayenv.172.16.227.106.xip.io to displayEnv...
OK

Uploading displayEnv...
Uploading app files from: /Users/christoph/Documents/code/provisioning/rest-api/src/test/resources/revisions/dispEnv
Uploading 1K, 2 files
OK

Starting app displayEnv in org acme / space acmeApps as user1...
-----> Downloaded app package (4.0K)
OK

       PRO TIP: Specify a node version in package.json
       See https://devcenter.heroku.com/articles/nodejs-support
-----> Defaulting to latest stable node: 0.10.28
-----> Downloading and installing node
-----> Writing a custom .npmrc to circumvent npm bugs
-----> Installing dependencies
       npm WARN package.json dispEnv@1.0.0 No repository field.
       npm WARN package.json dispEnv@1.0.0 No README data
-----> Cleaning up node-gyp and npm artifacts
-----> No Procfile found; Adding npm start to new Procfile
-----> Building runtime environment

-----> Uploading droplet (5.2M)

1 of 1 instances running

App started

Showing health and status for app displayEnv in org acme / space acmeApps as user1...
OK

requested state: started
instances: 0/1
usage: 1G x 1 instances
urls: displayenv.172.16.227.106.xip.io

     state     since                    cpu    memory        disk   
#0   running   2014-05-27 02:51:05 PM   0.0%   27.2M of 1G   19.7M of 1G   
192:dispEnv christoph$ cf logs displayEnv --recent
Connected, dumping recent logs for app displayEnv in org acme / space acmeApps as user1...

2014-05-27T14:50:59.13-0700 [STG]     OUT -----> Cleaning up node-gyp and npm artifacts
2014-05-27T14:50:59.14-0700 [STG]     OUT -----> No Procfile found; Adding npm start to new Procfile
2014-05-27T14:50:59.14-0700 [STG]     OUT -----> Building runtime environment
2014-05-27T14:50:59.15-0700 [STG]     ERR 
2014-05-27T14:51:00.14-0700 [STG]     OUT -----> Uploading droplet (5.2M)
2014-05-27T14:51:04.02-0700 [DEA]     OUT Starting app instance (index 0) with guid 8a859d5d-4d76-47f1-967c-5bbb2e6c3d49
2014-05-27T14:51:05.02-0700 [App/0]   OUT 
2014-05-27T14:51:05.02-0700 [App/0]   OUT > dispEnv@1.0.0 start /home/vcap/app
2014-05-27T14:51:05.02-0700 [App/0]   OUT > node index.js
2014-05-27T14:51:05.10-0700 [App/0]   OUT Server running at http://127.0.0.1:8000/
192:dispEnv christoph$ 

Still have to try to connect to api.run.pivotal.io, need to get credentials first.

scottfrederick commented 10 years ago
  • is there the equivalent of --skip-ssl-validation in the java client?

The equivalent in the Java client is to pass the trustSelfSignedCerts parameter to a CloudFoundryClient constructor with the value true. This does not skip SSL certificate validation, but accepts the SSL cert if is at the root of the cert chain and the cert's CN has the same root domain as the API endpoint. See https://github.com/cloudfoundry/cf-java-client/blob/master/cloudfoundry-client-lib/src/main/java/org/cloudfoundry/client/lib/util/RestUtil.java#L70.

chbussler commented 10 years ago

I set the trustSelfSignedCerts to true and still get a 403.

I have a Ubuntu box running in VMware Fusion on a Mac. The Ubuntu box contains CF, my client is on the Mac.

When I login with 'cf login ... --skip-ssl-validation' from the Mac, it works (see logs above). When I go through the cf-java-client library (with the trustSelfSignedCerts to true), I get the '403 Error requesting access token'.

I don't understand what you meant by 'This does not skip SSL certificate validation, but accepts the SSL cert if is at the root of the cert chain and the cert's CN has the same root domain as the API endpoint.' as I would assume that both, 'cf' and 'cf-java-client' go through the same protocol?

Thanks!

scottfrederick commented 10 years ago

Yes, the 403 error is documented over in #170. I was answering the --skip-ssl-validation question, but let's try to keep these two issues separate. If you think you are past the CFNE exception, then let's close this issue and move the 403 discussion back over to the appropriate issue.

chbussler commented 10 years ago

Sounds good. I can run the sample application that @ramnivas gave me, so on that I am past the CFNE exception. I'll close the issue then.

chbussler commented 10 years ago

@ramnivas, I went through all again and there was one item that you asked for that I wanted to get back; it was about connecting to pivotal.io. It works when running against pivotal.io.