I am using jruby-1.4.0 to test Ahead-of-Time jruby compiler(jrubyc) to
compile one of my application_controller.rb (in my case the application
is
widgets) into java bytecodes(widgets_controller.class) at the current
controller directory. Once the widgets_controller.class is generated, I
remove the original widgets_controller.rb file from the current
controller
dir, hopefully the widgets_application java class byecode can be called
instead of the ruby source codes. Then I fire the mongrel server from my
jruby application root directory as showing below:
jruby script/server
Mongrel server is running well, I can access my jruby application web
page
like these: http://10.0.0.4:3000/
and the Welcome Message can be shown on the Web Browser:
Welcome aboard
You’re riding Ruby on Rails!
About your application’s environment
Ruby version 1.8.7 (java)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /home/liao1k/testapp
Environment development
Database adapter jdbcmysql
Database schema version 20100105052106
However when try to access my widgets application controller by using
the
url (http://10.0.0.4:3000/widgets), I got following Error Message:
NameError in WidgetsController#index
uninitialized constant WidgetsController
RAILS_ROOT: /home/liao1k/testapp
Application Trace | Framework Trace | Full Trace
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in
load_missing_constant' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in
const_missing_with_dependencies’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in
const_missing' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in
constantize’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
each' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
constantize’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in
constantize' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:443:in
recognize’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:436:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:87:in
dispatch’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in
_call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in
build_middleware_stack’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
cache' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in
cache’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in
run' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:48:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in
each' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:in
call’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/chunked.rb:15:in
call' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:64:in
process’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:159:in
process_client' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in
each’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:158:in
process_client' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
run’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
initialize' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
new’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:285:in
run' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
initialize’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
new' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel.rb:268:in
run’
/home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:34:in
run' /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111 /home/liao1k/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:31:in
require’
/home/liao1k/jruby-1.4.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require’
script/server:3
Request
Parameters:
None
Show session dump
Response
Headers:
{“Cache-Control”=>“no-cache”,
“Content-Type”=>“”}
It seems jruby can not find the widgets_controller.class file from the
controller directory. I use touch Linux command to create an empty
widgets_controller.rb file in the current controller directory. The
Error
Message is gong and the the widgets pages can be accessed from the Web
Browser. I am not sure how to make widgets_controller.class be called
from
jruby.
Thanks for your help.
–
View this message in context:
http://old.nabble.com/Compiled-jruby-application_controller.class-can-not-be-found-tp27064829p27064829.html
Sent from the JRuby - User mailing list archive at Nabble.com.
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email