Also, i'm seeing a bunch of warnings for reinitializing constants in my environment.rb file -- it appears as though the environment is being loaded more than once. I mention this as I think it might be related to the load error.

webtier@javadesktop.org wrote:
> Hi, i'm trying to run a large rails app (12k+ LOC) under GF with the Glassfish v3 gem.
>
> I start the app with: $ jruby -S glassfish_rails
>
> The server starts without a hitch but as soon as I hit a controller I get a NameError:
> NameError: uninitialized constant PointObserver
>
> Now i'm sure this class is included in my environment's config.load_path -- in fact, starting a rails console session under jruby and typing PointObserver doesn't raise the exception, so i'm fairly sure this is isolated to my GF server. Furthermore, the app runs fine under JRuby WEBrick (jruby -S script/server webrick).
>
> Here is a link to the stack trace: http://pastie.org/311820
>
> My Setup:
> $ jruby --version => jruby 1.1.4 (ruby 1.8.6 patchlevel 114) (2008-09-23 rev 6586) [i386-java]
> $ glassfish --version => GlassFish gem version: 0.9.0
> Rails 2.0.2 "frozen" to vendor/rails
>
> Also, i'm seeing a bunch of warnings for reinitializing constants in my environment.rb file -- it appears as though the environment is being loaded more than once. I mention this as I think it might be related to the load error.
>
>
Thanks for reporting. There is a bug in the glassfish gem's rails
adapter where it is parsing environment.rb twice. I just fixed this.
Although not sure this is what was causing the NameError. Any chance you
can provide a testcase. OR maybe I can send you the patched jar file for
you to try out?

That jar fixed the re-init warnings for my environment.rb constants, the original NameError still persists.

I think the problem may be due to our code using custom load paths with non-namespaced constants.

For example, we have modules like Authentication that are in app/mixins/authentication.rb -- if I change the class name to Mixins::Authentication, GF seems to be able to load it. I realized this after I removed the observer class altogether -- there were more NameErrors, among them the one for the Authentication module. Subsequent NameErrors also popped up whenever I visited pages that reference models in subfolders (e.g. app/models/features/some_feature.rb) -- if I try to namespace these, I get a rails error saying the file didn't define the top-level constant rails expected...for example, if I change PointObserver to Observers::PointObserver, I get "Expected app/observers/point_observer.rb to define PointObserver".

This may not be the most scientific approach of isolating the issue but its really difficult to repro any other way (console & tests show no errors). Hopefully this will provide some direction for a resolution.

webtier@javadesktop.org wrote:
> That jar fixed the re-init warnings for my environment.rb constants, the original NameError still persists.
>
> I think the problem may be due to our code using custom load paths with non-namespaced constants.
>
> For example, we have modules like Authentication that are in app/mixins/authentication.rb -- if I change the class name to Mixins::Authentication, GF seems to be able to load it. I realized this after I removed the observer class altogether -- there were more NameErrors, among them the one for the Authentication module. Subsequent NameErrors also popped up whenever I visited pages that reference models in subfolders (e.g. app/models/features/some_feature.rb) -- if I try to namespace these, I get a rails error saying the file didn't define the top-level constant rails expected...for example, if I change PointObserver to Observers::PointObserver, I get "Expected app/observers/point_observer.rb to define PointObserver".
>
>

This is good data. Can you provide how you are loading using custom load
path? Are you using $LOAD_PATH to load up your non-namespaced code?