Ruby on Rails Tuesday, November 2, 2010

OK - it is somehow related with your tomcat setup.

my application works with tomcat6 as well with jetty.

I also found your previous post. which was related to mysql-connector-
java-5.1.13-bin.jar

my WEB-INF/lib directory from the warfile has only jruby-complete.jar
+ jruby-rack.jar in it, everything else comes from the gems in WEB-INF/
gems.

next thought is that the tomcat has mysql-connector-java-5.1.13-
bin.jar in shared lib for warfiles ?

with regards, Kristian

On Nov 2, 11:51 pm, MJW2529 <mjwhite2...@yahoo.com> wrote:
> This does seem to be specific to Tomcat.  I ran the same war file
> under the jetty server and it ran without error.
> I then reran it under Tomcat and I got the
>
> SEVERE: Application Error
> org.jruby.rack.RackInitializationException: ActiveRecord::JDBCError:
> Generated keys not requested. You need to specify
> Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate() or
> Connection.prepareStatement().: SET SQL_AUTO_IS_NULL=0
>
> error again.
>
> On Nov 2, 11:36 am, MJW2529 <mjwhite2...@yahoo.com> wrote:
>
> > I ran this against the production environment under WEBrick and it
> > works without error.
> > At the console I see the following output.  Notice that it still runs
> > the SQL statement: SET SQL_AUTO_IS_NULL=0
> > But it doesn't generate the same error that it does when I run it as a
> > war file.
>
> > $ jruby -S rails server -e production
> > => Booting WEBrick
> > => Rails 3.0.1 application starting in development onhttp://0.0.0.0:3000
> > => Call with -d to detach
> > => Ctrl-C to shutdown server
> > [2010-11-02 09:11:50] INFO  WEBrick 1.3.1
> > [2010-11-02 09:11:50] INFO  ruby 1.8.7 (2010-09-28) [java]
> > [2010-11-02 09:11:50] INFO  WEBrick::HTTPServer#start: pid=46200
> > port=3000
>
> > Started GET "/albums/list" for 0:0:0:0:0:0:0:1%0 at Tue Nov 02
> > 09:12:06 -0700 2010
> >   SQL (1.0ms)  SET SQL_AUTO_IS_NULL=0
> >   Processing by AlbumsController#list as HTML
> >   Album Load (10.0ms)  SELECT `albums`.* FROM `albums` ORDER BY
> > albums.albumTitle ASC
> > Rendered albums/list.html.erb within layouts/application (220.0ms)
> > Completed 200 OK in 490ms (Views: 265.0ms | ActiveRecord: 11.0ms)
>
> > As for running this with jetty, I did get it installed but I'm not
> > familiar with maven and was not able to find any detailed instructions
> > for running it within the context of a jruby project.  i.e. no idea
> > where the pom.xml file goes or what should be in it.  The mvn package
> > command just gave me a bunch of errors.
>
> > On Nov 1, 11:00 pm, mkristian <meier.krist...@gmail.com> wrote:
>
> > > from the stacktrace I see that it tries to create a new artist on
> > > startup. is this done somehow in an initializer or some so ?
>
> > > the actual error says that the autoincremented ids are not handled
> > > correctly. since you say it works with development webrick, it is not
> > > config problem as such. but you need to make sure that webrick against
> > > the production DB works:
>
> > > $ jruby -S rails server -r production
>
> > > regards Kristian
>
> > > PS still do not believe it is related to the servlet/tomcat as such
>
> > > On Nov 2, 8:32 am, MJW2529 <mjwhite2...@yahoo.com> wrote:
>
> > > > I'll go ahead and complete the process that you've outlined and see if
> > > > I can narrow it down.
> > > > In the meantime here's the complete trace of the error.
>
> > > > Nov 1, 2010 7:10:45 PM org.apache.catalina.core.ApplicationContext log
> > > > SEVERE: Application Error
> > > > org.jruby.rack.RackInitializationException: ActiveRecord::JDBCError:
> > > > Generated keys not requested. You need to specify
> > > > Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate() or
> > > > Connection.prepareStatement().: SET SQL_AUTO_IS_NULL=0
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-
> > > > jdbc-adapter-1.0.2-java/lib/arjdbc/jdbc/adapter.rb:178:in `execute'
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-
> > > > jdbc-adapter-1.0.2-java/lib/arjdbc/mysql/adapter.rb:14:in
> > > > `configure_connection'
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-
> > > > jdbc-adapter-1.0.2-java/lib/arjdbc/mysql/adapter.rb:385:in
> > > > `initialize'
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-
> > > > jdbc-adapter-1.0.2-java/lib/arjdbc/jdbc/connection_methods.rb:6:in
> > > > `new'
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-
> > > > jdbc-adapter-1.0.2-java/lib/arjdbc/jdbc/connection_methods.rb:6:in
> > > > `jdbc_connection'
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-
> > > > jdbc-adapter-1.0.2-java/lib/arjdbc/mysql/connection_methods.rb:18:in
> > > > `mysql_connection'
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/
> > > > activerecord-3.0.1/lib/active_record/connection_adapters/abstract/
> > > > connection_pool.rb:230:in `new_connection'
> > > >         from /Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/
> > > > activerecord-3.0.1/lib/active_record/connection_adapters/abstract/
> > > > connection_pool.rb:238:in `checkout_new_connection'
> > > >          ... 50 levels...
> > > >         from file:/Library/Tomcat/apache-tomcat-6.0.29/webapps/RSM/WEB-INF/
> > > > lib/jruby-rack-1.0.3.jar!/vendor/rack-1.2.1/rack/builder.rb:46:in
> > > > `initialize'
> > > >         from <script>:2:in `new'
> > > >         from <script>:2
>
> > > >         at org.jruby.rack.DefaultRackApplicationFactory
> > > > $4.init(DefaultRackApplicationFactory.java:184)
> > > >         at
> > > > org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:
> > > > 59)
> > > >         at
> > > > org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:
> > > > 94)
> > > >         at
> > > > org.jruby.rack.servlet.DefaultServletDispatcher.process(DefaultServletDispatcher.java:
> > > > 36)
> > > >         at org.jruby.rack.RackFilter.doFilter(RackFilter.java:59)
> > > >         at
> > > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
> > > > 235)
> > > >         at
> > > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
> > > > 206)
> > > >         at
> > > > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
> > > > 233)
> > > >         at
> > > > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
> > > > 191)
> > > >         at
> > > > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
> > > > 127)
> > > >         at
> > > > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
> > > > 102)
> > > >         at
> > > > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
> > > > 109)
> > > >         at
> > > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
> > > > 298)
> > > >         at
> > > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
> > > > 857)
> > > >         at org.apache.coyote.http11.Http11Protocol
> > > > $Http11ConnectionHandler.process(Http11Protocol.java:588)
> > > >         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
> > > > 489)
> > > >         at java.lang.Thread.run(Thread.java:680)
> > > > Caused by: org.jruby.exceptions.RaiseException:
> > > > ActiveRecord::JDBCError: Generated keys not requested. You need to
> > > > specify Statement.RETURN_GENERATED_KEYS to Statement.executeUpdate()
> > > > or Connection.prepareStatement().: SET SQL_AUTO_IS_NULL=0
> > > >         at Kernel.raise(/Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/
> > > > activerecord-3.0.1/lib/active_record/connection_adapters/
> > > > abstract_adapter.rb:202)
> > > >         at ActiveRecord::ConnectionAdapters::AbstractAdapter.log(/Library/
> > > > Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-jdbc-
> > > > adapter-1.0.2-java/lib/arjdbc/jdbc/adapter.rb:178)
> > > >         at ActiveRecord::ConnectionAdapters::JdbcAdapter.execute(/Library/
> > > > Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-jdbc-
> > > > adapter-1.0.2-java/lib/arjdbc/mysql/adapter.rb:14)
> > > >         at ArJdbc::MySQL.configure_connection(/Library/Tomcat/Home/webapps/
> > > > RSM/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.0.2-java/lib/arjdbc/
> > > > mysql/adapter.rb:385)
> > > >         at ActiveRecord::ConnectionAdapters::MysqlAdapter.initialize(/Library/
> > > > Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-jdbc-
> > > > adapter-1.0.2-java/lib/arjdbc/jdbc/connection_methods.rb:6)
> > > >         at (unknown).new(/Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/
> > > > activerecord-jdbc-adapter-1.0.2-java/lib/arjdbc/jdbc/
> > > > connection_methods.rb:6)
> > > >         at #<Class:01x1aff2be8>.jdbc_connection(/Library/Tomcat/Home/webapps/
> > > > RSM/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.0.2-java/lib/arjdbc/
> > > > mysql/connection_methods.rb:18)
> > > >         at #<Class:01x1aff2be8>.mysql_connection(/Library/Tomcat/Home/webapps/
> > > > RSM/WEB-INF/gems/gems/activerecord-3.0.1/lib/active_record/
> > > > connection_adapters/abstract/connection_pool.rb:230)
> > > >         at ActiveRecord::ConnectionAdapters::ConnectionPool.new_connection(/
> > > > Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-3.0.1/
> > > > lib/active_record/connection_adapters/abstract/connection_pool.rb:238)
> > > >         at
> > > > ActiveRecord::ConnectionAdapters::ConnectionPool.checkout_new_connection(/
> > > > Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-3.0.1/
> > > > lib/active_record/connection_adapters/abstract/connection_pool.rb:194)
> > > >         at ActiveRecord::ConnectionAdapters::ConnectionPool.checkout(/Library/
> > > > Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-3.0.1/lib/
> > > > active_record/connection_adapters/abstract/connection_pool.rb:190)
> > > >         at Kernel.loop(/Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/
> > > > activerecord-3.0.1/lib/active_record/connection_adapters/abstract/
> > > > connection_pool.rb:190)
> > > >         at ActiveRecord::ConnectionAdapters::ConnectionPool.checkout(file:/
> > > > Library/Tomcat/apache-tomcat-6.0.29/webapps/RSM/WEB-INF/lib/jruby-
>
> ...
>
> read more »

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment