Dump exceptions that occur when loading a topology to stdout in the topology launcher

Fixes #3
This commit is contained in:
R. Tyler Croy 2014-11-01 18:01:53 -07:00
parent 106194fe6f
commit a4e3bc6479
2 changed files with 12 additions and 13 deletions

View File

@ -6,7 +6,7 @@ buildscript {
plugins {
id "com.github.jruby-gradle.jar" version "0.1.2"
// https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/18
id "com.github.jruby-gradle.base" version "0.1.3"
id "com.github.jruby-gradle.base" version "0.1.4"
id "com.github.johnrengelman.shadow" version "1.1.2"
}
@ -15,7 +15,7 @@ apply plugin: 'java'
apply plugin: 'com.jfrog.bintray'
version = '0.7.0'
version = '0.7.1'
group = 'com.github.jruby-gradle'
sourceCompatibility = 1.7
@ -44,6 +44,8 @@ dependencies {
}
configurations {
// We don't need to include storm-core in the runtime dependencies for the
// redstorm.jar since it's provided by the storm cluster this code runs on top of
runtime.exclude module: 'storm-core'
jrubyExec.extendsFrom compile
}

View File

@ -23,16 +23,6 @@ java_import 'backtype.storm.tuple.Fields'
java_import 'backtype.storm.tuple.Tuple'
java_import 'backtype.storm.tuple.Values'
# java_import 'redstorm.storm.jruby.JRubyBolt'
# java_import 'redstorm.storm.jruby.JRubySpout'
# java_import 'redstorm.storm.jruby.JRubyBatchBolt'
# java_import 'redstorm.storm.jruby.JRubyBatchCommitterBolt'
# java_import 'redstorm.storm.jruby.JRubyBatchSpout'
# java_import 'redstorm.storm.jruby.JRubyTransactionalSpout'
# java_import 'redstorm.storm.jruby.JRubyTransactionalBolt'
# java_import 'redstorm.storm.jruby.JRubyTransactionalCommitterBolt'
# java_import 'redstorm.storm.jruby.JRubyProxyFunction'
java_package 'redstorm'
# TopologyLauncher is the application entry point when launching a topology. Basically it will
@ -54,7 +44,14 @@ class TopologyLauncher
$:.unshift File.expand_path(launch_path + '/lib')
$:.unshift File.expand_path(launch_path + '/target/lib')
require "#{class_path}"
begin
require "#{class_path}"
rescue => ex
puts "Failed to load #{class_path}! (#{ex.inspect})"
puts ex.backtrace.join("\n")
# Re-raising to exit out of the scripting container
raise
end
if RedStorm::Configuration.topology_class.nil? || !RedStorm::Configuration.topology_class.method_defined?(:start)
puts("\nERROR: invalid topology class. make sure your topology class is a subclass of one of the DSL topology classes or that your class sets RedStorm::Configuration.topology_class and defines the start method\n\n")