Just checked - there is no cookie when I run my app in a java container
so no session is established!
Everything works when I run the application from mongrel/webbrick using
CRuby. Heck, it also works when running webbrick from jruby using jruby
script/server!
The only session related difference in the code is what I took from your
slides. I.e.
if defined?(JRUBY_VERSION) && defined?($servlet_context)
# Java session store:
config.action_controller.session_store =
:java_servlet_store
# Do nothing in impl. - let java handle this.
class CGI::Session::JavaServletStore
def initialize(session, options) end
def restore; end
def update; end
def close; end
end
end
— Den fre 6/6/08 skrev Nick S. <[email protected]>:
Fra: Nick S. <[email protected]>
Emne: Re: [jruby-user] jruby1.1.2 - rack exception on glassfish :
undefined method `each’ for 0:Fixnum
Til: [email protected]
Cc: [email protected]
Dato: fredag 6. juni 2008 23.33
As long as you don’t specify any session store (e.g.,
config.session_store is commented out), :java_servlet_store should be
used as the default. You can verify this by checking your browser
cookies. You should see JSESSIONID instead of the typical Rails/Ruby
cookie name.
/Nick
On Fri, Jun 6, 2008 at 4:27 PM, M C <[email protected]> wrote:
> Hi Nick,
>
> GREAT TIP Nick!!! I did not know jetty-rails! Thanks!
>
> I still got the same error but at least it is consistent and it is
much
> easier now to try things out in a java container!
>
> I think the problem is that the java container (both jetty and
glasfish
with
> warble) does not create a session on demand. Is your trick about
using the
> java_servlet_store in your slides incomplete. Is there anything
else I
have
> to do ?
>
> — Den fre 6/6/08 skrev Nick S. <[email protected]>:
>
> Fra: Nick S. <[email protected]>
> Emne: Re: [jruby-user] jruby1.1.2 - rack exception on glassfish :
undefined
> method `each’ for 0:Fixnum
> Til: [email protected]
> Cc: [email protected]
> Dato: fredag 6. juni 2008 22.54
>
> Maybe you can try using jetty-rails to run your app? It uses
> JRuby-Rack internally, and may help elucidate where the problem
lies.
>
> jruby -S gem install jetty-rails
> jruby -S jetty_rails
>
> /Nick
>
> On Fri, Jun 6, 2008 at 3:21 PM, M C <[email protected]>
wrote:
>> Hi Nick,
>>
>> Thanks for helping out. My application has a launch page
without
session
>> handling and then a bunch of other pages with session handling.
The
error
>> occurs after the first redirect to one of the pages that
requires
> sessions.
>> So I guess this may be related to session handling.
>>
>> Unfortunately it is a bit hard to figure out what is wrong for
me
because
> I
>> can’t reproduce the problem outside the java web container (and
>>
> generating/deploying/undeploying war’s takes a lot of time). I
also
> had
>> problems initially with lack of server logs with I have now
happily
solved
>> by looking in your railsconf 2008 slides.
>>
>> After my first posting - seeing your informative railsconf 2008
slides
- I
>> manged to setup rails to do servlet container logging which
was very
>> helpful (by default there is not much rails info in the
glassfish log
> which
>> does make it hard to debug). I also specified the
java_servlet_store
and
>> other settings that you suggested in your presentation. I hoped
this
would
>> help but now I get a new error instead at about the same place
(see
> below):
>>
>> P.S. Your presentation did leave out some interesting details
about
where
> to
>> place the different pieces of code and the exact value of
>> “page_cache_directory” (ex. for glassfish). So I guessed
> and
> experimented
>> until I got it to work (apparently). I would be really
interesting
with a
>> sample hello world showing the 100% correct way of setting all
this up
for
>> glassfish.
>>
>> The new error I got:
>> WebModule[] ServletContext.log():/!\ FAILSAFE /!\ Fri Jun 06
> 21:48:26 +0200
>> 2008 Status: 500 Internal Server Error You have a nil object
when you
> didn’t
>> expect it! You might have expected an instance of
ActiveRecord::Base.
The
>> error occurred while evaluating nil.[]
>>
>
/Library/Java/libs/glassfish/domains/domain1/generated/jsp/j2ee-modules/myapp/loader/cgi/session.rb:305:in
>> []' >> > /Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/cgi_process.rb:134:in >> >
session’
>>
>
/Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/cgi_process.rb:166:in
>> stale_session_check!' >> > /Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/cgi_process.rb:114:in >>
session’
>>
>
/Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/base.rb:1131:in
>> assign_shortcuts' >> > /Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/flash.rb:167:in >>
assign_shortcuts_with_flash’
>>
>
/Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/base.rb:518:in
>>
> process' >> > /Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in >>
process_with_filters’
>>
>
/Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
>> process_with_session_management_support' >> > /Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in >>
process’
>>
>
/Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
>>
> handle_request' >> > /Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in >>
dispatch’
>>
>
/Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
>> dispatch_cgi' >> > /Library/Java/libs/glassfish/domains/domain1/applications/j2ee-modules/myapp/WEB-INF/gems/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in >>
dispatch’
>>
>
/Library/Java/libs/glassfish/domains/domain1/generated/jsp/j2ee-modules/myapp/loader/rack/adapter/rails.rb:37:in
>> serve_rails' >> > /Library/Java/libs/glassfish/domains/domain1/generated/jsp/j2ee-modules/myapp/loader/rack/adapter/rails.rb:44:in >> >
call’
>>
>
/Library/Java/libs/glassfish/domains/domain1/generated/jsp/j2ee-modules/myapp/loader/jruby/rack/rails.rb:129:in
>> call' >> > /Library/Java/libs/glassfish/domains/domain1/generated/jsp/j2ee-modules/myapp/loader/rack/handler/servlet.rb:22:in >>
call’ :1
>>
>> /Morten
>>
>> — Den man 2/6/08 skrev Nick S.
<[email protected]>:
>>
>>> Is this a problem with JRuby, Warble or something else.
>>
>> Probably JRuby-Rack. A colleague of mine actually managed to
generate
>> close to the same stack trace, but I could not reproduce it and
would
>> still like to find out the cause. Can you give more details on
what
>> you did to get this error?
>>
>>
>>
>> ________________________________
>> Trænger du til at se det store billede? Kelkoo giver dig gode
tilbud
på
> LCD
>> TV!
>
> ________________________________
> Trænger du til at se det store billede? Kelkoo giver dig gode
tilbud på
LCD
> TV!
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
________________________________________________________
Audi, Fiat, Peugeot, Skoda, Porsche, Toyota, Ford - Kelkoo har brugte
biler til en hver smag! Klik her for at sammenligne
priser.(http://dk.yahoo.com/r/pat/mmb)