Forum: JRuby Glassfish gem 0.9.3 and Rails 2.3

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Miika Leppänen (Guest)
on 2009-03-20 09:57
(Received via mailing list)
Hello

I made a basic rails app (script/generate scaffold Post title:string
body:text). Then I moved app/models/post.rb to app/models/subfo/
post.rb and added
config.load_paths += Dir["#{RAILS_ROOT}/app/models/*"].find_all { |f|
File.stat(f).directory? }
to environment.rb.
Running this with "jruby script/server" works ok(WEBrick). But when
started with glassfish, it fails with uninitialized constant error(it
can't find the post.rb).

Versions:
jruby 1.2.0
glassfish 0.9.3
rails 2.3.2

I tried also to warble it and run it in tomcat, but it fails with
"something went wrong (500)" and no log messages.
Tried that with jruby-complete-1.1.6.jar + jruby-rack-0.9.3.jar and
jruby-complete-1.2.0.jar + jruby-rack-0.9.4-SNAPSHOT.jar.

- Miika

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Charles Oliver N. (Guest)
on 2009-03-21 20:23
(Received via mailing list)
Miika Leppänen wrote:
> can't find the post.rb).
So the basic Rails app works ok, but adding those load paths doesn't
seem to work?

Does it work ok with previous GF gem or JRuby 1.1.6?

Please file a bug for this and provide a sample app you expect to work
correctly.

- Charlie


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Jacob K. (Guest)
on 2009-03-24 19:43
(Received via mailing list)
That's odd, since Gem doesn't do any explicit loading of user classes:
we just require config/environment and let the rails loader take care of
the rest of it, which it seems like it does (since it works on WEBrick).

I can't think of any reason why script/server load behavior would be any
different from gem load behavior, and I don't want there to be, so I
agree with Charlie that I'd like to see a sample app so I can try to get
this worked out.

Miika Leppänen wrote:
> can't find the post.rb).
>
> - Miika
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Miika Leppänen (Guest)
on 2009-03-24 20:04
(Received via mailing list)
Hi

My sample app was created like this:
$ rails r23test
$ cd r23test
edit config/database.yml
---
development:
   adapter: jdbcmysql
   encoding: utf8
   database: r23test
   pool: 5
   username: root
   password:
   host: 127.0.0.1
---
$ script/generate scaffold Post title:string body:text
$ jruby -S rake db:create (or create by hand if db:create fails)
$ jruby -S rake db:migrate
$ mkdir app/models/subfo
$ mv app/models/post.rb app/models/subfo/
edit config/environment.rb
---
Rails::Initializer.run do |config|
...
   config.load_paths += ["#{RAILS_ROOT}/app/models/subfo"]
...
end
---
$ glassfish

And I got it working in tomcat with the help of
http://wiki.jruby.org/wiki/Rails_2.3.2

I can zip the app and post it somewhere if needed...


- Miika

On 24.3.2009, at 20.07, Jacob K. wrote:

> Miika Leppänen wrote:
>> error(it can't find the post.rb).
>>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Jacob K. (Guest)
on 2009-03-25 01:09
(Received via mailing list)
Yep, confirmed on gem. I'll look into it and see if I can figure out why
it's not loading correctly.

Miika Leppänen wrote:
>   database: r23test
> edit config/environment.rb
> http://wiki.jruby.org/wiki/Rails_2.3.2
>> take care of the rest of it, which it seems like it does (since it
>>> I made a basic rails app (script/generate scaffold Post title:string
>>> jruby 1.2.0
>>> ---------------------------------------------------------------------
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.