Skip to main content

TOTD # 73: JRuby and GlassFish Integration Test #4: JRuby 1.2.0 RC2 + Rails 2.2.x + GlassFish v2 + Warbler

Posted by arungupta on March 11, 2009 at 2:21 PM PDT



href="http://blogs.sun.com/arungupta/entry/totd_70_jruby_and_glassfish">TOTD
#70, href="http://blogs.sun.com/arungupta/entry/totd_71_jruby_and_glassfish">#71,
href="http://blogs.sun.com/arungupta/entry/totd_72_jruby_and_glassfish">#72
shows the first three integration tests that I typically run to ensure
that the
latest JRuby and GlassFish versions work nicely with each other.
  href="http://blogs.sun.com/arungupta/entry/totd_70_jruby_and_glassfish">#70
showed how to create a trivial Rails application and run it using href="http://rubyforge.org/projects/glassfishgem/">GlassFish
Gem.  href="http://blogs.sun.com/arungupta/entry/totd_71_jruby_and_glassfish">#71
showed how the same application can be deployed on href="https://glassfish.dev.java.net/downloads/v3-prelude.html">GlassFish
v3 Prelude.  href="http://blogs.sun.com/arungupta/entry/totd_72_jruby_and_glassfish">#72
showed how to deploy the same application on GlassFish v3.



The next test in the series is to ensure WAR-based deployment of a
Rails application continue to work on GlassFish v2. It also shows that
JNDI database connection pooling also work as expected. The latest
publicly
available build is href="https://glassfish.dev.java.net/downloads/v2.1-b60e.html">GlassFish
v2.1.



Lets begin integration test #4.

  1. Install Warbler
    gem ...


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/jruby-1.2.0RC2/samples/rails/runner
    >../../../bin/jruby
    -S gem install warbler


    JRuby limited openssl loaded. gem install jruby-openssl for full
    support.

    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL

    Successfully installed warbler-0.9.12

    1 gem installed

    Installing ri documentation for warbler-0.9.12...

    Installing RDoc documentation for warbler-0.9.12...
  2. Edit "config/database.yml" and change the production
    database adapater from:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    production:

      adapter: mysql

      encoding: utf8

      database: runner_production

      pool: 5

      username: root

      password:

      socket: /tmp/mysql.sock



    to


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    production:

      adapter: jdbcmysql

      encoding: utf8

      database: runner_production

      pool: 5

      username: duke

      password: glassfish

      socket: /tmp/mysql.sock

      jndi:
    jdbc/runner_production


     
    driver: com.mysql.jdbc.Driver



    The changes are highlighted in bold.



    Notice "jndi"
    key/value pair is specified along with "username" and "password". The
    JNDI reference is created for the GlassFish domain later. The
    reference is not resolved when this adapter is used with the JRuby
    CLI and so it falls back to username/password. However this JNDI
    reference is correctly resolved during runtime when the application is
    deployed as a WAR file in GlassFish.

  3. Create and migrate the
    production database as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/jruby-1.2.0RC1/samples/rails/runner > style="font-weight: bold;">../../../bin/jruby -S rake
    db:create RAILS_ENV=production

    (in /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner)

    ~/tools/jruby-1.2.0RC1/samples/rails/runner > style="font-weight: bold;">../../../bin/jruby -S rake
    db:migrate RAILS_ENV=production

    (in /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner)

    ==  CreateRunners: migrating
    ==================================================

    -- create_table(:runners)

       -> 0.1150s

       -> 0 rows

    ==  CreateRunners: migrated (0.1170s)
    =========================================



    Note, how "RAILS_ENV=production" is specified at the command-line to
    ensure the production environment.

  4. Copy MySQL Connector/J jar in GLASSFISH_HOME/lib as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/glassfish/v2.1/glassfish/ > style="font-weight: bold;">cp
    ~/tools/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar
    ./lib



    This is required for connection to the MySQL database.

  5. Fire up GlassFish v2.1 as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/glassfish/v2.1/glassfish/bin
    >./asadmin
    start-domain


    Starting Domain domain1, please wait.

    Default Log location is
    /Users/arungupta/tools/glassfish/v2.1/glassfish/domains/domain1/logs/server.log.

    Redirecting output to
    /Users/arungupta/tools/glassfish/v2.1/glassfish/domains/domain1/logs/server.log

    Domain domain1 started.

    Domain [domain1] is running [Sun GlassFish Enterprise Server v2.1
    (9.1.1) (build b60e-fcs)] with its configuration and logs at:
    [/Users/arungupta/tools/glassfish/v2.1/glassfish/domains].

    Admin Console is available at [http://localhost:4848].

    Use the same port [4848] for "asadmin" commands.

    User web applications are available at these URLs:

    [http://localhost:8080 https://localhost:8181 ].

    Following web-contexts are available:

    [/web1  /__wstx-services runner ].

    Standard JMX Clients (like JConsole) can connect to JMXServiceURL:

    [service:jmx:rmi:///jndi/rmi://Macintosh-187.local:8686/jmxrmi] for
    domain management purposes.

    Domain listens on at least following ports for connections:

    [8080 8181 4848 3700 3820 3920 8686 ].

    Domain supports application server clusters and other standalone
    instances.



    The logs are created in "domains/domain1/logs/server.log".
    Optionally, you can specify "--verbose" on the command-line to dump the
    log on the console itself.

  6. Create JDBC connection pool as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/glassfish/v2.1/glassfish/bin > style="font-weight: bold;">./asadmin
    create-jdbc-connection-pool --datasourceclassname
    com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype
    javax.sql.DataSource --property
    "User=duke:Password=glassfish:URL=jdbc\:mysql\://localhost/runner_production"
    jdbc/runner_pool

    Command create-jdbc-connection-pool executed successfully.


  7. Create JDBC resource as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/glassfish/v2.1/glassfish/bin > style="font-weight: bold;">./asadmin create-jdbc-resource
    --connectionpoolid jdbc/runner_pool jdbc/runner_production

    Command create-jdbc-resource executed successfully.
  8. Create Warbler config file as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/jruby-1.2.0RC2/samples/rails/runner > style="font-weight: bold;">../../../bin/jruby -S warble
    config

    cp
    /Users/arungupta/tools/jruby-1.2.0RC2/lib/ruby/gems/1.8/gems/warbler-0.9.12/generators/warble/templates/warble.rb
    config/warble.rb
  9. Edit "config/warble.rb" to bundle the required gems by
    adding the following fragment:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
     # Include all gems which are used by the
    web application

      require "#{RAILS_ROOT}/config/environment"

      BUILD_GEMS = %w(warbler rake rcov)

      for gem in Gem.loaded_specs.values

        next if BUILD_GEMS.include?(gem.name)

        config.gems[gem.name] =
    gem.version.version

      end



    as specified href="http://wiki.jruby.org/wiki/Warbler#Automatically_figure_out_gems">here.
    And then explicitly specify the runtime gem dependency by adding the
    following line:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    config.gems += ["activerecord-jdbc-adapter"]



    right after the previous code fragment. The "activerecord-jdbc-adapter"
    dependency needs to be explicitly included because this is required
    only at the runtime and so not resolved correctly by the previous code
    fragment.

  10. And create the WAR file as:


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/jruby-1.2.0RC2/samples/rails/runner > style="font-weight: bold;">../../../bin/jruby -S warble

    mkdir -p tmp/war/WEB-INF/gems/specifications

    cp
    /Users/arungupta/tools/jruby-1.2.0RC2/lib/ruby/gems/1.8/specifications/rails-2.2.2.gemspec
    tmp/war/WEB-INF/gems/specifications/rails-2.2.2.gemspec

    mkdir -p tmp/war/WEB-INF/gems/gems

    . . .

    cp public/javascripts/prototype.js tmp/war/javascripts/prototype.js

    cp public/stylesheets/scaffold.css tmp/war/stylesheets/scaffold.css

    mkdir -p tmp/war/WEB-INF
  11. Deploy the WAR file ...


    style="text-align: left; background-color: rgb(204, 204, 255); width: 100%;"
    cellpadding="2" cellspacing="2">
    ~/tools/jruby-1.2.0RC2/samples/rails/runner > style="font-weight: bold;">~/tools/glassfish/v2.1/glassfish/bin/asadmin
    deploy runner.war

    Command deploy executed successfully.



    After adding few entries the page at
    "http://localhost:8080/runner/runners" looks like:



    alt=""
    src="http://blogs.sun.com/arungupta/resource/ror/jruby12-rails222-gfv2.1-runners.png">


So we are able to deploy a trivial Rails application as WAR file on
GlassFish v2.1 and also leverage the JDBC connection pooling, that
passes Test# 4.



Later blogs will show the remainder of tests. The current set of tests
are available using the tags href="http://blogs.sun.com/arungupta/tags/jruby+glassfish+integrationtest">rubyonrails+glassfish+integrationtest.



Please leave suggestions on other TOTD (Tip Of The Day) that
you'd like to see.
A complete archive of all tips is available href="http://blogs.sun.com/arungupta/tags/totd">here.




Technorati: totd
rubyonrails
glassfish
v2 href="http://technorati.com/tag/jruby">jruby href="http://technorati.com/tags/warbler">warbler href="http://technorati.com/tags/connectionpooling">connectionpooling
jdbc href="http://technorati.com/tags/jndi">jndi href="http://technorati.com/tags/integrationtest">integrationtest

Related Topics >>

Comments

We have a subscription (we're a large university) and have an ongoing ticket on the matter - but so far support has not been able to provide much information on the issue. I came to you after seeing your latest post about jruby/glassfish hoping that you may have personally run into the issue before...

users@glassfish.dev.java.net is a more appropriate alias for these type of questions/discussions. Anyway, some more information will be required to debug this: - What version of JRuby, Rails, ActiveRecord Adapter ? - What database are you using ? - Why this application is getting deployed on nodeagents ? Do you have a clustering setup in production ?

Sorry for the extra long stack trace I'm about to paste in here... but I'm really hoping you can help me shed some light on this. I've written and deployed several rails apps in the past, and have recently written one destined to be run on our glassfish v2 server environment. After running into troubles deploying the application, I finally tried creating a brand new rails app from the 'rails' command, modifying only database.yml, adding the jdbc driver, then creating the war with warbler. The resulting wars run perfectly on my locally installed tomcat and glassfish servers. When ever we deploy *any* jruby/rails app to our production environment, however, we *always* get the following error. This is running Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs) on Solaris 10. Any ideas? If we can't solve this soon, they may scrap the ruby/rails project here... so I'm getting desperate. Thanks! application initialization failed javax.servlet.ServletException: org.jruby.rack.RackInitializationException: undefined method `delegate' for ActiveRecord::NamedScope::Scope:Class from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105:in `each' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105 from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:35 from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256:in `require_frameworks' ... 10 levels... from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22:in `instance_eval' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22:in `initialize' from :3 at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:42) at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:38) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4632) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5312) at com.sun.enterprise.web.WebModule.start(WebModule.java:353) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:989) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:973) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:704) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1627) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1232) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:182) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:278) at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:1005) at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:992) at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:470) at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:182) at com.sun.enterprise.ee.admin.mbeans.ServerRuntimeMBean.forwardEvent(ServerRuntimeMBean.java:95) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:381) at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:364) at com.sun.enterprise.admin.runtime.BaseRuntimeMBean.invoke(BaseRuntimeMBean.java:468) at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213) at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784) at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90) at $Proxy1.invoke(Unknown Source) at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304) at com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:174) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1410) at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1247) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1343) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:784) at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) at java.lang.Thread.run(Thread.java:595) Caused by: org.jruby.rack.RackInitializationException: undefined method `delegate' for ActiveRecord::NamedScope::Scope:Class from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105:in `each' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105 from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:35 from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256:in `require_frameworks' ... 10 levels... from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22:in `instance_eval' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22:in `initialize' from :3 at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:154) at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:53) at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:30) ... 49 more Caused by: org.jruby.exceptions.RaiseException at Kernel.method_missing(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:107) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105) at Array.each(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:35) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256) at Rails::Initializer.require_frameworks(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256) at Array.each(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256) at Rails::Initializer.require_frameworks(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/jruby/rack/rails.rb:46) at Rails::Initializer.require_frameworks_with_servlet_env(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:133) at Rails::Initializer.process(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:112) at #.run(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/config/environment.rb:13) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/config/environment.rb:29) at Kernel.load(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/jruby/rack/rails.rb:29) at JRuby::Rack::RailsServletHelper.load_environment(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/jruby/rack/rails.rb:152) at #.new(:3) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22) at Kernel.instance_eval(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22) at Kernel.instance_eval(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22) at Rack::Builder.initialize(:3) at (unknown).(unknown)(:1) ----- Root Cause ----- org.jruby.rack.RackInitializationException: undefined method `delegate' for ActiveRecord::NamedScope::Scope:Class from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105:in `each' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105 from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:35 from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256:in `require_frameworks' ... 10 levels... from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22:in `instance_eval' from /export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22:in `initialize' from :3 at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:154) at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:53) at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:30) at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:38) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4632) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5312) at com.sun.enterprise.web.WebModule.start(WebModule.java:353) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:989) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:973) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:704) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1627) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1232) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:182) at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:278) at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:1005) at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:992) at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:470) at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:182) at com.sun.enterprise.ee.admin.mbeans.ServerRuntimeMBean.forwardEvent(ServerRuntimeMBean.java:95) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:381) at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:364) at com.sun.enterprise.admin.runtime.BaseRuntimeMBean.invoke(BaseRuntimeMBean.java:468) at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213) at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784) at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90) at $Proxy1.invoke(Unknown Source) at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304) at com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:174) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1410) at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1247) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1343) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:784) at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) at java.lang.Thread.run(Thread.java:595) Caused by: org.jruby.exceptions.RaiseException at Kernel.method_missing(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:107) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105) at Array.each(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:105) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record/named_scope.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:35) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/activerecord-2.2.2/lib/active_record.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31) at Kernel.require(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256) at Rails::Initializer.require_frameworks(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256) at Array.each(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:256) at Rails::Initializer.require_frameworks(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/jruby/rack/rails.rb:46) at Rails::Initializer.require_frameworks_with_servlet_env(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:133) at Rails::Initializer.process(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/gems/gems/rails-2.2.2/lib/initializer.rb:112) at #.run(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/config/environment.rb:13) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/applications/j2ee-modules/jRubyTest/WEB-INF/config/environment.rb:29) at Kernel.load(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/jruby/rack/rails.rb:29) at JRuby::Rack::RailsServletHelper.load_environment(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/jruby/rack/rails.rb:152) at #.new(:3) at (unknown).(unknown)(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22) at Kernel.instance_eval(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22) at Kernel.instance_eval(/export/home/sjsas/sjsas/sges-2_1/nodeagents/as1-agent/jruby1/generated/jsp/j2ee-modules/jRubyTest/loader/rack/builder.rb:22) at Rack::Builder.initialize(:3) at (unknown).(unknown)(:1)

BTW, if you are running this in production, have you considered purchasing subscription ? That will certainly make sure you are responded in a timely manner. It's not expensive and starts at $999/server/year. More details at: http://www.sun.com/software/products/glassfish_portfolio/get_it.jsp Let me know what you think!

This is good information, thanks! I'm traveling today & tomorrow so will have some time to play with it. FWIW, I've been able to deploy a WAR file on GlassFish v2.1 in a clustered environment and got HTTP session failover working. Stay tuned for more details on that in a separate blogl

Thanks Arun - I have posted in the glassfish users mailing list. I'd tried several other help forms (mostly jRuby/Rails related) with no luck so far. If you have any ideas, I'd really appreciate hearing them: https://glassfish.dev.java.net/servlets/ReadMsg?list=users&msgNo=31782 Thanks :)