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 on http://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-
> > stdlib-1.5.3.jar!/META-INF/jruby.home/lib/ruby/1.8/monitor.rb:191)
> > at MonitorMixin.mon_synchronize(/Library/Tomcat/Home/webapps/RSM/WEB-
> > INF/gems/gems/activerecord-3.0.1/lib/active_record/connection_adapters/
> > abstract/connection_pool.rb:189)
> > 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:96)
> > at ActiveRecord::ConnectionAdapters::ConnectionPool.connection(/
> > Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-3.0.1/
> > lib/active_record/connection_adapters/abstract/connection_pool.rb:318)
> > at
> > ActiveRecord::ConnectionAdapters::ConnectionHandler.retrieve_connection(/
> > Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/activerecord-3.0.1/
> > lib/active_record/connection_adapters/abstract/
> > connection_specification.rb:97)
> > at #<Class:01x1aff2be8>.retrieve_connection(/Library/Tomcat/Home/
> > webapps/RSM/WEB-INF/gems/gems/activerecord-3.0.1/lib/active_record/
> > connection_adapters/abstract/connection_specification.rb:89)
> > at #<Class:01x1aff2be8>.connection(/Library/Tomcat/Home/webapps/RSM/
> > WEB-INF/gems/gems/arel-1.0.1/lib/arel/engines/sql/engine.rb:9)
> > at Arel::Sql::Engine.connection(/Library/Tomcat/Home/webapps/RSM/WEB-
> > INF/gems/gems/arel-1.0.1/lib/arel/engines/sql/relations/table.rb:37)
> > at Arel::Table.initialize(/Library/Tomcat/Home/webapps/RSM/WEB-INF/
> > gems/gems/activerecord-3.0.1/lib/active_record/base.rb:850)
> > at (unknown).new(/Library/Tomcat/Home/webapps/RSM/WEB-INF/gems/gems/
> > activerecord-3.0.1/lib/active_record/base.rb:850)
> > at #<Class:01x1aff2be8>.arel_table(/Library/Tomcat/Home/webapps/RSM/
> > WEB-INF/gems/gems/activerecord-3.0.1/lib/active_record/base.rb:896)
> > at #<Class:01x1aff2be8>.relation(/Library/Tomcat/Home/webapps/RSM/WEB-
> > INF/gems/gems/activerecord-3.0.1/lib/active_record/named_scope.rb:32)
> > at ActiveRecord::NamedScope::ClassMethods.scoped(/Library/Tomcat/Home/
> > webapps/RSM/WEB-INF/gems/gems/activerecord-3.0.1/lib/active_record/
> > base.rb:441)
> > at #<Class:01x1aff2be8>.limit(/Library/Tomcat/apache-tomcat-6.0.29/
> > webapps/RSM/WEB-INF/app/models/artist.rb:5)
> > at (unknown).(unknown)(/Library/Tomcat/apache-tomcat-6.0.29/webapps/
> > RSM/WEB-INF/app/models/artist.rb:239)
> > at (unknown).(unknown)(/Library/Tomcat/apache-tomcat-6.0.29/webapps/
> > RSM/WEB-INF/app/models/artist.rb:239)
>
> ...
>
> 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