Giter Club home page Giter Club logo

trinidad_dbpool_extension's Introduction

Trinidad

Trinidad allows you to run Rails and/or Rack applications within an embedded Tomcat container. Apache Tomcat (formerly also Jakarta Tomcat) is an open source web server and Servlet container with a long history that dates back to the previous millenia.

Trinidad's goals with bringing Tomcat into JRuby land are mostly the following :

  • flexibility especially in terms of configuration it allows you to tune (almost) everything from a simple trinidad.yml (or .rb) configuration file
  • portability there's no vendor lock-in as we use JRuby::Rack, thus even if you do some Java integration or use it's Rack Servlet extensions you're still able to migrate to a standalone Tomcat or any other Servlet container
  • easy Java integration (just in-case you need it, it's there)
  • extensions such as connection pooling (sharing pools between deployed Rails apps) and (threaded) worker adapters for Resque and Delayed::Job

Installation

gem version dependency status

$ jruby -S gem install trinidad

NOTE: please use 1.5.0.B2 gem install trinidad --pre, esp. on JRuby 9K, as Trinidad 1.4 will no longer receive Tomcat (7.0.x) security updates.

Trinidad 1.4 requires (and supports) JRuby 1.6.8 or later (latest 1.7.x recommended).

Quick Start

$ cd a-rails-app
$ jruby -S trinidad

Setup

If you use Bundler, you might want to add Trinidad to your Gemfile :

gem 'trinidad', :require => nil

However this is not absolutely necessary, you might simply gem install trinidad and than run trinidad - keep in mind a server is not an application dependency.

Rails

Trinidad supports the same Rails version as the JRuby-Rack it founds on (or is specified/locked in your Gemfile), which are 4.x, 3.x and even 2.3 for JRuby-Rack 1.1.x (and the up coming 1.2). Merb is not supported.

$ trinidad

or if you prefer to use the Rack handler (e.g. for development) use :

$ rails s trinidad

Please note all configuration options will work using the Rack handler mode, you should usually only use it for development/tests and run trinidad on production.

Sinatra

$ ruby app.rb -s Trinidad

or configure your application to always use Trinidad :

require 'sinatra'
require 'trinidad'

configure do
  set :server, :trinidad
end

Rack

Trinidad auto-detects a plain-old Rack application (if there's a config.ru) :

$ trinidad

You can as well pass the server name to rackup to start the Rack handler :

$ rackup -s trinidad

Or you can set Trinidad as the default server in your config.ru file :

#\ -s trinidad

Trinidad solves the Rack "chicken-egg" problem when booting from a rackup file the same way as JRuby-Rack (since it boots all applications), that is :

  • if a Bundler Gemfile is detected, it first does a bundle/setup to load rack
  • otherwise the rack (gem) version might be specified using a magic comment in config.ru as # rack.version: ~>1.4.0 (or the latest installed gem is used)

NOTE: We recommend to use the plain trinidad mode for running apps (in production), since it supports runtime pooling while the "rackup" mode does not, it also provides you with better Java integration possibilities.

Also note that Trinidad does not mimic JRuby-Rack's (1.1.x) backwards compatible behavior of starting a pool for Rails but booting a thread-safe runtime for plain Rack applications by default. Runtime pooling is the default with Trinidad 1.4 and stays the same no matter the type of the application. This has changed in Trinidad 1.5 and it assumes thread-safe applications by default.

All major rack versions (< 2.0) are expected to be working fine with Trinidad.

Configuration

Trinidad allows you to configure parameters from the command line, the following is a list of the currently supported options (try trinidad -h):

  * -d, --dir ROOT_DIR            =>  web application root directory
  * -e, --env ENVIRONMENT         =>  rack (rails) environment
  * --rackup [RACKUP_FILE]        =>  rackup configuration file
  * --public PUBLIC_DIR           =>  web application public root
  * -c, --context CONTEXT         =>  application context path
  * --monitor MONITOR_FILE        =>  monitor for application re-deploys
  * -t, --threadsafe              =>  force thread-safe mode (use single runtime)
  * --runtimes MIN:MAX            =>  use given number of min/max jruby runtimes
  * -f, --config [CONFIG_FILE]    =>  configuration file
  * --address ADDRESS             =>  host address
  * -p, --port PORT               =>  port to bind to
  * -s, --ssl [SSL_PORT]          =>  enable secure socket layout
  * -a, --ajp [AJP_PORT]          =>  enable the AJP web protocol
  * --java_lib LIB_DIR            =>  contains .jar files used by the app
  * --java_classes CLASSES_DIR    =>  contains java classes used by the app
  * -l, --load EXTENSION_NAMES    =>  load options for extensions
  * --apps_base APPS_BASE_DIR     =>  set applications base directory
  * -g, --log LEVEL               =>  set logging level

You can also specify a default web.xml to configure your web application. By default the server tries to load the file config/web.xml but you can change the path by adding the option default_web_xml within your configuration file.

YAML Configuration

The server can be configured from a .yml file. By default, if a file is not specified, the server tries to load config/trinidad.yml. Within this file you can specify options available on the command line and tune server settings or configure multiple applications to be hosted on the server.

Advanced configuration options are explained in the wiki: http://wiki.github.com/trinidad/trinidad/advanced-configuration

$ jruby -S trinidad --config my_trinidad.yml
---
  port: 4242
  address: 0.0.0.0

Ruby Configuration

As an alternative to the config/trinidad.yml file, a .rb configuration file might be used to setup Trinidad. It follows the same convention as the YAML configuration - the file config/trinidad.rb is loaded by default if exists.

Trinidad.configure do |config|
  config.port = 4242
  config.address = '0.0.0.0'
  #config[:custom] = 'custom'
end

Logging

As you might notice on your first trinidad the server uses standard output :

kares@theborg:~/workspace/trinidad/MegaUpload$ trinidad -p 8000 -e staging
Initializing ProtocolHandler ["http-bio-8000"]
Starting Servlet Engine: Apache Tomcat/7.0.28
Starting ProtocolHandler ["http-bio-8000"]
Context with name [/] has started rolling
Context with name [/] has completed rolling

It also prints warnings and error messages on error output, while application specific log messages (e.g. logs from Rails.logger) always go into the expected file location at log/{environment}.log.

Application logging performs daily file rolling out of the box and only prints messages to the console while it runs in development mode, that means you won't see any application specific output on the console say in production !

Please note that these logging details as well as the logging format will be configurable with trinidad.yml/.rb within the next 1.4.x release.

If you plan to use a slice of Java with your JRuby and require a logger, consider using ServletContext#log. By default it is setup in a way that logging with ServletContext ends up in the same location as the Rails log. If this is not enough you can still configure a Java logging library e.g. SLF4J, just make sure you tell Trinidad to use it as well, if needed, using the jruby.rack.logging context parameter in web.xml.

Context Configuration

For slightly advanced (and "dirty" XML :)) application configuration Trinidad also supports the exact same context.xml format as Tomcat. Each web app is represented as a context instance and might be configured as such. You do not need to repeat configuring the same parameters you have already setup with the Trinidad configuration. This is meant to be mostly for those familiar with Tomcat internals. Currently the application's context.xml is expected to be located on the class-path under your [classes]/META-INF directory.

Context Doc: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

Serving Assets

Trinidad uses Tomcat's built-in capabilities to server your public files. We do recommend compiling assets up front and disabling the asset server (in production) if you're using the asset pipeline in a Rails application. If you do not put a web-server such as Apache in front of Trinidad you might want to configure the resource caching (on by default for env != development) for maximum performance e.g. by default it's configured as follows :

---
  public:
    root: public # same as the above "public: public" setting
    cached: true # enable (in-memory) asset caching on for env != 'development'
    cache_ttl: 5000 # cache TTL in millis (might want to increase this)
    cache_max_size: 10240 # the maximum cache size in kB
    cache_object_max_size: 512 # max size for a cached object (asset) in kB
    #aliases: # allows to "link" other directories into the public root e.g. :
      #/home: /var/local/www

Note that this configuration applies to (server-side) resource caching on top of the "public" file-system. You do not need to worry about client side caching, it is handled out of the box with ETag and Last-Modified headers being set.

You might also "mount" file-system directories as aliases to your resources root to be served by your application (as if they were in the public folder).

NOTE: In development mode if you ever happen to rake assets:precompile make sure to remove your public/assets directory later, otherwise requests such as /assets/application.js?body=1.0 might not hit the Rails runtime.

Hot Deployment

Trinidad supports monitoring a file to reload applications, when the file tmp/restart.txt is updated (e.g. touch tmp/restart.txt on Unix or type nul >>tmp\restart.txt & copy /b tmp\restart.txt +,, on Windows), the server reloads the application the monitor file belongs to. This monitor file can be customized with the monitor configuration option.

Since version 1.4.0 Trinidad supports 2 reload strategies :

  • restart (default) synchronous reloading. This strategy pauses incoming requests while it reloads the application and then serves them once ready (or timeouts if it takes too long). It is the default strategy since 1.4.0 due it's more predictable memory requirements.

  • rolling a.k.a. "zero-downtime" (asynchronous) reloading strategy similar to Passenger's rolling reloads. This has been the default since 1.1.0 up till the 1.3.x line. If you use this you should account that your JVM memory requirements might increase quite a lot (esp. if you reload under heavy loads) since requests are being served while there's another version of the application being loaded.

NOTE: due the way class-loaders where setup internally, Trinidad might have failed releasing memory with reloads. This has been fixed in 1.5.0 please consider updating, it is meant to be backwards compatible.

If you're on Java 6 you will likely need to tune your JAVA_OPTS / JRUBY_OPTS for the JVM to do class unloading (consult the wiki for more information) :

JRUBY_OPTS="$JRUBY_OPTS -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled"

Configure the reload strategy per web application or globally e.g. :

---
  port: 8080
  environment: production
  reload_strategy: rolling

Virtual Hosts

It's possible to use Trinidad with multiple hosts and load the applications under them automatically. A (virtual) host represents an association of a network name (such as "www.example.com" with the particular server on which Tomcat is running. Please remember that each host must have its applications in a different directory. You can find out more at Tomcat's documentation.

Trinidad.configure do |config|
  config.hosts = {
    # applications path (host app base directory) => host names
    # (first one is the "main" host name, other ones are aliases)
    '/var/www/local/apps' => ['localhost', '127.0.0.1'],
    '/home/trinidad/apps' => 'appshost'
    # NOTE: by default a (default) 'localhost' host is setup
  }
end

Detailed host configuration is also possible using supported host options :

---
  port: 8080
  hosts:
    localhost:
      app_base: /home/trinidad/apps
      auto_deploy: false
      unpackWARs: true

If applications are configured via the web_apps section, the host for each application can be added with the host (or hosts) key, if a specified host does not exists (e.g. not configured or not "localhost") it will be created. If several applications belong to the same host, they are expected to reside under the same parent directory e.g. :

Trinidad.configure do |config|
  config.web_apps = {
    :mock1 => {
      :root_dir => 'rails_apps/mock1',
      :host     => ['rails.virtual.host', 'rails.host']
    },
    :mock2 => {
      :root_dir => 'rails_apps/mock2',
      :host     => 'rails.virtual.host'
    },
    :mock3 => {
      :root_dir => 'rack_apps/mock3',
      :host     => ['rack.virtual.host', 'rack.host']
    }
  }
end

Extensions

Trinidad allows to extend itself with more (not just Tomcat) features using extensions, they're essentially components hooked into Tomcat's life-cycle. Here is a list of the available extensions that are "officially supported" :

You can find further information on how to write extensions in the wiki.

Support

Copyright

Copyright (c) 2016 Team Trinidad. See LICENSE (http://en.wikipedia.org/wiki/MIT_License) for details.

trinidad_dbpool_extension's People

Contributors

btatnall avatar calavera avatar kares avatar madsbuus avatar patcheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

trinidad_dbpool_extension's Issues

TypeError: when Connecting to Multiple Databases

When connecting to the multiple databases you have to pre-format the values in your trinidad.yml for each db_pools as symbols otherwise you will get an error (see bottom).

Symbol formatted trinidad.yml to work around error:

web_apps:
  default:
    extensions:
      mysql_dbpool: 
        -
          :jndi: 'jdbc/Master'                
          :username: 'foo'                   
          :password: bad'                   
          :url: 'localhost:11211/master'     
          :maxActive: 100                     
          :maxIdle: 5                        
          :maxWait: 10000
        -
          :jndi: 'jdbc/Readonly'                
          :username: 'readonly'                   
          :password: 'bar                   
          :url:  'localhost:11211/readonly'     
          :maxActive: 100                     
          :maxIdle: 5                        
          :maxWait: 10000 

Error stacktrace:

 TypeError: can't convert nil into String
              create_resource at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad_dbpool-0.4.0/lib/trinidad_dbpool/webapp_extension.rb:16
                    configure at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad_dbpool-0.4.0/lib/trinidad_dbpool/webapp_extension.rb:9
                      collect at org/jruby/RubyArray.java:2339
                    configure at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad_dbpool-0.4.0/lib/trinidad_dbpool/webapp_extension.rb:9
  configure_webapp_extensions at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/lib/trinidad/extensions.rb:7
                         each at org/jruby/RubyHash.java:1186
  configure_webapp_extensions at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/lib/trinidad/extensions.rb:5
               create_web_app at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/lib/trinidad/server.rb:116
         create_from_web_apps at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/lib/trinidad/server.rb:80
                         each at org/jruby/RubyHash.java:1186
                          map at org/jruby/RubyEnumerable.java:728
         create_from_web_apps at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/lib/trinidad/server.rb:76
              create_web_apps at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/lib/trinidad/server.rb:62
                   initialize at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/lib/trinidad/server.rb:9
                       (root) at /Users/jmckinney/.rvm/gems/jruby-1.6.7/gems/trinidad-1.3.5/bin/trinidad:6
                         load at org/jruby/RubyKernel.java:1068
                       (root) at /Users/jmckinney/.rvm/gems/jruby-1.6.7/bin/trinidad:19

Pool is limited to database.yml pool size (rails 4)?

I am testing out trinidad_postgresql_dbpool_extension which seems to be working ok, except that the pool size does not increase beyond rails default (in database.yml).

It is possible I have mis-configured something?
My understanding was the pool would be configured and managed outside the rails runtime.
Also, my experience with trinidad/JVM/Tomcat is minimal so maybe I am overlooking something obvious or maybe issue is with rails 4?

  • rails 4 app
  • jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64]
  • using a shared (threadsafe!) runtime
  • gem versions (from Gem.lock)
    • trinidad (1.4.5)
    • trinidad_daemon_extension (0.4.0)
    • trinidad_dbpool (0.5.0)
    • trinidad_jars (1.2.4)
    • trinidad_postgresql_dbpool_extension (0.5.0)

starting trinidad via capistrano with the following command

cd /srv/xxxxx/current && jruby -S bundle exec trinidad --env staging --threadsafe --config config/trinidad.rb

# config/trinidad.rb
Trinidad.configure do |config|
  config.port = 4242

  config.extensions = {
    :daemon => {
      :pid_file => "tmp/pids/trinidad.pid"
    },

    :postgresql_dbpool => {
      :jndi => "jdbc/XXXX-DBPool-Staging",
      :url => "xxxx.com:5432/xxxx_staging",
      :username => "xxxx",
      :password => "xxxx",
      :maxActive => 100,
      :maxIdle => 20
    }
  }

  config.http = {
    :maxThreads => 25
  }
end

NOTE: pool is set to 7 in database.yml and that is how many db connections get established, it never goes over and throws ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds) when under load
My first try did not specify pool setting in database.yml, and in that case I ended up with 5 connections (default rails setting)

# config/database.yml
staging:
  adapter: jdbcpostgresql
  jndi: java:/comp/env/jdbc/XXXX-DBPool-Staging
  pool: 7

ActiveRecord::ConnectionNotEstablished: no connection available

The application runs just fine without the db-pool extension but errors when using trinidad_mssql_dbpool_extension. Should the jdbc-jtds driver be used or is the (more recent) ms-jdbc driver appropriate?

Environment:

OS: ubuntu-12.04 (64bit, desktop)
rails: 3.2.3
jruby: jruby 1.6.7.2 (ruby-1.9.2-p312) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [linux-amd64-java]
java -version:
  java version "1.6.0_26"
  Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
  Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

config/trinidad.yml:

environment: development
http:
  maxThreads: 2000
  connectionTimeout: 15000
ajp:
  port: 8009
  allowTrace: true
default:
  extensions:
    mssql_dbpool:
      jndi: 'jdbc/trinidad'
      username: 'dbuser'
      password: 'dbpass'
      url: 'jdbc:sqlserver://127.0.0.1:1433;databaseName=dbname;'

config/database.yml:

development:
  adapter:  jdbc
  jndi: java:/comp/env/jdbc/trinidad
  driver:   com.microsoft.sqlserver.jdbc.SQLServerDriver

Output of trinidad --config (works without trinidad_dbpool):

21.05.2012 13:57:34 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-3000"]
21.05.2012 13:57:34 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
21.05.2012 13:57:34 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
21.05.2012 13:57:34 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
2012-05-21 11:57:35 INFO: No global web.xml found
2012-05-21 11:57:35 INFO: Info: received max runtimes = 1
2012-05-21 11:57:35 INFO: jruby 1.6.7.2 (ruby-1.9.2-p312) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [linux-amd64-java]
2012-05-21 11:57:47 INFO: Info: received min runtimes = 1
2012-05-21 11:57:47 INFO: Info: received max runtimes = 1
2012-05-21 11:57:47 INFO: An exception happened during JRuby-Rack startup
no connection available
--- System
jruby 1.6.7.2 (ruby-1.9.2-p312) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [linux-amd64-java]
Time: 2012-05-21 13:57:47 +0200
Server: Apache Tomcat/7.0.26
jruby.home: /home/fpauser/.rbenv/versions/jruby-1.6.7.2

--- Context Init Parameters:
jruby.compat.version = 1.9.2
jruby.initial.runtimes = 1
jruby.max.runtimes = 1
jruby.min.runtimes = 1
public.root = /public
rails.env = development
rails.root = /

--- Backtrace
ActiveRecord::ConnectionNotEstablished: no connection available
                        set_native_database_types at arjdbc/jdbc/RubyJdbcConnection.java:517
                                       initialize at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/jdbc/connection.rb:86
                                       initialize at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/jdbc/adapter.rb:33
                                  jdbc_connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/jdbc/connection_methods.rb:6
                                 mssql_connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-1.2.2/lib/arjdbc/mssql/connection_methods.rb:27
                                         __send__ at org/jruby/RubyBasicObject.java:1704
                                             send at org/jruby/RubyKernel.java:2101
                                   new_connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:303
                          checkout_new_connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:313
                                         checkout at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:237
                                             loop at org/jruby/RubyKernel.java:1410
                                         checkout at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:232
                                  mon_synchronize at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/1.9/monitor.rb:201
                                         checkout at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:229
                                       connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:95
                              retrieve_connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:398
                              retrieve_connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:168
                                       connection at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:142
                                     clear_cache! at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/model_schema.rb:308
                              _callback_before_23 at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activerecord-3.2.3/lib/active_record/railtie.rb:91
  _run__649883903__prepare__1343209378__callbacks at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:421
                                         __send__ at org/jruby/RubyBasicObject.java:1698
                                             send at org/jruby/RubyKernel.java:2097
                                   __run_callback at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:405
                           _run_prepare_callbacks at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:390
                                         __send__ at org/jruby/RubyBasicObject.java:1698
                                             send at org/jruby/RubyKernel.java:2097
                                    run_callbacks at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/activesupport-3.2.3/lib/active_support/callbacks.rb:81
                                         prepare! at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/reloader.rb:74
                                         prepare! at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/actionpack-3.2.3/lib/action_dispatch/middleware/reloader.rb:48
                                         Finisher at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.3/lib/rails/application/finisher.rb:47
                                    instance_exec at org/jruby/RubyBasicObject.java:1757
                                              run at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:30
                                 run_initializers at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:55
                                             each at org/jruby/RubyArray.java:1615
                                 run_initializers at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.3/lib/rails/initializable.rb:54
                                      initialize! at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.3/lib/rails/application.rb:136
                                         __send__ at org/jruby/RubyBasicObject.java:1698
                                             send at org/jruby/RubyKernel.java:2097
                                   method_missing at /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30
                                           (root) at /home/fpauser/dev/ruby/webcms/webcms/config/environment.rb:5
                                          require at org/jruby/RubyKernel.java:1042
                                 load_environment at /home/fpauser/dev/ruby/webcms/webcms/config/environment.rb:23
                                 load_environment at file:/home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/jruby-rack-1.1.5/lib/jruby-rack-1.1.5.jar!/jruby/rack/rails_booter.rb:65
                                           (root) at <script>:1

--- RubyGems
Gem.dir: /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8
Gem.path:
/home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8
/home/fpauser/dev/ruby/webcms/webcms/WEB-INF/gems
Activated gems:
  bundler-1.1.3
  rake-0.9.2.2
  i18n-0.6.0
  multi_json-1.3.4
  activesupport-3.2.3
  builder-3.0.0
  activemodel-3.2.3
  erubis-2.7.0
  journey-1.0.3
  rack-1.4.1
  rack-cache-1.2
  rack-test-0.6.1
  hike-1.2.1
  tilt-1.3.3
  sprockets-2.1.3
  actionpack-3.2.3
  mime-types-1.18
  polyglot-0.3.3
  treetop-1.4.10
  mail-2.4.4
  actionmailer-3.2.3
  arel-3.0.2
  tzinfo-0.3.33
  activerecord-3.2.3
  activerecord-jdbc-adapter-1.2.2
  jdbc-jtds-1.2.5-java
  activerecord-jdbcmssql-adapter-1.2.2
  jdbc-sqlite3-3.7.2
  activerecord-jdbcsqlite3-adapter-1.2.2
  activeresource-3.2.3
  awesome_print-1.0.2
  bcrypt-ruby-3.0.1-java
  blankslate-2.1.2.4
  bouncy-castle-java-1.5.0146.1
  coffee-script-source-1.3.1
  execjs-1.3.2
  coffee-script-2.2.0
  rack-ssl-1.3.2
  json-1.7.1-java
  rdoc-3.12
  thor-0.14.6
  railties-3.2.3
  coffee-rails-3.2.2
  orm_adapter-0.0.7
  warden-1.1.1
  devise-2.0.4
  diff-lcs-1.1.3
  factory_girl-3.2.0
  factory_girl_rails-3.2.0
  ffi-1.0.11-java
  guard-1.0.2
  guard-rspec-0.7.0
  jbuilder-0.4.0
  jdbc-mssql-azure-0.0.1
  jquery-rails-2.0.2
  jruby-openssl-0.7.6.1
  jruby-rack-1.1.5
  log4r-1.1.10
  open4-1.3.0
  polyamorous-0.5.0
  rails-3.2.3
  rake-remote_task-2.0.6
  ransack-0.6.0
  rspec-core-2.10.0
  rspec-expectations-2.10.0
  rspec-mocks-2.10.1
  rspec-2.10.0
  rspec-rails-2.10.1
  sass-3.1.17
  sass-rails-3.2.5
  simple_form-2.0.2
  squeel-1.0.1
  trinidad_jars-1.0.3
  trinidad-1.3.5
  trinidad_dbpool-0.3.1
  trinidad_init_services-1.1.5
  trinidad_mssql_dbpool_extension-0.3.0
  uglifier-1.2.4
  vlad-2.2.5
  vlad-git-2.2.0

--- Bundler
Bundler.bundle_path: /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8
Bundler.root: /home/fpauser/dev/ruby/webcms/webcms
Gemfile: /home/fpauser/dev/ruby/webcms/webcms/Gemfile
Settings:
  build.freetds = --with-opt-dir=/opt/freetds-0.91
  gemfile = /home/fpauser/dev/ruby/webcms/webcms/Gemfile
  bin_path = /home/fpauser/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/bundler-1.1.3/bin/bundle

--- JRuby-Rack Config
compat_version = RUBY1_9
default_logger = org.jruby.rack.logging.StandardOutLogger@18329bfc
err = java.io.PrintStream@21a722ef
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_memory_buffer_size = 
initial_runtimes = 1
jms_connection_factory = 
jms_jndi_properties = 
logger = org.jruby.rack.logging.ServletContextLogger@7248d0ea
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_memory_buffer_size = 
maximum_runtimes = 1
num_initializer_threads = 
out = java.io.PrintStream@7d487b8b
rackup = 
rackup_path = 
rewindable = true
runtime_arguments = 
runtime_timeout_seconds = 
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade@7f29b00a
2012-05-21 11:57:47 SEVERE: unable to create shared application instance
2012-05-21 11:57:47 SEVERE: Error: application initialization failed
2012-05-21 11:57:47 INFO: Starting ProtocolHandler ["http-bio-3000"]
2012-05-21 11:57:47 INFO: Starting ProtocolHandler ["ajp-bio-8009"]

gem push trinidad_mssql_dbpool_extension

Hey Brian, could you please push the mssql gem built from current master for us (or give me rubygems access to do so) ? It's already tagged just do :

  • git pull origin master
  • rake trinidad_mssql_dbpool_extension:build
  • gem push pkg/trinidad_mssql_dbpool_extension-0.4.1.gem

Thanks, K. // cc @btatnall

Multiple Jar files for driverPath

I am using progress 10.1B and it require to load 3 jar files for jdbc connections. openedge.jar, base.jar, utli.jar. Please allow this on the generic extension.

Rails 4.0.2 + trinidad_postgresql_dbpool_extension error

I am upgrading a rails 3.2 app to rails 4.0.2 with trindad and jdbcpostgresql.

When the first activerecord model gets required and it uses the table_exists? to check for table existence I get the failure: 'Java::JavaLang::ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.postgresql.PGConnection'

This only occurs when using the trinidad_postgresql_dbpool_extension.

Here is a more complete stack trace.

2013-12-09 17:07:06 -0700 INFO: Java::JavaLang::ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.postgresql.PGConnection:         SELECT COUNT(*) as table_count
        FROM pg_tables
        WHERE tablename = ?
        AND schemaname = ANY (current_schemas(false))

2013-12-09 17:07:06 -0700 INFO: An exception happened during JRuby-Rack startup
No such file to load -- java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.postgresql.PGConnection
--- System
jruby 1.7.8 (1.9.3p392) 2013-11-14 0ce429e on OpenJDK 64-Bit Server VM 1.7.0_25-b30 [linux-amd64]
Time: 2013-12-09 17:07:06 -0700
Server: Apache Tomcat/7.0.42
jruby.home: /usr/local/rvm/rubies/jruby-1.7.8

--- Context Init Parameters:
jruby.compat.version = 1.9.3
jruby.initial.runtimes = 1
jruby.max.runtimes = 1
jruby.min.runtimes = 1
jruby.rack.error = false
jruby.rack.layout_class = JRuby::Rack::FileSystemLayout
jruby.rack.logging = JUL
jruby.rack.logging.name = org.apache.catalina.core.ContainerBase.[Tomcat].[0.0.0.0].[default]
jruby.runtime.acquire.timeout = 5.0
public.root = public
rails.env = sandbox
rails.root = /srv/synchronicity/releases/20131210000248

--- Backtrace
LoadError: No such file to load -- java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.postgresql.PGConnection
                                 require at org/jruby/RubyKernel.java:1084
                                 require at /srv/synchronicity/shared/bundle/jruby/1.9/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229
                         load_dependency at /srv/synchronicity/shared/bundle/jruby/1.9/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214
                                 require at /srv/synchronicity/shared/bundle/jruby/1.9/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229
                         require_or_load at /srv/synchronicity/shared/bundle/jruby/1.9/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:330
                               depend_on at /srv/synchronicity/shared/bundle/jruby/1.9/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:289
                      require_dependency at /srv/synchronicity/shared/bundle/jruby/1.9/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:207
                             eager_load! at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/engine.rb:465
                                    each at org/jruby/RubyArray.java:1613
                             eager_load! at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/engine.rb:464
                                    each at org/jruby/RubyArray.java:1613
                             eager_load! at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/engine.rb:462
                             eager_load! at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/engine.rb:347
                                    each at org/jruby/RubyArray.java:1613
                                Finisher at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/application/finisher.rb:56
                           instance_exec at org/jruby/RubyBasicObject.java:1565
                                     run at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/initializable.rb:30
                        run_initializers at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/initializable.rb:55
                              tsort_each at /usr/local/rvm/rubies/jruby-1.7.8/lib/ruby/1.9/tsort.rb:150
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.8/lib/ruby/1.9/tsort.rb:183
  each_strongly_connected_component_from at /usr/local/rvm/rubies/jruby-1.7.8/lib/ruby/1.9/tsort.rb:219
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.8/lib/ruby/1.9/tsort.rb:182
                                    each at org/jruby/RubyArray.java:1613
       each_strongly_connected_component at /usr/local/rvm/rubies/jruby-1.7.8/lib/ruby/1.9/tsort.rb:180
                              tsort_each at /usr/local/rvm/rubies/jruby-1.7.8/lib/ruby/1.9/tsort.rb:148
                        run_initializers at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/initializable.rb:54
                             initialize! at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/application.rb:215
                          method_missing at /srv/synchronicity/shared/bundle/jruby/1.9/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30
                                  (root) at /srv/synchronicity/releases/20131210000248/config/environment.rb:5
                                 require at org/jruby/RubyKernel.java:1084
                                  (root) at file:/srv/synchronicity/shared/bundle/jruby/1.9/gems/jruby-rack-1.1.13.3/lib/jruby-rack-1.1.13.3.jar!/jruby/rack/rails/environment3.rb:1
                        load_environment at file:/srv/synchronicity/shared/bundle/jruby/1.9/gems/jruby-rack-1.1.13.3/lib/jruby-rack-1.1.13.3.jar!/jruby/rack/rails/environment3.rb:25
                        load_environment at file:/srv/synchronicity/shared/bundle/jruby/1.9/gems/jruby-rack-1.1.13.3/lib/jruby-rack-1.1.13.3.jar!/jruby/rack/rails_booter.rb:79

--- RubyGems
Gem.dir: /srv/synchronicity/shared/bundle/jruby/1.9
Gem.path:
/srv/synchronicity/shared/bundle/jruby/1.9
Activated gems:
  rake-10.1.0
  i18n-0.6.9
  minitest-4.7.5
  multi_json-1.8.2
  atomic-1.1.14-java
  thread_safe-0.1.3-java
  tzinfo-0.3.38
  activesupport-4.0.2
  amq-protocol-1.9.0
  eventmachine-1.0.3-java
  amqp-1.1.3
  timers-1.1.0
  celluloid-0.15.2
  action_subscriber-0.1.10
  builder-3.1.4
  erubis-2.7.0
  rack-1.5.2
  rack-test-0.6.2
  actionpack-4.0.2
  mime-types-1.25.1
  polyglot-0.3.3
  treetop-1.4.15
  mail-2.5.4
  actionmailer-4.0.2
  activemodel-4.0.2
  active_attr-0.8.2
  thor-0.18.1
  protobuf-2.8.8
  active_remote-1.6.1
  will_paginate-3.0.5
  active_remote_pagination-0.3.2
  activerecord-deprecated_finders-1.0.3
  arel-4.0.1
  activerecord-4.0.2
  activerecord-jdbc-adapter-1.3.3
  jdbc-postgres-9.3.1100
  activerecord-jdbcpostgresql-adapter-1.3.3
  ffi-1.9.3-java
  ffi-rzmq-1.0.3
  guid-0.1.1
  atlas-1.6.5
  babou-0.2.2
  bundler-1.3.5
  heredity-0.1.1
  ignorable-0.2.0
  lumberjack-1.0.4
  lumberjack_syslog_device-1.0.0
  highline-1.6.20
  fattr-2.2.1
  options-2.3.0
  progress_bar-1.0.0
  safe_yaml-0.9.7
  json-1.8.1-java
  squash_ruby-1.2.2
  squash_rails-1.2.0
  sucker_punch-1.0.2
  buttress-2.1.12
  coderay-1.1.0
  connection_pool-1.1.0
  dotenv-0.9.0
  rufus-scheduler-3.0.2
  firebolt-0.12.0
  foreman-0.63.0-java
  hike-1.2.3
  jruby-rack-1.1.13.3
  urlcrypt-0.1.0
  warden-1.2.3
  lockout-2.2.5
  method_source-0.8.2
  minimus-0.2.1
  protected_attributes-1.0.5
  slop-3.4.7
  spoon-0.0.4
  pry-0.9.12.3-java
  pry-nav-0.2.3
  rack-strong_routes-0.0.7
  railties-4.0.2
  tilt-1.4.1
  sprockets-2.10.1
  sprockets-rails-2.0.1
  rails-4.0.2
  redis-3.0.6
  redis-store-1.1.4
  redis-rack-1.5.0
  redis-actionpack-4.0.0
  redis-activesupport-4.0.0
  redis-namespace-1.3.2
  redis-rails-4.0.0
  sidekiq-2.16.1
  trinidad_jars-1.2.5
  trinidad-1.4.5
  trinidad_dbpool-0.5.0
  trinidad_postgresql_dbpool_extension-0.5.0

Is this a known issue with Rails 4? I'm happy to come up with a minimal reproducible if this is unknown territory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.