native exception occurs from classpath

Description

I have included some jar files using require key word.It works fine but when i was trying to use require "x.properties" file it is giving some runtime exception.
could not load the x.properties file from classpath.

Gliffy Diagrams

Activity

Show:

rajub August 21, 2012 at 7:47 AM

fixed

rajub August 13, 2012 at 4:42 AM
Edited

I am using this conf file logstash-complex.conf :

input {
stdin {
type => "stdin-type"
}

file {
type => "linux-syslog"

  1. Wildcards work, here
    path => "/var/log/pm-powersave.log"

}
}

output {

Db {

}

}

rajub August 13, 2012 at 4:26 AM

this is my ruby program

require "logstash/outputs/base.rb"
require "logstash/namespace.rb"
require 'java'

Dir["/home/rajubairishetti/workspace4/message-c/message-c-dist/target/com.xyz.messaging-message-c-dist-1.3.0-SNAPSHOT-dist/lib/*.jar"].each { |jar| require jar }

require "/home/rj/workspace4/message-c/conf/conf.properties"

java_import 'com.xyz.messaging.publisher.PublisherFact'

java_import 'com.xyz.messaging.publisher.Publisher'

class LogStash::Outputs:b < LogStash::Outputs::Base

config_name "Db"

plugin_status "experimental"

public
def register
begin
creating = PublisherFact.create()
rescue Errno::ECONNREFUSED => e
@logger.warn(" not registereds")
sleep(2)
retry
end

end

public
def receive(event)
return unless output?(event)

topic= event.sprintf(@topic)
message=event.sprintf(@message)

publishing= Publisher.publish(topic, message)

end

end

I included this program in logstash/outputs folder. after that i have created a new jar and executed the program. conf.properties file is located in /home/rj/workspace4/message-c/conf folder.

Jordan Sissel August 10, 2012 at 6:04 PM

I'd have to see your code, but in general the error is saying it can't find "configure.properties" In your classpath, so you should tell java what the right classpath is that includes your properties file.

rajub August 10, 2012 at 5:44 PM

I have written a ruby file. I want to use a configuration file(configure.properties) in my program. I have included the configuration file using require key word. When I executed, I am getting a run time exception. error is

NativeException: java.lang.RuntimeException: could not load conf file configure.properties from classpath.
register at file:/home/raju/Downloads/project/logstash-1.1.1-monolithic.jar!/logstash/outputs/program.rb:37
run_output at file:/home/raju/Downloads/project/logstash-1.1.1-monolithic.jar!/logstash/agent.rb:719
run_output at file:/home/raju/Downloads/project/logstash-1.1.1-monolithic.jar!/logstash/agent.rb:719
start_output at file:/home/raju/Downloads/project/logstash-1.1.1-monolithic.jar!/logstash/agent.rb:362
Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (SystemExit) java.lang.RuntimeException: could not load conf file configure.properties from classpath.
at org.jruby.RubyThread.join(org/jruby/RubyThread.java:509)
at Agent.wait(file:/home/raju/Downloads/project/logstash-1.1.1-monolithic.jar!/logstash/agent.rb:326)
at logstash.runner.main(logstash/runner.rb:42)
at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615)
at logstash.runner.main(logstash/runner.rb:41)
at logstash.runner.(root)(logstash/runner.rb:120)

Fixed

Details

Assignee

Reporter

Affects versions

Created August 10, 2012 at 9:38 AM
Updated April 19, 2013 at 8:38 PM
Resolved August 21, 2012 at 7:47 AM