Skip to content

Commit ce9f2c5

Browse files
author
Christopher Frost
committed
Fix a path relativity issue in Spring Insight
A previous commit [1] added support for the Spring Insight application performance monitoring tool to the Tomcat container. This commit contained an error where the installed location of Insight was referenced with an absolute path instead of a relative path. This causes applications bound to the Insight service to fail to start as the path to Insight passed to the application at startup will be incorrect. [1] e0e9041 - Zero-touch support for Spring Insight
1 parent a538d65 commit ce9f2c5

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

lib/java_buildpack/framework/spring_insight.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def release
4343
weaver_jar = @application.relative_path_to(Pathname.new Dir[File.join(insight_home, 'weaver', 'insight-weaver-*.jar')][0])
4444

4545
@java_opts << "-javaagent:#{weaver_jar}"
46-
@java_opts << "-Dinsight.base=#{File.join insight_home, 'insight'}"
47-
@java_opts << "-Dinsight.logs=#{File.join insight_home, 'insight' , 'logs'}"
46+
@java_opts << "-Dinsight.base=#{File.join INSIGHT_HOME, 'insight'}"
47+
@java_opts << "-Dinsight.logs=#{File.join INSIGHT_HOME, 'insight', 'logs'}"
4848
@java_opts << '-Daspectj.overweaving=true'
4949
@java_opts << '-Dorg.aspectj.tracing.factory=default'
5050
@java_opts << '-Dagent.http.protocol=http'
@@ -117,12 +117,12 @@ def install_insight(agent_dir)
117117
insight_analyser_directory = File.join extra_applications_directory, 'insight-agent'
118118
uber_agent_directory = File.join agent_dir, 'springsource-insight-uber-agent-*'
119119

120-
shell "rm -rf #{insight_home}"
121-
shell "rm -rf #{insight_analyser_directory}"
122-
FileUtils.mkdir_p(container_libs_directory)
123-
FileUtils.mkdir_p(extra_applications_directory)
124-
FileUtils.mkdir_p(weaver_directory)
125-
FileUtils.mkdir_p(insight_directory)
120+
FileUtils.rm_rf insight_home
121+
FileUtils.rm_rf insight_analyser_directory
122+
FileUtils.mkdir_p container_libs_directory
123+
FileUtils.mkdir_p extra_applications_directory
124+
FileUtils.mkdir_p weaver_directory
125+
FileUtils.mkdir_p insight_directory
126126

127127
shell "mv #{File.join uber_agent_directory, 'agents', 'common', 'insight-weaver-*.jar'} #{weaver_directory}"
128128
shell "mv #{File.join uber_agent_directory, 'agents', 'common', 'insight-bootstrap-generic-*.jar'} #{container_libs_directory}"

spec/java_buildpack/framework/spring_insight_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ module JavaBuildpack::Framework
8484
).release
8585

8686
expect(java_opts).to include('-javaagent:.insight/weaver/insight-weaver-1.2.4-CI-SNAPSHOT.jar')
87-
expect(java_opts).to include('-Dinsight.base=spec/fixtures/framework_spring_insight/.insight/insight')
88-
expect(java_opts).to include('-Dinsight.logs=spec/fixtures/framework_spring_insight/.insight/insight/logs')
87+
expect(java_opts).to include('-Dinsight.base=.insight/insight')
88+
expect(java_opts).to include('-Dinsight.logs=.insight/insight/logs')
8989
expect(java_opts).to include('-Daspectj.overweaving=true')
9090
expect(java_opts).to include('-Dorg.aspectj.tracing.factory=default')
9191
expect(java_opts).to include('-Dagent.name.override=test-application-name')

0 commit comments

Comments
 (0)