Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:41:36+00:00 2026-05-28T05:41:36+00:00

When deploying a Rails 3.1 app on JRuby to JBoss, I’m having a jndi/jdbc

  • 0

When deploying a Rails 3.1 app on JRuby to JBoss, I’m having a jndi/jdbc connection issue. The data source exists and connects fine

17:47:20,862 ERROR [STDERR] JNDI data source unavailable: javax.naming.NameNotFoundException: jdbc not bound; trying straight JDBC
17:47:20,926 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/MyApp]] unable to create shared application instance
org.jruby.rack.RackInitializationException: jdbc adapter requires driver class and url
    from C:/opt/jboss/jboss-4.2.2.GA-Virgin/server/default/tmp/deploy/tmp1619261931370223075MyApp-exp.war/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/jdbc/connection.rb:21:in `configure_connection'
    from C:/opt/jboss/jboss-4.2.2.GA-Virgin/server/default/tmp/deploy/tmp1619261931370223075MyApp-exp.war/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/jdbc/connection.rb:84:in `initialize'
    from C:/opt/jboss/jboss-4.2.2.GA-Virgin/server/default/tmp/deploy/tmp1619261931370223075MyApp-exp.war/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/jdbc/adapter.rb:32:in `initialize'
    from C:/opt/jboss/jboss-4.2.2.GA-Virgin/server/default/tmp/deploy/tmp1619261931370223075MyApp-exp.war/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.2.0/lib/arjdbc/jdbc/connection_methods.rb:6:in `jdbc_connection'
    from org/jruby/RubyKernel.java:2097:in `send'

…

Caused by: org.jruby.exceptions.RaiseException: (ConnectionNotEstablished) jdbc adapter requires driver class and url
17:47:23,010 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/MyApp]] Error: application initialization failed
org.jruby.rack.RackInitializationException: unable to create shared application instance
    at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:39)
    at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)

Database.yml

###############################################################
#################### PRODUCTION DATA ##########################
###############################################################

production:
  adapter: jdbc
  jndi: java:jdbc/my_datasource
  driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

I’ve checked both the datasource and the Database.yml file but I have no clue why Rails is not finding the datasource.

Update

Warbler config

# Disable Rake-environment-task framework detection by uncommenting/setting to false
# Warbler.framework_detection = false
# 
puts 'Compiling the asset manifests & other files in the pipeline to the disk'
system('bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile')

# Warbler web application assembly configuration file
Warbler::Config.new do |config|

  # Application directories to be included in the webapp.
  config.dirs = %w(app config lib log vendor tmp)

  # Name of the archive (without the extension). Defaults to the basename
  # of the project directory.
  config.jar_name = "MyApp"

  # Control the pool of Rails runtimes. Leaving unspecified means
  # the pool will grow as needed to service requests. It is recommended
  # that you fix these values when running a production server!
  config.webxml.jruby.min.runtimes = 1
  config.webxml.jruby.max.runtimes = 1

  # JNDI data source name
  # config.webxml.jndi = 'jdbc/rails'
end

Datasource config

<datasources>    
 <xa-datasource>
    <jndi-name>jdbc/my_datasource</jndi-name>
    <track-connection-by-tx/>
    <isSameRM-override-value>false</isSameRM-override-value>
    <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
    <xa-datasource-property name="ServerName">myserver</xa-datasource-property>
    <xa-datasource-property name="DatabaseName">mydb</xa-datasource-property>
    <xa-datasource-property name="SelectMethod">cursor</xa-datasource-property>
    <valid-connection-sql>SELECT 1</valid-connection-sql>
    <user-name>user</user-name>
    <password>pwd</password>
      <metadata>
         <type-mapping>MS SQLSERVER2000</type-mapping>
      </metadata>
  </xa-datasource>   
</datasources>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:41:36+00:00Added an answer on May 28, 2026 at 5:41 am

    The following works for me when deploying a .war file warbled up for Rails 3.0.x / JBoss 5.1.0GA.

    Assuming that you have successfully deployed your datasource with an XML configuration file that would look like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
        <local-tx-datasource>
            <jndi-name>my_datasource</jndi-name>
            <connection-url>MYDATASOURCE_URL</connection-url>
            <driver-class>your.Driver</driver-class>
            ... define any other connection properties here ...
        </local-tx-datasource>
    </datasources>
    

    You should confirm that your datasource is indeed up and running in your JBoss admin console.

    Then, assuming you have the following in your config/warble.rb file:

    # JNDI data source name
    config.webxml.jndi = 'jdbc/my_datasource'
    
    # JBoss web-xmle file
    config.includes = 'jboss-web.xml'
    

    … and further assuming that you have a jboss-web.xml configuration file in directly under your Rails project folder, with the following:

    <jboss-web>  
        <resource-ref>  
            <res-ref-name>jdbc/my_datasource</res-ref-name>
            <jndi-name>java:/my_datasource</jndi-name>
            <res-type>javax.sql.DataSource</res-type>  
        </resource-ref>  
    </jboss-web>
    

    … then you should be OK, afaik.

    Could you perhaps post your warble.rb, datasource XML configuration file, and any JBoss web configuration parameters you are setting?

    [EDIT]
    @Jared thanks for posting your configuration files. Off the top of my head, I can offer you the following bits of advice:

    1. Correct the jndi value in your database.yml to java:comp/env/jdbc/my_datasource.
    2. Define a config.webxml.jndi configuration in your warble.rb, and set it to jdbc/my_datasource.
    3. Also, define a reference to a new JBoss web.xml file in your warble.rb with config.includes = jboss-web.xml.
    4. Create this new jboss-web.xml to map the JNDI name to the JBoss resource reference name. Based on the files you have shared, that would be something along the lines of what I have shown above. You would create this file right under the root of your Rails project.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As usual, I'm having strange issues with deploying a Rails app to our different
I'm deploying a JRuby/Rails app packed up into abc.war, and it is deployed with
I am having problems deploying a Rails app to Heroku, I can't even run
I'm having a problem deploying my Rails app to Heroku, where this error is
I'm having an interesting issue when deploying an app to Tomcat. I'm using the
I am having trouble with deploying rails 3.1. app to heroku. After some research,
Somewhere I did something silly. I was deploying my Rails app via cloning the
I'm deploying a Rails app on Heroku (for now) via git, and would also
How can I go about deploying a Rails app on a cluster of Amazon
This one has got me stumped. I'm deploying a Rails 3 app to Slicehost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.