Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError: hc/server/util/scheduler (wrong name: hc/server/util/Scheduler) #4859

Closed
javalovercn opened this issue Nov 20, 2017 · 2 comments
Milestone

Comments

@javalovercn
Copy link

Hello,
the following scripts works well in jruby-complete-1.7.3.jar, but after change to 1.7.27, it raise the following error:
Caused by : (NameError) cannot link Java class hc.server.util.scheduler (java.lang.NoClassDefFoundError: hc/server/util/scheduler (wrong name: hc/server/util/Scheduler))
org.jruby.javasupport.JavaUtilities.get_proxy_or_package_under_package(org/jruby/javasupport/JavaUtilities.java:54)
RUBY.method_missing(file:/Users/homecenter/Documents/eclipse_workspace/homecenter/jruby.jar!/jruby/java/java_package_module_template.rb:14)
RUBY.(root)(<script>:26)
------------------scripts------------------
#encoding:utf-8

import Java::hc.server.util.Assistant
import Java::hc.server.ui.ProjectContext
import Java::hc.server.util.json.JSONObject

ctx = ProjectContext::getProjectContext()
puts "step1"
scheduler = ctx.getScheduler("MyScheduler1")# Important Java Class : hc.server.util.Scheduler
puts "step2"
scheduler.start()
puts "step3"

hasTrigger = scheduler.hasTrigger("Trigger1")
if hasTrigger == false
puts "add job, calendar, trigger..."
scheduler.addJob("job1", "puts "exeute job1"")
scheduler.addCronTrigger("Trigger1", "/30 * * * * ?", nil, "job1")#trigger "job1" when "Calendar1" every 30 seconds and exclude sunday
scheduler.addCronTrigger("Trigger1", "
/30 * * * * ?", nil, "job1")#trigger "job1" when "Calendar1" every 30 seconds and exclude sunday
#puts "Trigger1 next fire time : " + scheduler.getTriggerNextFireTime("Trigger1").toString()
#scheduler.triggerJob("job1")
else
#puts "Trigger1 end time : " + scheduler.getTriggerNextFireTime("Trigger1").toString()
end

weeklyCalendar = Java::hc.server.util.scheduler.WeeklyJobCalendar::new()
------------------end scripts------------------

  1. the instance var "scheduler" is class hc.server.util.Scheduler
  2. the instance var "weeklyCalendar" is class hc.server.util.scheduler.WeeklyJobCalendar
  3. all other scripts works well.

Environment

jruby-complete-1.7.27.jar in jdk1.7.0_51
Darwin Home-CentermatoMacBook-2.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Oct 2 22:20:08 PDT 2017; root:xnu-3248.71.4~1/RELEASE_X86_64 x86_64

@kares
Copy link
Member

kares commented Nov 20, 2017

you did not specify how the class-path is setup e.g. I am sure if you required the proper .jar in the .rb script it would work. I see it as an issue with class-loading, old 1.7.x had several bugs thus would highly recommend to upgrade to a newer 1.7 or even better 9K. JRuby 1.7.x has EOLed so you're pretty much on your own.

@kares kares added this to the Won't Fix milestone Nov 20, 2017
@headius
Copy link
Member

headius commented Nov 20, 2017

Concur with @kares, confirm all jar dependencies are getting required and if you still have issues on JRuby 9.1.x, please reopen!

@headius headius closed this as completed Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants