Giter Club home page Giter Club logo

java-buildpack's Introduction

Cloud Foundry Java Buildpack

The java-buildpack is a Cloud Foundry buildpack for running JVM-based applications. It is designed to run many JVM-based applications (Grails, Groovy, Java Main, Play Framework, Spring Boot, and Servlet) with no additional configuration, but supports configuration of the standard components, and extension to add custom components.

Usage

To use this buildpack specify the URI of the repository when pushing an application to Cloud Foundry:

$ cf push <APP-NAME> -p <ARTIFACT> -b https://github.com/cloudfoundry/java-buildpack.git

Examples

The following are very simple examples for deploying the artifact types that we support.

Configuration and Extension

The buildpack default configuration can be overridden with an environment variable matching the configuration file you wish to override minus the .yml extension. It is not possible to add new configuration properties and properties with nil or empty values will be ignored by the buildpack (in this case you will have to extend the buildpack, see below). The value of the variable should be valid inline yaml, referred to as "flow style" in the yaml spec (Wikipedia has a good description of this yaml syntax).

There are two levels of overrides: operator and application developer.

  • If you are an operator that wishes to override configuration across a foundation, you may do this by setting environment variable group entries that begin with a prefix of JBP_DEFAULT.
  • If you are an application developer that wishes to override configuration for an individual application, you may do this by setting environment variables that begin with a prefix of JBP_CONFIG.

Here are some examples:

Operator

  1. To change the default version of Java to 11 across all applications on a foundation.
$ cf set-staging-environment-variable-group '{"JBP_DEFAULT_OPEN_JDK_JRE":"{jre: {version: 11.+ }}"}'
  1. To change the default repository root across all applications on a foundation. Be careful to ensure that your JSON is properly escaped.
$ cf set-staging-environment-variable-group '{"JBP_DEFAULT_REPOSITORY": "{default_repository_root: \"http://repo.example.io\" }"}'
  1. To change the default JVM vendor across all applications on a foundation. Be careful to ensure that your JSON is properly escaped.
$ cf set-staging-environment-variable-group '{"JBP_DEFAULT_COMPONENTS": "{jres: [\"JavaBuildpack::Jre::ZuluJRE\"]}"}'

Application Developer

  1. To change the default version of Java to 11 and adjust the memory heuristics then apply this environment variable to the application.
$ cf set-env my-application JBP_CONFIG_OPEN_JDK_JRE '{ jre: { version: 11.+ }, memory_calculator: { stack_threads: 25 } }'
  1. If the key or value contains a special character such as : it should be escaped with double quotes. For example, to change the default repository path for the buildpack.
$ cf set-env my-application JBP_CONFIG_REPOSITORY '{ default_repository_root: "http://repo.example.io" }'
  1. If the key or value contains an environment variable that you want to bind at runtime you need to escape it from your shell. For example, to add command line arguments containing an environment variable to a Java Main application.
$ cf set-env my-application JBP_CONFIG_JAVA_MAIN '{ arguments: "--server.port=9090 --foo=bar" }'
  1. An example of configuration is to specify a javaagent that is packaged within an application.
$ cf set-env my-application JAVA_OPTS '-javaagent:app/META-INF/myagent.jar -Dmyagent.config_file=app/META-INF/my_agent.conf'
  1. Environment variable can also be specified in the applications manifest file. For example, to specify an environment variable in an applications manifest file that disables Auto-reconfiguration.
env:
  JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{ enabled: false }'
  1. This final example shows how to change the version of Tomcat that is used by the buildpack with an environment variable specified in the applications manifest file.
env:
  JBP_CONFIG_TOMCAT: '{ tomcat: { version: 8.0.+ } }'

See the Environment Variables documentation for more information.

To learn how to configure various properties of the buildpack, follow the "Configuration" links below.

The buildpack supports extension through the use of Git repository forking. The easiest way to accomplish this is to use GitHub's forking functionality to create a copy of this repository. Make the required extension changes in the copy of the repository. Then specify the URL of the new repository when pushing Cloud Foundry applications. If the modifications are generally applicable to the Cloud Foundry community, please submit a pull request with the changes. More information on extending the buildpack is available here.

Additional Documentation

Building Packages

The buildpack can be packaged up so that it can be uploaded to Cloud Foundry using the cf create-buildpack and cf update-buildpack commands. In order to create these packages, the rake package task is used.

Note that this process is not currently supported on Windows. It is possible it will work, but it is not tested, and no additional functionality has been added to make it work.

Online Package

The online package is a version of the buildpack that is as minimal as possible and is configured to connect to the network for all dependencies. This package is about 250K in size. To create the online package, run:

$ bundle install
$ bundle exec rake clean package
...
Creating build/java-buildpack-cfd6b17.zip

Offline Package

The offline package is a version of the buildpack designed to run without access to a network. It packages the latest version of each dependency (as configured in the config/ directory) and disables remote_downloads. To create the offline package, use the OFFLINE=true argument:

To pin the version of dependencies used by the buildpack to the ones currently resolvable use the PINNED=true argument. This will update the config/ directory to contain exact version of each dependency instead of version ranges.

$ bundle install
$ bundle exec rake clean package OFFLINE=true PINNED=true
...
Creating build/java-buildpack-offline-cfd6b17.zip

If you would rather specify the exact version to which the buildpack should bundle, you may manually edit the config/ file for the component and indicate the specific version to use. For most components, there is a single version property which defaults to a pattern to match the latest version. By setting the version property to a fixed version, the buildpack will install that exact version when you run the package command. For JRE config files, like config/open_jdk_jre.yml, you need to set the version_lines array to include the specific version you'd like to install. By default, the version_lines array is going to have a pattern entry for each major version line that matches to the latest patch version. You can override the items in the version_lines array to set a specific versions to use when packaging the buildpack. For a JRE, the jre.version property is used to set the default version line and must match one of the entries in the version_lines property.

This package size will vary depending on what dependencies are included. You can reduce the size by removing unused components, because only packages referenced in the config/components.yml file will be cached. In addition, you can remove entries from the version_lines array in JRE configuration files, this removes that JRE version line, to further reduce the file size.

Additional packages may be added using the ADD_TO_CACHE argument. The value of ADD_TO_CACHE should be set to the name of a .yml file in the config/ directory with the .yml file extension omitted (e.g. sap_machine_jre). Multiple file names may be separated by commas. This is useful to add additional JREs. These additional components will not be enabled by default and must be explicitly enabled in the application with the JBP_CONFIG_COMPONENTS environment variable.

$ bundle install
$ bundle exec rake clean package OFFLINE=true ADD_TO_CACHE=sap_machine_jre,ibm_jre
...
Caching https://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud/runtimes/java/8.0.6.26/linux/x86_64/ibm-java-jre-8.0-6.26-x86_64-archive.bin
Caching https://github.com/SAP/SapMachine/releases/download/sapmachine-11.0.10/sapmachine-jre-11.0.10_linux-x64_bin.tar.gz
...
Creating build/java-buildpack-offline-cfd6b17.zip

Package Versioning

Keeping track of different versions of the buildpack can be difficult. To help with this, the rake package task puts a version discriminator in the name of the created package file. The default value for this discriminator is the current Git hash (e.g. cfd6b17). To change the version when creating a package, use the VERSION=<VERSION> argument:

$ bundle install
$ bundle exec rake clean package VERSION=2.1
...
Creating build/java-buildpack-2.1.zip

Packaging Caveats

  1. Prior to version 4.51 when pinning versions, only the default JRE version is pinned. There is special handling to package additional versions of a JRE and the way this works, it will pick the latest version at the time you package not at the time of the version's release. Starting with version 4.51, the version number for all JRE version lines is tracked in the config/ file.

  2. The index.yml file for a dependency is packaged in the buildpack cache when building offline buildpacks. The index.yml file isn't versioned with the release, so if you package an offline buildpack later after the release was tagged, it will pull the current index.yml, not the one from the time of the release. This can result in errors at build time if a user tells the buildpack to install the latest version of a dependency because the latest version is calculated from the index.yml file which has more recent versions than what are packaged in the offline buildpack. For example, if the user says give me Java 11._+ and the buildpack is pinned to Java 11.0.13_8 but at the time you packaged the buildpack the latest version in index.yml is 11.0.15_10 then the user will get an error. The buildpack will want to install 11.0.15_10 but it won't be present because 11.0.13_8 is all that's in the buildpack.

    Because of #1 for versions prior to 4.51, this only impacts the default JRE. Non-default JREs always package the most recent version, which is also the most recent version in index.yml at the time you package the offline buildpack. For 4.51 and up, this can impact all versions.

  3. Because of #1 and #2, it is not possible to accurately reproduce packages of the buildpack, after releases have been cut. If building pinned or offline buildpacks, it is suggested to build them as soon as possible after a release is cut and save the produced artifact. Alternatively, you would need to maintain your own buildpack dependency repository and keep snapshots of the buildpack dependency repository for each buildpack release you'd like to be able to rebuild.

See #892 for additional details.

Running Tests

To run the tests, do the following:

$ bundle install
$ bundle exec rake

Running Cloud Foundry locally is useful for privately testing new features.

Contributing

Pull requests are welcome; see the contributor guidelines for details.

License

This buildpack is released under version 2.0 of the Apache License.

java-buildpack's People

Contributors

aloismayr avatar alonweiss-sl avatar anthonydahanne avatar arthfl avatar benjaminperryross avatar breedx-splk avatar cgfrost avatar dependabot[bot] avatar dmevada avatar dmitri-gb avatar ekcasey avatar fwanggg avatar glyn avatar joushx avatar jy2697 avatar m-tsur avatar mayrstefan avatar mmanciop avatar nebhale avatar nkatre avatar pavankrish123 avatar pivotal-david-osullivan avatar prodion23 avatar rbamberger avatar sabbey37 avatar svrc avatar tylerbenson avatar vchrisb avatar violetagg avatar youngm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-buildpack's Issues

Add opt-in support for outputing configureable HTTP access logs to loggregator

Following up #30 (comment)

The gorouter currently generates non configureable http access traces of the following format (see access_log_record.go for desc of each field)

2014-05-16T14:10:10.80+0200 [RTR]     OUT php-info-gberche.cfapps.io - [16/05/2014:12:10:10 +0000] "GET /info.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2146 "http://php-info-gberche.cfapps.io/info.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0" 10.10.2.122:62465 vcap_request_id:c8a81f5e-77d7-4d6e-7f99-288f07ee0345 response_time:0.004421576 app_id:65b6cb42-10b1-48f5-9722-e79df58c34ec

This has the following limitations for app-dev or app-ops:

  • when trying to troubleshoot rooter to buildpack issues (e.g. timeouts, hanging connections, latencies ...) app-ops need to ask both actors for their truth. Currently, they only have the gorouter version.
  • the verbosity of the log can not be controlled. For example, some apps implementing some REST APIs might be quite sensitive to HTTP headers that are not currently logged.
  • inability to temporary enabling verbose logs on a app (all instances or a subset) to perform some debugging
  • the format can not be controlled, and since it does not currently map to standard format, this may forces log archiving tools to parse it explicitely (e.g. https://github.com/logsearch/logsearch-filters-cf if I understand it correctly)

Fortunately, the gorouter now generates a X-Vcap-Request-Id (may be ultimately X-Request-Id see cloudfoundry/gorouter#29 ) in the HTTP header of requests send to apps and logs this request in the router access logs. This enables correlation with more detailed access logging that can be done in apps themselves or with support from the java-buildpack.

This is consistent with the heroku approach documented at https://devcenter.heroku.com/articles/http-request-id

Currently, the java-buildpack allows to tune the tomcat configuration files (e.g. server.xml and to turn on the access valve ) by forking the buildpack and placing customized file into the resources/tomcat directory.

To make it easier for java-buildpack users, I'm suggesting to offer the configuration by default in the javabuildpack and limit the amount of configuration work in required by app-ops.

I'm therefore suggesting the java-buildpack to allow ops to opt-in access logs:

  • dumped to stdout to be collected by the loggregator,
  • with a default sensible format:
    • with a [ACCESS] prefix to differentiate access logs from app logs ([STDOUT]) or container logs ([CONTAINER])
    • with the X-Vcap-Request-Id=<value>
    • with remaining standards fields in one of the standard format (e.g. apache access logs)
  • opt-in controlled by config/tomcat.yml with new property such as access_login.enabled=true (and ideally in the future ENV var controlled opt-in as to avoid most forks for turning on access logs)

App-ops can then still fork the buildpack to tune the access logs format (or ideally control it with an env var in the future)

App-ops that require to dynamically turn the access logs can embed JMX remoting app such as jolokia ( related discussion into the tracker 46897105 ) to control the RemoveValve bean

Ideally in the future, the following details would be added to the gorouter, to fully enable debugging the router/app http chain (feature parity with heroku router log format ):

  • router adds connect: amount of time spent establishing a connection to the backend web process
  • router adds service: amount of time spent proxying data between the backend web process and the client (if that's different from r.ResponseTime())

app-dynamics fails release because of appdynamics.agent.nodeName expression

When I push my app using app-dynamics framework staging fails with the following error:

[Buildpack]                      ERROR Release failed with exception #<RuntimeError: Invalid Java option contains more than one option: '-Dappdynamics.agent.nodeName=$(expr "$VCAP_APPLICATION" : '.*instance_id[": ]*"\([a-z0-9]\+\)".*')'>

https://github.com/cloudfoundry/java-buildpack/blob/master/lib/java_buildpack/framework/app_dynamics_agent.rb#L42

https://github.com/cloudfoundry/java-buildpack/blob/master/lib/java_buildpack/framework/java_opts.rb#L54

Grails 2.3.X + spring-security-core plugin auto configuration problem

Hi,
there seems to be a problem with auto configuration in connection to grails application that is using spring-security-core plugin.
Steps to replicate:

$ grails create-app problem    # tested with grails 2.3.11 and 2.3.7
$ cd problem
$ add "compile: ':spring-security-core:1.2.7.4'" to BuildConfig.groovy 
$ grails compile 
$ grails s2-quickstart com.testapp User Role 
$ grails prod war 
$ cf push ....

The problem occurs when using PWS with ClearDB service provisioned to the app. Tried with default PWS buildpack and also with the master branch from github. The problematic grails version is 2.3.x, I tried also grails 2.4.3 and it worked ok.

The "cf logs --recent" shows an exception related to second level cache not being used https://gist.github.com/igm/91d26f26733f022f4d72

Try to mkdir cache in the read only dir of Warden Container

Hi,
I failed to push a java app by the java-buildpack(CF170),the error is:

-----> Downloaded app package (4.0K)
[DownloadCache]                  WARN  Unable to download http://download.run.pivotal.io/tomcat/index.yml into cache /tmp: execution expired
[Buildpack]                      ERROR Detect failed with exception #<RuntimeError: Tomcat Instance error: Read-only file system - /var/vcap/data/dea_next/admin_buildpacks/88434542-bb6e-4d7e-8562-f58c250eefe8_0eac241dcc6b8def5066447ae62411bfa70572e0/resources/cache>
Tomcat Instance error: Read-only file system - /var/vcap/data/dea_next/admin_buildpacks/88434542-bb6e-4d7e-8562-f58c250eefe8_0eac241dcc6b8def5066447ae62411bfa70572e0/resources/cache
/var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:101:in `build_pack': Unable to detect a supported application type (RuntimeError)
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:74:in `block in compile_with_timeout'
    from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:73:in `compile_with_timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in `block in stage_application'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in `chdir'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in `stage_application'
    from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `<main>'

This is because the current cache path is java-buildpack / resources / cache,
which doesn't exist.

Inside the warden container, /var/vcap/data/dea_next/admin_buildpacks/java-buildpack/resources it read only.
After downloading timeout, it trys to mkdir /var/vcap/data/dea_next/admin_buildpacks/java-buildpack/resources/cache , So failed.

ERROR Detect failed with exception #<RuntimeError: Tomcat Instance error: Read-only file system - /var/vcap/data/dea_next/admin_buildpacks/88434542-bb6e-4d7e-8562-f58c250eefe8_0eac241dcc6b8def5066447ae62411bfa70572e0/resources/cache>

Above all,
I think we we can create a empty java-buildpack / resources / cache folder ,in case mkdir cache inside warden container.

PS: Why don't use the previous cache path : ENV['BUILDPACK_CACHE']/java-buildpack

Regards
Tim

No way to specify '1.8.0' without picking up 1.8.0_RC1

Per this index.yml file, there are currently two versions of the 1.8.0 buildpack available:

  • 1.8.0: ...
  • 1.8.0_RC1: ...

When working on spring-attic/sagan#148, I attempted to use the following syntax in our open_jdk_jre.yml to pick up the 1.8.0 (GA) version:

  1. 1.8.0_+
  2. 1.8.0+
  3. 1.8.0

Option (1) ends up downloading the RC1 version; option (2) causes an error when trying to resolve the buildpack (bad wildcard syntax); option (3) picks up the RC1 version as well.

It seems there is no way to actually pin the buildpack at 1.8.0 GA. In the meantime, I'm going with the original syntax in (1).

Provision to add custom root certificates

I am looking for a way to import custom root certificates into JVM's castore. Is there any convention or hook available to add these certificates? If this is not available, I would like to add this feature. There are couple option available,

Option 1:
Have a new directory under java-buildpack, java-buildpack/resources/certs and user can place custom certificates under this resource directory. During the compile time, these certificates will be imported into JVM's castore. The disadvantage is, user needs to fork and add certificates and it is not best idea to add certificates under SCM. Also, not all application require the extra root certificates.

Option 2:
Application MANIFEST's can specify the certs location. After compilation, during release cycle the java-buildpack can read the file and import into JVMS's castore. This is most preferred way since application can specify its custom root certificate if require.

BTW, I am looking information what is the difference between compile and release life cycle in java-buildpack.

Thanks,
-Sridharan

Add retry for failed binaries download

I often experience failure to download binaries from their repositories (even on run.pivotal.io) with cnx_reset or timeouts (see http://cloudfoundry.zendesk.com/entries/26564506-Getting-failure-or-cnx-reset-on-run-pivotal-io-downloading-custom-buildpack )

Ruby 2.0 seems to have built-in single retry https://github.com/ruby/ruby/blob/044e75db6d810dece06d8a7921aae18a6024faa8/lib/net/http.rb#L1429 . Unfortunately, I understand the current CF stack uses ruby 1.9 to execute java-buildpack code (http://docs.cloudfoundry.com/docs/running/architecture/stacks.html), and therefore no retries are currently applied.

Could the java_buildpack add a retry mechanism similar to the usual http client retries (e.g. http://hc.apache.org/httpclient-3.x/exception-handling.html#Automatic_exception_recovery ) so that most transient GET timeouts/cnx resets get handled transparently ?

Unable to push Play 2.1.4 app

On my MacOSX 10.8.4, Getting the following error when push my basic Play 2.1.4 (using Scala 2.10.0) application:

Using manifest file manifest.yml
...
-----> Downloaded app package (33M)
Initialized empty Git repository in /tmp/buildpacks/java-buildpack/.git/
E, [2013-09-18T02:19:46.605485 #73] ERROR -- /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:46:in rescue in drive_buildpack_with_logger': Compile failed with exception #<RuntimeError: No supported application type was detected> No supported application type was detected /var/vcap/packages/dea_next/buildpacks/lib/installer.rb:16:incompile': Buildpack compilation step failed: (RuntimeError)
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:76:in block in compile_with_timeout' from /usr/lib/ruby/1.9.1/timeout.rb:68:intimeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:75:in compile_with_timeout' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:57:inblock in stage_application'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:in chdir' from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:instage_application'
from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `

'

Make the app dynamic tier name configurable through service

Right now the app dynamics agent tier name is configured/hard coded in:
config/app_dynamics_agent.yml as "Cloud Foundry"

Problem is changing the tier name would have to fork the java buildpack.

Can we just make the capability to override the default "Cloud Foundry" through service?

Support permgen minimum and maximum option

In my organization our apps tend to fall in a certain range of permgen size requirements. We would be able to provide a more tuned default to teams using the java buildpack if we could factor minimum and maximum sizes into the permgen size calculations. This will allow for more effective use of heap in our apps without having to provide multiple forks of the java-buildpack.

In our case 95% of our applications fall between Permgen: 96M and 256M

Do we have examples to set javaopts in yml?

I tried with following settings but it does not take effect after push. I think it is the format issue but I can not find an example. Is there anyone could help?Thanks.

# JAVA_OPTS configuration

---
from_environment: false
# java_opts:
-Xloggc: "/home/vcap/tmp/beacon_gc.log"
-verbose: gc

Provide support for Ratpack

Ratpack is a lightweight netty-based web framework that can be used both from Java and Groovy to create small- / mid-sized applications or micro-services. It's gaining momentum in the Groovy community in particular.

I've had trouble uploading and deploying a Ratpack application on Cloud Foundry.
But thanks to @nebhale's forked Java buildpack (https://github.com/nebhale/java-buildpack-with-ratpack/), I managed to get it working!

It'd be nice if the Java buildpack understood Ratpack and allowed to deploy Ratpack apps easily and transparently, without particular setup.

Unable to build an offline buildpack

Hi,
I am trying to build an offline buildpack and upload it to my CF PaaS(installed using CF Nise installer) so that my CF wont need internet when i push my Java webapp.

Bundler version: 1.6.2
Ruby version: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]

i cloned this repo, did a 'bundle install', followed by 'bundle exec rake package OFFLINE=true'. i am getting the following error:

C:\Users\kjhawar\ws\java-buildpack>bundle exec rake package OFFLINE=true > log
.txt
The system cannot find the path specified.
The system cannot find the path specified.
[DownloadCache] WARN Request failure 1, retrying: Content has
invalid size. Was 4041, should be 3976.
[DownloadCache] WARN Request failure 2, retrying: Content has
invalid size. Was 4041, should be 3976.
[DownloadCache] WARN Request failure 3, retrying: Content has
invalid size. Was 4041, should be 3976.
[DownloadCache] WARN Request failure 4, retrying: Content has
invalid size. Was 4041, should be 3976.
[DownloadCache] WARN Request failure 5, retrying: Content has
invalid size. Was 4041, should be 3976.
[InternetAvailability] WARN Internet availability set to false: Reque
st failed: Content has invalid size. Was 4041, should be 3976.
[DownloadCache] WARN Unable to download http://download.run.pi
votal.io/groovy/index.yml into cache build/staging/resources/cache: Content has
invalid size. Was 4041, should be 3976.
rake aborted!
Unable to find cached file for http://download.run.pivotal.io/groovy/index.yml
C:/Users/kjhawar/ws/java-buildpack/lib/java_buildpack/util/cache/download_cache.
rb:65:in get' C:/Users/kjhawar/ws/java-buildpack/rakelib/dependency_cache_task.rb:144:inbloc
k (2 levels) in uris'
C:/Users/kjhawar/ws/java-buildpack/rakelib/dependency_cache_task.rb:141:in each ' C:/Users/kjhawar/ws/java-buildpack/rakelib/dependency_cache_task.rb:141:inbloc
k in uris'
C:/Users/kjhawar/ws/java-buildpack/rakelib/dependency_cache_task.rb:140:in each ' C:/Users/kjhawar/ws/java-buildpack/rakelib/dependency_cache_task.rb:140:inuris
'
C:/Users/kjhawar/ws/java-buildpack/rakelib/dependency_cache_task.rb:42:in initi alize' C:/Users/kjhawar/ws/java-buildpack/Rakefile:40:innew'
C:/Users/kjhawar/ws/java-buildpack/Rakefile:40:in `<top (required)>'
(See full trace by running task with --trace)

Buildpack detection issue, how to force a container?

Today we encounter the following issue:

Application can be run by more than one container: Groovy, Tomcat>\nApplication can be run by more than one container: Groovy, Tomcat

How can I force the use of a specific container?

Btw, the end user did not get any message except for: staging failed. I had to pull this message from the CF logs.

Full log message:

cf-172.21.42.136 vcap.warden[18151]: [unset] {"timestamp":1385034491.5036776,"message":"Exited with status 1 (2.757s): [["/var/vcap/data/packages/warden/33.1/warden/src/closefds/closefds", "/var/vcap/data/packages/warden/33.1/warden/src/closefds/closefds"], "/var/vcap/data/warden/depot/17b57hvg7t4/bin/iomux-link", "-w", "/var/vcap/data/warden/depot/17b57hvg7t4/jobs/1917/cursors", "/var/vcap/data/warden/depot/17b57hvg7t4/jobs/1917"]","log_level":"warn","source":"Warden::Container::Linux","data":{"handle":"17b57hvg7t4","stdout":"Initialized empty Git repository in /tmp/buildpacks/java-buildpack.git/.git/\n","stderr":"E, [2013-11-21T11:48:11.482641 #79] ERROR -- /tmp/buildpacks/java-buildpack.git/lib/java_buildpack/buildpack.rb:49:in rescue in drive_buildpack_with_logger': Compile failed with exception #<RuntimeError: Application can be run by more than one container: Groovy, Tomcat>\nApplication can be run by more than one container: Groovy, Tomcat\n/var/vcap/packages/dea_next/buildpacks/lib/installer.rb:16:incompile': Buildpack compilation step failed: (RuntimeError)\n\tfrom /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:72:in block in compile_with_timeout'\n\tfrom /usr/lib/ruby/1.9.1/timeout.rb:68:intimeout'\n\tfrom /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:71:in compile_with_timeout'\n\tfrom /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:inblock in stage_application'\n\tfrom /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:49:in chdir'\n\tfrom /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:49:instage_application'\n\tfrom /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `

'\n"},"thread_id":13486220,"fiber_id":17242100,"process_id":18151,"file":"/var/vcap/data/packages/warden/33.1/warden/lib/warden/container/spawn.rb","lineno":134,"method":"set_deferred_success"}

mapping values are not allowed in this context.

I am getting this while pushing a java web application :

mapping values are not allowed in this context at line 48 column 9 (Psych::SyntaxError)
from /tmp/buildpacks/java-buildpack.git/lib/java_buildpack/repository/repository_index.rb:33:in block in initialize' from /tmp/buildpacks/java-buildpack.git/lib/java_buildpack/util/download_cache.rb:70:inblock (2 levels) in get'
from /tmp/buildpacks/java-buildpack.git/lib/java_buildpack/util/download_cache.rb:69:in `open'

Please note that it has already downloaded openjdk and all other dependencies. This error is coming when DEA has finished 'running_environment_variables' step and now trying 'release_info' step.

Java-Main - Failed to start accepting connections

Hi,

I have created a simple hello world executable jar and have pushed this to a CloudFoundry instance using the java-buildpack, which has resulted in the application failing to stage.

The "hello world" print is available in the logs which indicates that the java-main container has been used and the jar has been executed, however, the application fails to stage with "failed to start accepting connections".

From what I have read there is no prerequisite step(s) in configuring your application to accept connections.

I may have completely misunderstood the user scenario for the java-main support, any information you could provide on this would be greatly appreciated.

Thank you,
Sam

Add support for triggering thread dumps and heap dumps

Following @nebhale 's suggestion to request most needed features in the java buildpack, adding ability to remotely trigger thread dumps and heap dumps would provide lots of value to CF users that can't leverage cloud monitoring solutions such as appdynamics or new relic.

Ideally such dumps could be triggered interactively or programmatically (e.g. by a monitoring robot collecting evidences prior to restarting a specific app instance suspected to be in a deadlock).

The smart atime-based cf files solution implemented by @sparameswaran into weblogic-buildpack seems pretty appealing and could probably be ported over to the java-buildpack and be applicable to all deployment modes (tomcat, java -jar, play ...)

It would be interesting to measure whether a go-lang implementation of the agent would actually save memory usage w.r.t. the current bash-based impl for each script.

AccessLogValue in server.xml logging remote address

You probably want to add the parameter requestAttributesEnabled="true" to resources/tomcat/conf/server.xml to the line:
<Valve className="com.gopivotal.cloudfoundry.tomcat.logging.access.CloudFoundryAccessLoggingValve" pattern='[ACCESS] %h %l %t %D %F %B %S vcap_request_id:%{X-Vcap-Request-Id}i' enabled="${access.logging.enabled}"/>

Without it, you will be logging the router IP address with %h instead of the one pulled from the X-Forwarded-For by RemoteIpValve.

java_opts shouldn't sort before release

I have a requirement where I need to execute 3 javaagents in a specific order (It is a total hack I know). Java will execute the agents in the order specified on the command line. Sorting the java_opts makes this not work:
https://github.com/cloudfoundry/java-buildpack/blob/master/lib/java_buildpack/component/java_opts.rb#L73

I used to be able to just append all 3 into one java_opts but that is no longer possible in v2:
https://github.com/cloudfoundry/java-buildpack/blob/master/lib/java_buildpack/framework/java_opts.rb#L53

Dowload failure lacking detailed traces to identify root cause

Buildpacks highly depend on remote binaries to be present.

My custom buildpack based on the java-buildpack frequently fails on run.pivotal.io when trying to download remote packages. The current traces seem to not include details from exceptions thrown by the Net::HTTP::Get method.

2013-09-08 18:11:06,088 INFO  (397) -
app staging logs:-----> Downloaded app package (4.9M)
Initialized empty Git repository in /tmp/buildpacks/java-buildpack.git/.git/
-----> Downloading OpenJDK 1.7.0_21 JRE from http://download.pivotal.io.s3.amazonaws.com/openjdk/lucid/x86_64/openjdk-1.7.0_21.tar.gz (11.0s)
       Expanding JRE to .java (1.0s)
-----> Downloading Jonas 5.2.4 from http://orange-buildpacks-binaries.s3-website-us-west-1.amazonaws.com/jonas/jonas-full-5.2.4-bin.tar.gz W, [
2013-09-08T16:11:05.295650 #64]  WARN -- /tmp/buildpacks/java-buildpack.git/lib/java_buildpack/util/download_cache.rb:145:in `look_aside': Unable to download from http://orange-buildpacks-binaries.s3-website-us-west-1.amazonaws.com/jonas/jonas-full-5.2.4-bin.tar.gz. Looking in buildpack cache.
W, [2013-09-08T16:11:05.296308 #64]  WARN -- /tmp/buildpacks/java-buildpack.git/lib/java_buildpack/util/download_cache.rb:154:in `look_aside': Buildpack cache does not contain http://orange-buildpacks-binaries.s3-website-us-west-1.amazonaws.com/jonas/jonas-full-5.2.4-bin.tar.gz. Failing the download.
FAIL
E, [2013-09-08T16:11:05.296572 #64] ERROR -- /tmp/buildpacks/java-buildpack.git/lib/java_buildpack/buildpack.rb:46:in `rescue in drive_buildpack_with_logger': Compile failed with exception #<RuntimeError: Unable to download from http://orange-buildpacks-binaries.s3-website-us-west-1.amazonaws.com/jonas/jonas-full-5.2.4-bin.tar.gz>
Unable to download from http://orange-buildpacks-binaries.s3-website-us-west-1.amazonaws.com/jonas/jonas-full-5.2.4-bin.tar.gz
/var/vcap/packages/dea_next/buildpacks/lib/installer.rb:16:in `compile': Buildpack compilation step failed: (RuntimeError)
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:76:in `block in compile_with_timeout'
    from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:75:in `compile_with_timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:57:in `block in stage_application'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:in `chdir'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:in `stage_application'
    from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `<main>'

see

raise "Unable to download from #{uri}"

I'm thinking to add #{$!} into the log message

Support disabling auto-reconfiguration

I do not want CF to reconfigure my Java application for me, but the autoconfigure: false option does not appear to be respected in a manifest, and the Maven plugin does not have any option for disabling it. This option is available on buildpacks for other languages (e.g., Ruby).

Errors when pushing jenkins war file: fail to detect container

When pushing a jenkins war file, cf responds by saying it can't determine what version to use to run it.
I also tried pushing it to run.pivotal.io, and cf gives the same error.
I've had success pushing jenkins up until about cf release 138

Here is the error:

Uploading jenkins... OK
Preparing to start jenkins... OK
-----> Downloaded app package (54M)
E, [2013-09-19T22:36:43.907940 #37] ERROR -- /var/vcap/packages/dea_next/buildpacks/vendor/java/lib/java_buildpack/buildpack.rb:46:in 'rescue in drive_buildpack_with_logger': Detect failed with exception #<RuntimeError: Application can be run by more than one container: java-main, tomcat-7.0.42, tomcat-buildpack-support-1.1.1>
Application can be run by more than one container: java-main, tomcat-7.0.42, tomcat-buildpack-support-1.1.1
/var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:98:in 'build_pack': Unable to detect a supported application type (RuntimeError)
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:76:in 'block in compile_with_timeout'
from /usr/lib/ruby/1.9.1/timeout.rb:68:in 'timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:75:in 'compile_with_timeout'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:57:in 'block in stage_application'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:in 'chdir'
from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:53:in 'stage_application'
from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in '

'
Checking status of app 'jenkins'...Application failed to stage

to recreate:

  1. download latest jenkins war file:
    http://mirrors.jenkins-ci.org/war/latest/jenkins.war
  2. cf push

Allow configuration of AppDynamics `applicationName`, `nodeName`, and `tierName`

Some colleagues of ours have multiple Cloud Foundry apps with the same name: one for staging, one for production etc. Currently, on their AppDynamics dashboard, their apps are listed like this:

- my-app-name
   - Cloud Foundry
        - (some instance guid)

Data from their staging and production environments is mixed together. Also, every time they re-deploy their app they see a new node name. They'd like some way to configure how their data is structured: maybe one or more environment variables they could set?

CF Community Pair
Caleb and Max (@calebamiles and @maxbrunsfeld)

Debugging applications that are killed with killjava.sh

I have an application which is repeatedly failing when we push it to CF using the current master of the buildpack. The events are similar to the following:

2014-08-06T11:37:51.00+0100   audit.app.update   USER   state: STOPPED
2014-08-06T11:32:34.00+0100   audit.app.update   USER   instances: 1, memory: 2048
2014-08-06T11:02:47.00+0100   audit.app.update   admin                            state: STARTED
2014-08-06T11:02:45.00+0100   audit.app.update   admin                            state: STOPPED
2014-08-06T10:52:50.00+0100   app.crash          APP                         index: 0, reason: CRASHED, exit_description: app instance exited, exit_status: 137
2014-08-06T10:51:37.00+0100   audit.app.update   USER   state: STARTED
2014-08-06T10:46:38.00+0100   audit.app.update   USER   instances: 1, memory: 2048

I can see from the applogs the kill script is being called due to an OOM event:

2014-08-06T12:04:46.40+0100 [App/0]   OUT # java.lang.OutOfMemoryError: Java heap space
2014-08-06T12:04:46.40+0100 [App/0]   OUT # -XX:OnOutOfMemoryError="/home/vcap/app/.java-buildpack/open_jdk_jre/bin/killjava.sh"
2014-08-06T12:04:46.40+0100 [App/0]   OUT #   Executing /bin/sh -c "/home/vcap/app/.java-buildpack/open_jdk_jre/bin/killjava.sh"...
2014-08-06T12:04:46.46+0100 [App/0]   ERR /bin/bash: line 35:    33 Killed                  ( $PWD/.java-buildpack/open_jdk_jre/bin/java -cp $PWD/. -Djava.io.tmpdir=$TMPDIR -XX:OnOutOfMemoryError=$PWD/.java-buildpack/open_jdk_jre/bin/killjava.sh -Xmx1536M -Xms1536M -XX:MaxPermSize=209715K -XX:PermSize=209715K -Xss1M -javaagent:$PWD/.java-buildpack/app_dynamics_agent/javaagent.jar -Dappdynamics.agent.applicationName='APP' -Dappdynamics.agent.tierName='CloudFoundry' -Dappdynamics.agent.nodeName=$(expr "$VCAP_APPLICATION" : '.*instance_id[": ]*"\([a-z0-9]\+\)".*') -Dappdynamics.agent.accountAccessKey=xx -Dappdynamics.agent.accountName=xx -Dappdynamics.controller.hostName=xx -Dappdynamics.controller.port=443 -Dappdynamics.controller.ssl.enabled=true xx ) > >(tee $DROPLET_BASE_DIR/logs/stdout.log) 2> >(tee $DROPLET_BASE_DIR/logs/stderr.log >&2)
https://github.com/cloudfoundry/java-buildpack/blob/6f502e7b2355c16d45b0d5e2c7e572ea01e6df39/resources/open_jdk_jre/bin/killjava.sh#L23-L25

Within that kill script you guys have added some diagnostics 👍 however I don't know how to read them as they are not pumped through loggregator and the container is then removed.

function log {
echo "$(date +%FT%T.%2N%z) FATAL $1" >> $LOG_FILE
}

How do I get at these logs to find out more about what is going on?

SPRING_PROFILES_DEFAULT environnement variable

Not sure if this is an environment variable set by mistake by me or a default config from Java buildpack, so I prefer to ask.

Is SPRING_PROFILES_DEFAULT default variable set by default ?

If yes, SPRING_PROFILES_DEFAULT (default profile name) seems to be customized by default to cloudfoundry. Is it really expected ?

Instead, the behavior that I would expect from CloudFoundry would be to let SPRING_PROFILES_DEFAULT undefined and set SPRING_PROFILES_ACTIVE to cloudfoundry if not defined by the user.

Do you agree ?

CATALINA_OPTS support or simular

Since the JAVA_OPTS framework does not work for webapplications, would it be possible to support CATALINA_OPTS?

We need a way to set environment vars like:

-Duser.timezone=Europe/Amsterdam

Fail to install Spring Insight agent

Problem 1: download spring agent requires authentication(username/password)

-----> Downloading Spring Insight provided from http://10.27.5.148:8080/insight/services/config/agent-download (0.0s)
       Expanding Spring Insight to .java-buildpack/spring_insight 
Command 'unzip -qq /tmp/cache/http%!A(MISSING)%!F(MISSING)%!F(MISSING)10.27.5.148%!A(MISSING)8080%!F(MISSING)insight%!F(MISSING)services%!F(MISSING)config%!F(MISSING)agent-download.cached -d /tmp/d20140710-59-6qxhj7/installer 2>&1' has failed
STDOUT: [/tmp/cache/http%!A(MISSING)%!F(MISSING)%!F(MISSING)10.27.5.148%!A(MISSING)8080%!F(MISSING)insight%!F(MISSING)services%!F(MISSING)config%!F(MISSING)agent-download.cached]
STDERR: 
[Buildpack]                      ERROR Compile failed with exception RuntimeError
/var/vcap/packages/dea_next/buildpacks/lib/installer.rb:19:in `compile': Buildpack compilation step failed: (RuntimeError)
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:74:in `block in compile_with_timeout'
    from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:73:in `compile_with_timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in `block in stage_application'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in `chdir'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:50:in `stage_application'
    from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `<main>'

Problem 2: code does not work with spring insight agent 1.9.2 format

Exception happens during expanding

   Expanding Spring Insight to .java-buildpack/spring_insight exception happens Backtrace:
    /usr/lib/ruby/1.9.1/fileutils.rb:1527:in `path'
    /usr/lib/ruby/1.9.1/fileutils.rb:1527:in `fu_each_src_dest0'
    /usr/lib/ruby/1.9.1/fileutils.rb:1513:in `fu_each_src_dest'
    /usr/lib/ruby/1.9.1/fileutils.rb:508:in `mv'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:184:in `block in move'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:183:in `each'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:183:in `move'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:130:in `init_container_libs'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:122:in `install_insight'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:99:in `block (2 levels) in expand'
    /usr/lib/ruby/1.9.1/tmpdir.rb:83:in `mktmpdir'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:97:in `block in expand'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/component/base_component2.rb:159:in `with_timing'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:96:in `expand'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:47:in `block (2 levels) in compile'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/component/base_component2.rb:92:in `block in download'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/cached_file.rb:53:in `call'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/cached_file.rb:53:in `block in cached'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/cached_file.rb:53:in `open'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/cached_file.rb:53:in `open'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/cached_file.rb:53:in `cached'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/download_cache2.rb:68:in `get'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/component/base_component2.rb:89:in `download'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:47:in `block in compile'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/internet_availability.rb:58:in `block (2 levels) in available'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/internet_availability.rb:76:in `preserve_availability'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/internet_availability.rb:54:in `block in available'
    /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/util/cache/internet_availability.rb:52:in `available'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/framework/spring_insight.rb:46:in `compile'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/buildpack.rb:63:in `block in compile'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/buildpack.rb:63:in `each'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/buildpack.rb:63:in `compile'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/bin/compile:27:in `block in <main>'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/lib/java_buildpack/buildpack.rb:198:in `with_buildpack'
    /var/vcap/data/dea_next/admin_buildpacks/29900777-8b68-4abf-a9da-d50a432b62e2_72cc02913ea2a1a6ce30bdc10b7283c179fa31d5/bin/compile:26:in `<main>'

Automatic Spring profiles?

Does the buildpack automatically add a Spring profile named cloud to the run? If so, it should be documented as a useful hook, and does this affect any other profiles that are set in an existing SPRING_PROFILES_ACTIVE environment variable for the application?

Start command contains hard-coded references to staging directory

As a result of changes in 664f2cc the start command contains hard-coded references to the staging directory. For example, deploying java-main from https://github.com/cloudfoundry/java-test-applications results in a startup file with the following contents:

...
(/tmp/staged/app/.java/bin/java -cp . -Dalpha=bravo -Xss1M com.gopivotal.test.JavaMain) > $DROPLET_BASE_DIR/logs/stdout.log 2> $DROPLET_BASE_DIR/logs/stderr.log &
...

Similarly, deploying web-application results in the following:

...
(JAVA_HOME=/tmp/staged/app/.java JAVA_OPTS="-Dhttp.port=$PORT -Xss1M" /tmp/staged/app/.tomcat/bin/catalina.sh run) > $DROPLET_BASE_DIR/logs/stdout.log 2> $DROPLET_BASE_DIR/logs/stderr.log &
...

Consequently, deployment fails with an error such as ./startup: line 18: /tmp/staged/app/.java/bin/java: No such file or directory.

No container can run the application

I'm trying to use this with https://github.com/Altoros/cf-vagrant-installer/ to deploy a jruby app, but I get this error:

"Staging error: failed to stage application:\nScript exited with status 1\n-----> Downloaded app package (32M)\nInitialized empty Git repository in /tmp/buildpacks/java-buildpack/.git/\nInstalling java-buildpack.\nE, [2013-11-02T01:56:50.480858 #64] ERROR -- /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:49:in `rescue in drive_buildpack_with_logger': Compile failed with exception #<RuntimeError: No container can run the application>\nNo container can run the application\n/vagrant/dea_ng/buildpacks/lib/installer.rb:17:in `compile': Buildpack compilation step failed: (RuntimeError)\n\tfrom /vagrant/dea_ng/buildpacks/lib/buildpack.rb:26:in `block in compile_with_timeout'\n\tfrom /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'\n\tfrom /vagrant/dea_ng/buildpacks/lib/buildpack.rb:25:in `compile_with_timeout'\n\tfrom /vagrant/dea_ng/buildpacks/lib/buildpack.rb:16:in `block in stage_application'\n\tfrom /vagrant/dea_ng/buildpacks/lib/buildpack.rb:12:in `chdir'\n\tfrom /vagrant/dea_ng/buildpacks/lib/buildpack.rb:12:in `stage_application'\n\tfrom /vagrant/dea_ng/buildpacks/bin/run:10:in `<main>'\n"

I don't have any other apps, I tried deleting this app and restarting the whole server, but I always get this error.

I tried deploying the app normally, or as a war (with --path option to cf push), but neither worked.

How to debug java-buildpack

I am going to extend buildpack for our own app - modifying some customized properties files via buildpack.

My question is how to debug the buildpack, as I can not get sufficient information to narrow down errors.
For example, if I set heap size settings in java_opts.yml, it will fail because they should set in jre.yml. But what I get from cf cli is just "Checking status of app 'beacon-test'...Application failed to stage" even with --debug.

Is there any way to output more information? or Is there any better ways to build customized buildpack?

Thanks,

The issues when I exec 'cf push --buildpack ...'

After I login cf, I had exec cf push --buildpack. I awalys encounter the following error:

fhanik@ubuntu:~$ cf push --buildpack https://github.com/cloudfoundry/java-buildpack
Name> buildpack

Save configuration?> y

Saving to manifest.yml... OK
Uploading buildpack... FAILED
Upload failed. Try again with 'cf push'.
Time of crash:
2014-01-19 00:44:35 -0800

CFoundry::Error: Path contains links '[#Pathname:.pulse/f7e6f4b6137bfcc6d34b0b950000000a-runtime]' that point outside '.'

cfoundry-4.7.1.rc1/lib/cfoundry/upload_helpers.rb:96:in check_unreachable_links' cfoundry-4.7.1.rc1/lib/cfoundry/upload_helpers.rb:71:inprepare_package'
cfoundry-4.7.1.rc1/lib/cfoundry/upload_helpers.rb:42:in upload' cf-5.4.5/lib/cf/cli/app/push.rb:85:inblock in upload_app'

.....................

I am a beginner, be grateful for any suggestions!

Servlet example reference missing maven example

Some users that did not yet made the investment onto gradle, it would be useful to preserve sample apps that can be built using maven or available as binaries. Currently https://github.com/cloudfoundry/java-buildpack/blob/master/docs/example-servlet.md#maven points to https://github.com/cloudfoundry/java-test-applications/tree/master/web-servlet-2-application which only has gradle descriptors.

Is there a way to publish the java-test-applications binaries somewhere (maven central or travis or S3) so ease testing for non gradle-savvy users ?

Background:

As I was trying to diagnose a case of "Unable to detect a supported application type", I was looking for available artefacts to test against. I've not yet invested into gradle build.

Thanks in advance,

Guillaume.

Add support for outputing access, stdout, and tomcat logs to loggregator

Continuing the conversation started in https://docs.google.com/document/d/1zTbS9f6s1Y8WYMhJv5lu6G1bf1ktXA-y-itc3ZOhVAA/edit?disco=AAAAAGhrT_w# : the CloudFoundry recommended way to collect HTTP access logs is to have apps dump them on stdout, in order for the loggregator to collect them. Same for tomcat info/error logs.

It would be great to have the java-buildpack support an opt-in option that configures tomcat to write access logs to stdout, with a prefix added on each line in order to distinguish these logs from app-generated logs on stdout, and catalina start logs. Tomcat error logs could end up in stderr.

Also it seems important to avoid tomcat generated logs (access and tomcat traces) mixing up with app-generated logs on stdout. Having traces interleave would make logs useless.

Some initial thoughts on how this could be implemented:

  • it seems that the standard tomcat valve does not support writing to stdout.
  • one could write a variant of the tomcat access log that directly writes to stdout but would then run into the race conditions on the stdout stream leading to trace interleaving
  • the LogbackValve is quite attractive as it would allow to easily add the prefix to entires, control buffering, and if apps use logback to potentially avoid traces interleaving. However, embedding logback into the tomcat classpath would prevent apps from shipping their own logback version in their war. Somewhat related tomcat background might point to another tomcat-internal solution ?

Consider -Xmaxjitcodesize in Memory Heuristics

I've been doing some java memory testing recently and discovered that one memory heuristic you don't currently consider when configuring a jvm for warden memory sizes is -Xmaxjitcodesize.

-Xmaxjitcodesize is an additional memory item the jvm allocates outside Heap, stack, and meta space.

If I create a minimal java app and deploy it into a memory constrained warden container Adding this parameter -Xmaxjitcodesize2496k (2496k being the minimum) will allow my app to function. Removing that parameter (defaulting it to a much larger value) will cause my app to exceed the bounds of warden's memory limit.

Appdynamics integration breaks Play! Framework Applications

Play! Framework applications fail to start after AppDynamics service is bound

Summary

After binding an AppDynamics User Provided Service to a Java Play! Framework application the application fails to start.

Steps to reproduce (use any Play app)

$ git clone https://github.com/FreightTrain/play-cf-env.git
$ cd ./play-cf-env/play-cf-env
$ play clean dist

# Modify manifest.yml to meet your needs

$ cf push

# Everything is fine
# Create an Appdynamics User Provided Service (dummy data for this if fine for now)

$ cf bs tastle-ad-debug app-dynamics-usp
$ cf push

# App stages but cannot start.

Primary error in app logs

2014-07-17T10:26:18.18+0100 [App/0]   OUT [INFO]: AgentInstallManager - Agent runtime directory set to [/home/vcap/app/.java-buildpack/app_dynamics_agent]
2014-07-17T10:26:18.19+0100 [App/0]   OUT [INFO]: AgentInstallManager - Agent node directory set to [unknown]
2014-07-17T10:26:18.19+0100 [App/0]   OUT Could not start Java Agent because unable to determine Tier Name or Node Name
2014-07-17T10:26:18.20+0100 [App/0]   OUT Agent Logging Directory [/home/vcap/app/.java-buildpack/app_dynamics_agent/logs/unknown]
2014-07-17T10:26:18.32+0100 [App/0]   ERR Error: Could not find or load main class Foundry
2014-07-17T10:26:18.37+0100 [DEA]     OUT Instance (index 0) failed to start accepting connections

Attempted Workarounds

I've tried manually specifying the AppDynamics controller-info.xml in a forked buildpack

This allows the Appdynamics agent to start however the error starting the application itself (once the agent is up) remains: ERR Error: Could not find or load main class Foundry

I am currently trying to work out why this is the case.



Logs

Full logs

01. Push the app with no service bound

Summary: Everything is fine.

tastle@TASTLE-M-W03P play-cf-env (master) $ cf push
Using manifest file /Users/tastle/Code/FreightTrain/bugs/2014-07-14-Play-apps-with-appdynamics/play-cf-env/play-cf-env/manifest.yml

Creating app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...
OK

Creating route tastle-ad-debug.paas.dev.col.tx.cpgpaas.net...
OK

Binding tastle-ad-debug.paas.dev.col.tx.cpgpaas.net to tastle-ad-debug...
OK

Uploading tastle-ad-debug...
Uploading app files from: /Users/tastle/Code/FreightTrain/bugs/2014-07-14-Play-apps-with-appdynamics/play-cf-env/play-cf-env/dist/play-cf-env-1.0-SNAPSHOT.zip
Uploading 527.2K, 24 files
OK

Starting app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...
OK
-----> Downloaded app package (31M)
-----> Java Buildpack Version: v2.1.2 | https://github.com/cloudfoundry/java-buildpack.git#074fd9a
-----> Downloading Open Jdk JRE 1.7.0_60 from http://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.7.0_60.tar.gz (19.1s)
       Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s)
-----> Downloading Play Framework Auto Reconfiguration 0.8.9 from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.9.jar (1.1s)
-----> Downloading Spring Auto Reconfiguration 0.8.9 from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.9.jar (found in cache)

-----> Uploading droplet (63M)

0 of 1 instances running, 1 starting
1 of 1 instances running

App started

Showing health and status for app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...
OK

requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: tastle-ad-debug.paas.dev.col.tx.cpgpaas.net

     state     since                    cpu    memory         disk
#0   running   2014-07-17 10:22:25 AM   0.0%   223.9M of 1G   125M of 1G

02. Bind AppDynamics and Push :: Terminal Log

tastle@TASTLE-M-W03P play-cf-env (master) $ cf bs tastle-ad-debug app-dynamics-faast-stage
Binding service app-dynamics-faast-stage to app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...
OK
TIP: Use 'cf push' to ensure your env variable changes take effect
tastle@TASTLE-M-W03P play-cf-env (master) $ cf push
Using manifest file /Users/tastle/Code/FreightTrain/bugs/2014-07-14-Play-apps-with-appdynamics/play-cf-env/play-cf-env/manifest.yml

Updating app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...
OK

Using route tastle-ad-debug.paas.dev.col.tx.cpgpaas.net
Uploading tastle-ad-debug...
Uploading app files from: /Users/tastle/Code/FreightTrain/bugs/2014-07-14-Play-apps-with-appdynamics/play-cf-env/play-cf-env/dist/play-cf-env-1.0-SNAPSHOT.zip
Uploading 527.2K, 24 files
OK

Stopping app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...
OK

Starting app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...
OK
-----> Downloaded app package (31M)
-----> Downloaded app buildpack cache (31M)
-----> Java Buildpack Version: v2.1.2 | https://github.com/cloudfoundry/java-buildpack.git#074fd9a
-----> Downloading Open Jdk JRE 1.7.0_60 from http://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.7.0_60.tar.gz (found in cache)
       Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s)
-----> Downloading App Dynamics Agent 3.7.17 from http://download.run.pivotal.io/app-dynamics/app-dynamics-3.7.17.zip (2.3s)
       Expanding App Dynamics Agent to .java-buildpack/app_dynamics_agent (0.1s)
-----> Downloading Play Framework Auto Reconfiguration 0.8.9 from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.9.jar (found in cache)
-----> Downloading Spring Auto Reconfiguration 0.8.9 from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.9.jar (found in cache)

-----> Uploading droplet (72M)

0 of 1 instances running, 1 down
...
0 of 1 instances running, 1 down
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
...
0 of 1 instances running, 1 down
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
...
0 of 1 instances running, 1 down
0 of 1 instances running, 1 failing
FAILED
Start unsuccessful

TIP: use 'cf logs tastle-ad-debug --recent' for more information

03. Bind AppDynamics and Push :: App Logs

tastle@TASTLE-M-W03P ~ $ cf logs tastle-ad-debug
Connected, tailing logs for app tastle-ad-debug in org COL-DEV-QBRANCH / space Development as admin...  
2014-07-17T10:24:31.90+0100 [API]     OUT Updated app with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec ({"name"=>"tastle-ad-debug", "instances"=>1, "memory"=>1024, "environment_json"=>"PRIVATE DATA HIDDEN"})
2014-07-17T10:24:43.32+0100 [API]     OUT Updated app with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec ({"state"=>"STOPPED"})
2014-07-17T10:24:44.46+0100 [DEA]     OUT Stopping app instance (index 0) with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec
2014-07-17T10:24:44.46+0100 [DEA]     OUT Stopped app instance (index 0) with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec
2014-07-17T10:24:45.09+0100 [DEA]     OUT Got staging request for app with id 3aeb7523-ed48-400a-aa65-52ae5d23d3ec
2014-07-17T10:24:47.12+0100 [API]     OUT Updated app with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec ({"state"=>"STARTED"})
2014-07-17T10:24:47.63+0100 [STG]     OUT -----> Downloaded app package (31M)
2014-07-17T10:24:48.04+0100 [STG]     OUT -----> Downloaded app buildpack cache (31M)
2014-07-17T10:24:53.31+0100 [STG]     OUT -----> Java Buildpack Version: v2.1.2 | https://github.com/cloudfoundry/java-buildpack.git#074fd9a
2014-07-17T10:24:53.64+0100 [STG]     OUT -----> Downloading Open Jdk JRE 1.7.0_60 from http://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.7.0_60.tar.gz (found in cache)
2014-07-17T10:24:54.64+0100 [STG]     OUT        Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s)
2014-07-17T10:24:56.96+0100 [STG]     OUT -----> Downloading App Dynamics Agent 3.7.17 from http://download.run.pivotal.io/app-dynamics/app-dynamics-3.7.17.zip (2.3s)
2014-07-17T10:24:57.09+0100 [STG]     OUT        Expanding App Dynamics Agent to .java-buildpack/app_dynamics_agent (0.1s)
2014-07-17T10:24:57.23+0100 [STG]     OUT -----> Downloading Play Framework Auto Reconfiguration 0.8.9 from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.9.jar (found in cache)
2014-07-17T10:24:57.38+0100 [STG]     OUT -----> Downloading Spring Auto Reconfiguration 0.8.9 from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.9.jar (found in cache)
2014-07-17T10:24:58.41+0100 [STG]     ERR
2014-07-17T10:25:06.03+0100 [STG]     OUT -----> Uploading droplet (72M)
2014-07-17T10:25:14.68+0100 [DEA]     OUT Starting app instance (index 0) with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec
2014-07-17T10:25:17.71+0100 [App/0]   OUT Install Directory resolved to[/home/vcap/app/.java-buildpack/app_dynamics_agent]
2014-07-17T10:25:17.71+0100 [LGR]     ERR SinkManager: Invalid syslog drain URL: . Err: Incomplete URL {  <nil>    }. This could be caused by an URL without slashes or protocol.
2014-07-17T10:25:17.81+0100 [App/0]   OUT [INFO]: JavaAgent - Using Java Agent Version [Server Agent v3.7.17.0 GA #2014-03-14_17-33-47 rdd57f118ff59ef0cbc3f6193058a58943b15fae1 88-3.7.17]
2014-07-17T10:25:17.81+0100 [App/0]   OUT [INFO]: JavaAgent - Running IBM Java Agent [No]
2014-07-17T10:25:17.82+0100 [App/0]   OUT [INFO]: AgentInstallManager - AppDynamics Agent edition [standard]
2014-07-17T10:25:17.82+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver is running
2014-07-17T10:25:17.82+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using system property [appdynamics.agent.applicationName] for application name [tastle-ad-debug]
2014-07-17T10:25:17.82+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using system property [appdynamics.agent.tierName] for tier name [Cloud]
2014-07-17T10:25:17.97+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using application name [tastle-ad-debug]
2014-07-17T10:25:17.97+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using tier name [Cloud]
2014-07-17T10:25:17.97+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using node name [unknown]
2014-07-17T10:25:17.97+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver finished running
2014-07-17T10:25:17.97+0100 [App/0]   OUT [INFO]: AgentInstallManager - Agent runtime directory set to [/home/vcap/app/.java-buildpack/app_dynamics_agent]
2014-07-17T10:25:17.97+0100 [App/0]   OUT [INFO]: AgentInstallManager - Agent node directory set to [unknown]
2014-07-17T10:25:17.97+0100 [App/0]   OUT Could not start Java Agent because unable to determine Tier Name or Node Name
2014-07-17T10:25:17.99+0100 [App/0]   OUT Agent Logging Directory [/home/vcap/app/.java-buildpack/app_dynamics_agent/logs/unknown]
2014-07-17T10:25:18.11+0100 [App/0]   ERR Error: Could not find or load main class Foundry
2014-07-17T10:25:18.17+0100 [DEA]     OUT Instance (index 0) failed to start accepting connections
2014-07-17T10:25:18.18+0100 [API]     OUT App instance exited with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec payload: {"cc_partition"=>"default", "droplet"=>"3aeb7523-ed48-400a-aa65-52ae5d23d3ec", "version"=>"f5d107a8-36de-4412-b5ac-c991d899583b", "instance"=>"2572bdf0053c425eabc5531854bb6575", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"app instance exited", "crash_timestamp"=>1405589118}

04. Custom buildpack with static controller-info.xml :: App logs

2014-07-17T12:13:25.61+0100 [API]     OUT Updated app with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec ({"name"=>"tastle-ad-debug", "instances"=>1, "memory"=>1024, "buildpack"=>"https://[email protected]/FreightTrain/java-buildpack-qbranch.git", "environment_json"=>"PRIVATE DATA HIDDEN"})
2014-07-17T12:13:37.10+0100 [API]     OUT Updated app with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec ({"state"=>"STOPPED"})
2014-07-17T12:13:38.39+0100 [DEA]     OUT Got staging request for app with id 3aeb7523-ed48-400a-aa65-52ae5d23d3ec
2014-07-17T12:13:40.68+0100 [API]     OUT Updated app with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec ({"state"=>"STARTED"})
2014-07-17T12:13:41.06+0100 [STG]     OUT -----> Downloaded app package (31M)
2014-07-17T12:13:41.83+0100 [STG]     OUT -----> Downloaded app buildpack cache (81M)
2014-07-17T12:13:41.99+0100 [STG]     ERR Cloning into '/tmp/buildpacks/java-buildpack-qbranch'...
2014-07-17T12:13:44.46+0100 [STG]     OUT -----> Java Buildpack Version: 5ce4ae9 | https://[email protected]/FreightTrain/java-buildpack-qbranch.git#5ce4ae9
2014-07-17T12:13:44.84+0100 [STG]     OUT -----> Downloading Open Jdk JRE 1.7.0_60 from http://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.7.0_60.tar.gz (found in cache)
2014-07-17T12:13:45.85+0100 [STG]     OUT        Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.0s)
2014-07-17T12:13:45.99+0100 [STG]     OUT -----> Downloading App Dynamics Agent 3.8.4 from http://download.run.pivotal.io/app-dynamics/app-dynamics-3.8.4.zip (found in cache)
2014-07-17T12:13:46.12+0100 [STG]     OUT        Expanding App Dynamics Agent to .java-buildpack/app_dynamics_agent (0.1s)
2014-07-17T12:13:46.26+0100 [STG]     OUT -----> Downloading Play Framework Auto Reconfiguration 1.4.0_RELEASE from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-1.4.0_RELEASE.jar (found in cache)
2014-07-17T12:13:46.40+0100 [STG]     OUT -----> Downloading Spring Auto Reconfiguration 1.4.0_RELEASE from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-1.4.0_RELEASE.jar (found in cache)
2014-07-17T12:13:55.11+0100 [STG]     OUT -----> Uploading droplet (73M)
2014-07-17T12:14:05.94+0100 [DEA]     OUT Starting app instance (index 0) with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec
2014-07-17T12:14:08.44+0100 [App/0]   OUT Install Directory resolved to[/home/vcap/app/.java-buildpack/app_dynamics_agent]
2014-07-17T12:14:08.56+0100 [App/0]   OUT [INFO]: AgentInstallManager - AppDynamics Agent edition [standard]
2014-07-17T12:14:08.56+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver is running
2014-07-17T12:14:08.56+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using system property [appdynamics.agent.applicationName] for application name [tastle-ad-debug]
2014-07-17T12:14:08.56+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using system property [appdynamics.agent.tierName] for tier name [Cloud]
2014-07-17T12:14:08.73+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using application name [tastle-ad-debug]
2014-07-17T12:14:08.73+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using tier name [Cloud]
2014-07-17T12:14:08.73+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver using node name [redacted]
2014-07-17T12:14:08.73+0100 [App/0]   OUT [INFO]: AgentInstallManager - Full Agent Registration Info Resolver finished running
2014-07-17T12:14:08.73+0100 [App/0]   OUT [INFO]: AgentInstallManager - Agent runtime directory set to [/home/vcap/app/.java-buildpack/app_dynamics_agent]
2014-07-17T12:14:08.73+0100 [App/0]   OUT [INFO]: AgentInstallManager - Agent node directory set to [redacted]
2014-07-17T12:14:08.76+0100 [App/0]   OUT [WARN]: AgentInstallManager - Invalid Edition [Java Agent]. Keeping current edition [STANDARD]
2014-07-17T12:14:08.76+0100 [App/0]   OUT [INFO]: JavaAgent - Using Java Agent Version [Server Agent v3.8.4.0 GA #2014-06-30_13-26-26 r5dc2d8d219673e698b0b455657ac469bc8b59337 4-3.8.4.next]
2014-07-17T12:14:08.77+0100 [App/0]   OUT [INFO]: JavaAgent - Running IBM Java Agent [No]
2014-07-17T12:14:08.77+0100 [App/0]   OUT [INFO]: JavaAgent - Java Agent Directory [/home/vcap/app/.java-buildpack/app_dynamics_agent]
2014-07-17T12:14:08.78+0100 [App/0]   OUT Agent Logging Directory [/home/vcap/app/.java-buildpack/app_dynamics_agent/logs/redacted]
2014-07-17T12:14:08.90+0100 [App/0]   OUT Running obfuscated agent
2014-07-17T12:14:11.02+0100 [App/0]   OUT Registered app server agent with Node ID[915] Component ID[306] Application ID [106]
2014-07-17T12:14:11.88+0100 [App/0]   OUT Started AppDynamics Java Agent Successfully.
2014-07-17T12:14:11.89+0100 [App/0]   ERR Error: Could not find or load main class Foundry
2014-07-17T12:14:11.94+0100 [DEA]     OUT Instance (index 0) failed to start accepting connections
2014-07-17T12:14:11.95+0100 [API]     OUT App instance exited with guid 3aeb7523-ed48-400a-aa65-52ae5d23d3ec payload: {"cc_partition"=>"default", "droplet"=>"3aeb7523-ed48-400a-aa65-52ae5d23d3ec", "version"=>"d10386fa-fe0b-4cb6-8a9f-93de23edca3a", "instance"=>"f55165ed491349709f551ee9df0df762", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"app instance exited", "crash_timestamp"=>1405595651}

java-buildpack incompatible with the use of cf scale -MEMORY cmd

The java-buildpack statically applies memory heuristics at staging time, i.e. includes the -Xmx option in the start cmd. As a result, if a user is using the cf scale -memory command to decrease the memory, the JVM will still try to allocate up to the initial memory account. The jvm will then exceed the memory limit and be killed by the warden container.

Possible workaround: apply the memory heuristics within the droplet using the http://docs.cloudfoundry.com/docs/using/deploying-apps/environment-variable.html#VCAP_APPLICATION limits entry.

Pushing a Grails app with the ":platform-core:1.0.RC5" plugin, results in error "Groovy container error: invalid byte sequence in US-ASCII"

Pushing a Grails app with the ":platform-core:1.0.RC5" plugin, results in error "Groovy container error: invalid byte sequence in US-ASCII".

Steps to recreate.

1.) Install Grails 2.2.3.
2.) Run grails create-app <some-app-name>.
3.) Edit grails-app/conf/BuildConfig.groovy, in the plugins block, add compile ':platform-core:1.0.RC5'.
4.) Run grails war.
5.) Run cf push --path=target/<some-app-name>-0.1.war --buildpack=https://github.com/cloudfoundry/java-buildpack.git

Result is this error.

Initialized empty Git repository in /tmp/buildpacks/java-buildpack.git/.git/
Compile failed with exception #<RuntimeError: Groovy container error: invalid byte sequence in US-ASCII>, ["/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:173:in `block (2 levels) in main_method'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:173:in `open'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:173:in `block in main_method'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:172:in `select'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:172:in `main_method'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:149:in `main_groovy'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:116:in `find_groovy'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/container/groovy.rb:46:in `initialize'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/buildpack.rb:159:in `new'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/buildpack.rb:159:in `block in construct_components'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/buildpack.rb:158:in `map'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/buildpack.rb:158:in `construct_components'", "/tmp/buildpacks/java-buildpack.git/lib/java_buildpack/buildpack.rb:60:in `initialize'", "/tmp/buildpacks/java-buildpack.git/bin/compile:26:in `new'", "/tmp/buildpacks/java-buildpack.git/bin/compile:26:in `<main>'"]
Groovy container error: invalid byte sequence in US-ASCII
/var/vcap/packages/dea_next/buildpacks/lib/installer.rb:16:in `compile': Buildpack compilation step failed: (RuntimeError)
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:26:in `block in compile_with_timeout'
    from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:25:in `compile_with_timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:16:in `block in stage_application'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:12:in `chdir'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:12:in `stage_application'
    from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `<main>'

One possible workaround to this issue is to run the command cf set-env cfdemo LANG "en_US.UTF-8".

Thanks

Detect and start runnable jar file

I package myapp.jar and push but get a staging failed error.

The work-around...zip that jar file and have the following in the manifest.yml

command: java -jar cf-scala-spray_2.10.2-0.1.0-SNAPSHOT.jar
path: target/scala-2.10/cf-scala-spray_2.10.2-0.1.0-SNAPSHOT.zip

Need to detect and run a executable jar file. Thanks.

buildpack v2.0 java_opts set but application cannot find them

I am trying the v2.0 buildpack on CF v155. In the .java-buildpack.log I can see the buildpack detecting my custom java_opts.yml

2014-02-10T13:29:29.59+0000 [Buildpack]                      DEBUG Successfully required JavaBuildpack::Framework::JavaOpts
2014-02-10T13:29:29.59+0000 [ConfigurationUtils]             DEBUG Configuration from /tmp/buildpacks/java-buildpack-v2/config/java_opts.yml: {"java_opts"=>"-Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true -Dcom.sun.xml.bind.v2.runtime.JAXBContextImpl.fastBoot=true -DSPRING_PROFILES_ACTIVE=cloud -Duser.timezone=Europe/Amsterdam"}
20

The startup command is also correct AFAIK:

gcf files helloworld staging_info.yml
Getting files for app helloworld in org main / space development as admin...
OK


---
detected_buildpack:
start_command: JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre JAVA_OPTS="-DSPRING_PROFILES_ACTIVE=cloud
  -Dcom.sun.xml.bind.v2.runtime.JAXBContextImpl.fastBoot=true -Dhttp.port=$PORT -Djava.io.tmpdir=$TMPDIR
  -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true -Duser.timezone=Europe/Amsterdam
  -XX:MaxPermSize=104857K -XX:OnOutOfMemoryError=$PWD/.java-buildpack/open_jdk_jre/bin/killjava.sh
  -XX:PermSize=104857K -Xms768M -Xmx768M -Xss1M" $PWD/.java-buildpack/tomcat/bin/catalina.sh
  run

But my app is not seeing any of the system properties...

System.out.println("SPRING_PROFILES_ACTIVE="+ System.getenv("SPRING_PROFILES_ACTIVE"));
System.out.println("user.timezone="+ System.getenv("user.timezone"));

output:

SPRING_PROFILES_ACTIVE=null
user.timezone=null

What am I missing?

Cannot push really simple Java application (one class with main method)

Output from cf push (with JBP_LOG_LEVEL=DEBUG)

...
-----> Downloading OpenJDK 1.7.0_25 JRE from http://download.pivotal.io.s3.amazonaws.com/openjdk/lucid/x86_64/openjdk-1.7.0_25.tar.gz (1.4s)
       Expanding JRE to .java (1.1s)
E, [2013-08-09T09:55:31.287813 #64] ERROR -- /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:46:in `rescue in drive_buildpack_with_logger': Compile failed with exception #<NoMethodError: undefined method `compile' for nil:NilClass>
D, [2013-08-09T09:55:31.288200 #64] DEBUG -- /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:47:in `rescue in drive_buildpack_with_logger': Exception #<NoMethodError: undefined method `compile' for nil:NilClass> backtrace: ["/tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:79:in `compile'", "/tmp/buildpacks/java-buildpack/bin/compile:26:in `block in <main>'", "/tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:44:in `drive_buildpack_with_logger'", "/tmp/buildpacks/java-buildpack/bin/compile:26:in `<main>'"]
undefined method `compile' for nil:NilClass
/var/vcap/packages/dea_next/buildpacks/lib/installer.rb:16:in `compile': Buildpack compilation step failed: (RuntimeError)
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:78:in `block in compile_with_timeout'
    from /usr/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:77:in `compile_with_timeout'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:58:in `block in stage_application'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in `chdir'
    from /var/vcap/packages/dea_next/buildpacks/lib/buildpack.rb:54:in `stage_application'
    from /var/vcap/packages/dea_next/buildpacks/bin/run:10:in `<main>'

JMX support or newrelic?

Hi,

would it be possible to add JMX as an option to the Java build pack? Newrelic would also be fine, but how do we enable this on a local installation?

Heap dumps of crashed JVMs

Hi,

have you guys encountered a case where a heap dump needs to be available outside of the warden container. And how to possibly resolve the issue?

Add support for defining environment variables

I'm wondering why the javabuild pack does not export config-vars in the release step, and rather encourages containers to define env variable within the cmd line ?

https://github.com/cloudfoundry/java-buildpack/blob/master/lib/java_buildpack/buildpack.rb#L103
https://github.com/cloudfoundry/java-buildpack/blob/master/lib/java_buildpack/container/tomcat.rb#L71

This especially harms readability for buildpacks that need to sequence multiple commands, in that they may need to explicitely export individual variable in the cmd line

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.