Problem with Sessions

Hi,

Using Netbeans 6.7.1, Rails Gem Version 2.3.2 MySQL Server 5.1

I am currently doing the depot application from the pragmatic programmer book (agile web development with rails) everything has been fine up until the point of creating sessions. I know they are using an earlier version of Ruby and the gems version is 2.2.2. As soon as I put the necessary code in the website no longer works and I get the following error in WEBrick:

=> Booting WEBrick => Rails 2.3.2 application starting on http://0.0.0.0:3001 JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL I:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/middleware_stack.rb:84 warning: given block not used => Call with -d to detach => Ctrl-C to shutdown server [2010-01-09 17:52:22] INFO WEBrick 1.3.1 [2010-01-09 17:52:22] INFO ruby 1.8.6 (2009-07-23) [java] [2010-01-09 17:52:22] INFO WEBrick::HTTPServer#start: pid=8420 port=3001

I have made sure I am using the updated (2.3 Ruby on Rails) ActionController's in the session_store.rb so I can only assume it is a problem with something else, which i have no idea about!

Anyone have any ideas?

Thanks,

Matt

the website no longer works and I get the following error in WEBrick:

? I don't see any "error" in the following, and certainly nothing to do with sessions. Can you explain why you think you have some kind of problem?

However, before you go any further I'd strongly recommend you update JRuby to 1.4.0 - 1.2.0 is really old...

Why is jruby even in the equation? Is it a Netbeans thing?

When i run the application I cannot access any of the pages (store, products...etc) I get an error page saying "Sorry there is a problem with this page" come up.

If i remove the code from sessions_store and remove the DB creation the site begins to work again.

I will look at updating my JRuby version.

Hassan Schroeder-2 wrote:

What's in the log file? Perhaps there's a clue there.

Not sure what "remove the DB creation" means, but --

Instead of making random changes, you should look at the error(s) in your logs; post the stack trace here if you have questions about it.

The log file doesnt seem to have anything wrong.

I have just sent this to a friend and it all works on his pc, he is used exectly the same versions of JRuby, Netbeans, Webrick..etc and it works fine for him.

The error I am getting is when i try to go to any page I get this:

"We're sorry, but something went wrong. We've been notified about this issue and we'll take a look at it shortly."

Its the books 500 internal error message. Could it be my browser settings?

Curtis Cooley-3 wrote:

The log file doesnt seem to have anything wrong.

Possible but unlikely -- what's the last entry when you get this 500 error?

Its the books 500 internal error message. Could it be my browser settings?

Actually, if you're playing with session logic, you should try clearing *all* the cookies for your current domain and try again.

Thanks for your input guys, I have sorted the problem with the simplest of solutions I should have tried earlier...

Restarted my pc, something must have messed up maybe with MySQL or maybe with my browser. I just got so used to it being my dodgy code!! Amazing how you can try and over complicate things! :smiley:

Hassan Schroeder-2 wrote:

MattWim wrote:

Thanks for your input guys, I have sorted the problem with the simplest of solutions I should have tried earlier...

Restarted my pc, something must have messed up maybe with MySQL or maybe with my browser. I just got so used to it being my dodgy code!! Amazing how you can try and over complicate things! :smiley:

Good to see you fixed it :slight_smile:

I'm working through the same book at the moment myself (a great book IMO) and found that when i was coding up the session stuff i had to stop and restart the server a couple of times and also do a 'rake db:session:clear' once as well. If you run into the same problem again it's worth trying (its not the only place in the book that doing this has solved me problems actually).

Have fun with the rest of the book!