- 浏览: 688647 次
- 性别:
- 来自: 中山
-
文章分类
最新评论
-
wuhuizhong:
jFinal支持Rest风格吗?可以想spring mvc那样 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
在jfinal中应如何获取前端ajax提交的Json数据?ht ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
jfinal如何处理json请求的数据:问题: 在某些api接 ...
在JFinal的Controller中接收json数据 -
wuhuizhong:
Ubuntu14.04 安装 Oracle 11g R2 Ex ...
Oracle 11g release 2 XE on Ubuntu 14.04 -
alanljj:
这个很实用,已成功更新,谢过了!
odoo薪酬管理模块l10n_cn_hr_payroll
I’m currently preparing the deployment of our RoR application (a kind of portal for our enterprise) in Oracle App Server 10g.
Our application is currently deployed under Litespeed Web Server, running with Ruby MRI: we encounter some problems of performances with Database connections and we also have some bunch of Ruby code that are a port of Java Libraries from Oracle. We also need to have a better integration with the Oracle Single Sign On Server, and with the Oracle Content Db.
By using the JRuby environment , we’ll be able to reuse original Oracle Java libraires from our application. We’ll check also performances and memory load before using it in production.
Before moving to the App Server 10g, i need to test it before in an OC4J standalone 10.1.3 (same release of the J2EE container), with JDK 5 , 32 bits (as our Java setup on the Linux server).
For this i started from Oracle AppLabs Wiki article
Prerequisities :
- Linux ( i currently use a Fedora Core 7 on my development desktop, and our Server is setup with a Suse 9)
- JDK 5
- JRuby 1.1
- Rails 1.2.5 / 2.1 (we currently have our RoR application written for Rails 1.2.5 - we plan later to upgrade to Rails 2.1 by reviewing the code for deprecations)
- activerecord-jdbc-adapter 0.8.0
- Oracle JDBC Driver (depending on your database release; if 10g use ojdbc14.jar , if 11g use ojdbc5.jar )
- Warbler
- Oracle Database 10g XE / Oracle Database 10g EE or SE / Oracle Database 11g
- Oracle Containers for J2EE (OC4J) 10gR3
First download Jdk 5 for your platform and JRuby 1.1
Set Environment variables : JAVA_HOME, JRUBY_HOME
Add $JAVA_HOME/bin and $JRUBY_HOME/bin in the $PATH
Set env. CLASSPATH with $JRUBY_HOME/lib and $JAVA_HOME/lib
Install Rails 1.2.5 :
sudo jruby -S gem install rails –version=1.2.5
Install Rails 2.1 :
sudo jruby -S gem install rails –version=2.1
Install activerecord-jdbc-adapter :
sudo jruby -S gem install activerecord-jdbc-adapter
Download the Oracle JDBC Driver (ojdbc14.jar for JDK 5 and Database 10g, or ojdbc5.jar for JDK 5 and Database 11g, or even ojdbc6.jar if JDK 6 is used with Oracle Database 11g)
Copy the JAR in your $JRUBY_HOME/lib
Note: “JRuby leverages JDBC to access various JDBC compliant database systems and Ruby-OCI8 can’t work with JRuby because “Many Gems will work fine in JRuby however some Gems build native C libraries as part of their install process. These Gems will not work in JRuby unless the Gem has also provided a Java equivalent to the native library.” as stated in the JRuby Wiki . The latest ActiveRecord JDBC Adapter (v0.8.0) only works with JRuby 1.1RC3 or future version.”
Run a Rails application
To generate your application from scratch, launch the command :
jruby -S rails <app_name>
In my case, i just want to see if one of our applications we developed recently could run easily .
For this i do a checkout against our SVN repository : i get the source code in my Working copy. The application has been done for Rails 1.2.5. It’s an application mimicking the http://www.yousendit.com web application .
First i changed the line in config/environment.rb
RAILS_GEM_VERSION = ‘2.1.0′ unless defined? RAILS_GEM_VERSION
Add the following lines after “Rails::Initializer.run do |config|” :
config.action_controller.session = {
:session_key => ‘_sharails_session’,
:secret => ‘643c1821df270a8662a2e011836996053a3241eea164d81e18a9314c0a39ea68f6c20027e3c4d41309469
38acc6e164912fa3331747c8b5f0c2f0de6adbb7332′
}
Modify config/database.yml :
I should configure my connection as is in the database.yml file :
common: &shared
adapter: jdbc
driver: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@<hostname>:<port>:<sid>
username: railsuser
password: railspasswd
development:
<<: *shared
production:
development
Then launch the rake db:migrate :
jruby -S rake db:migrate
Nota : In Rails 1.2, the jdbc adapter gem is not required by default by ActiveRecord. We need to add “jdbc” into $JRUBY_HOME/lib/ruby/gems/1.8/gems/activerecord-x.y.z/lib/active_record.rb as below:
unless defined?(RAILS_CONNECTION_ADAPTERS)
RAILS_CONNECTION_ADAPTERS = %w( mysql postgresql sqlite firebird sqlserver db2 oracle sybase openbase frontbase jdbc )
end
First test with WebRick :
Launch the command :
jruby script/server
Then open the URL http://localhost:3000/sharails in your browser
I encounter several problems before to make it run in JRuby environment :
- Dates :
In our web form, we currently use a Javascript popup calendar, formatting dates in french format : dd/mm/yyyy (in Ruby , it would be %d/%m/%Y)
I should add an explicit data conversion in my action before saving (date_validite being a :date in migration script and DATE type in Oracle database) :
@document.validite_fin = Date.strptime(params[:document][:validite_fin] , ‘%d/%m/%Y’)
I also encountered problems when comparing @document.validite_fin with Date.today with minus operator - i should do the comparison between @document.validite_fin and Time.now
- msmtp :
I found the JRuby 1858 BugID in JIRA relating problems with IO.popen.
I should modify my config/environment.rb : (removed the complete path /usr/bin/msmtp)
IO.popen(”/usr/bin/msmtp …. replaced by IO.popen(”msmtp ….
I should modify my msmtp config file located in /etc/.msmtprc
“account gmail” replaced by “account default”
account default
host smtp.gmail.com
port 587
auth on
user <account>@gmail.com
password <pwd>
tls on
tls_starttls on
tls_trust_file /path/to/.certs/ThawtePremiumServerCA.crt
from <account>@gmail.com
logfile /path/to/msmtp.log
Finally , as tested with Rails 2.1 (and initially developed with Rails 1.2.5) , we previously used “render_without_layout” function, that is now deprecated . I should replace it by “render :layout => false”
Package the application with Warbler :
A recommended option is to use Warbler for packaging which provides a minimal, flexible and Ruby-like way to create WAR. Warbler really cleans up the packaging of WAR, for example excluding .svn directories, tests and migrations - really nice. For now, it uses RailsServlet for dispatching but even that is pluggable.
Install Warbler :
jruby -S gem install warbler
Generate the warbler configuration file :
jruby -S warble config
Edit config/warble.rb and add “activerecord-jdbc-adapter” , as Warbler doesn’t package automatically activerecord JDBC driver.
config.gems = ["activerecord-jdbc-adapter"]
# config.gems << “tzinfo”
config.gems["rails"] = “2.1.0″
Create the war file :
jruby -S warble
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
jar cf sharails.war -C tmp/war .
Deploy on OC4J standalone
OC4J stands for “Oracle Containers for J2EE”. OC4J standalone is the Oracle AS Containers for J2EE distribution which can be executed outside of the standard OracleAS environment. It is very easy to install(simply unzip it). Typically OC4J standalone would be used for development purposes and for small scale web solutions. OC4J 10g Standalone ships with Oracle JDBC driver for Java 1.4, so deploying JRuby on Rails application on it is made much easier:
Start OC4J :
cd $OC4J_ROOT/j2ee/home ; java -jar oc4j.jar
Then deploy your application :
- via the web console : http://localhost:8888/em
- by the command line :
a) For OC4J Standalone
java -jar $OC4J_ROOT/j2ee/home/admin_client.jar deployer:oc4j:localhost:23791 oc4jadmin -deploy \ -file /path/to/sharails.war -deploymentName sharails -bindAllWebApps
Go to the following URL http://localhost:8888/sharails
b) For Oracle App Server 10g :
java -jar $ORACLE_HOME/j2ee/home/admin_client.jar deployer:oc4j:opmn://<hostname>:opmnPort/oc4jInstanceName \ oc4jadmin <password> -deploy -file /path/<app_name>.war -deploymentName < app_name > -bindAllWebApps \ -contextRoot / <contextRoot>
Go to the following URL http://hostname:7777/<contextRoot>
We got just some problems in some URLs that actually don’t include the
web application context (sharails): it is the case for our download
file URL, or some pictures set as background in our CSS files.
But everything works fine.
Other deployments available on JRuby Wiki
发表评论
-
使用Torquebox在Windows下面进行Rails的部署
2013-12-16 07:16 1100一、安装Torquebox 参考:http://torqu ... -
ruby匹配中文的正则表达
2013-07-16 21:12 1923ruby1.9: /\p{Word}+/u 不限于 a ... -
Ruby On Rails, Thin and Nginx on Windows
2012-01-08 07:23 1832安装thin: gem install eventmachi ... -
搭建rubygem repository server
2011-11-14 13:06 1029做rails开发通常需要gem i ... -
在 Heroku 安裝 Redmine (1.1-stable)
2011-11-13 09:59 1073Redmine 是一套好用的軟 ... -
Rails之记录用户操作数据库信息
2011-11-10 02:50 1185db/migrate/002_add_audit_trails ... -
Rails3部署到heroku
2011-11-10 02:47 705gem install heroku rails new m ... -
Rails Cache
2011-11-10 02:20 694Rails Cache http://www.slid ... -
How do I use ActiveSupport core extensions?
2011-11-07 17:04 491When I try to use 1.week.ago ... -
Redhat安裝 nokogiri 時要求升級 libxml2
2011-11-07 16:58 2268安裝 nokogiri 時出現以下錯誤信息: Install ... -
Compass Agile Enterprise Framework
2011-11-07 06:37 728设置: 1.Gemfile gem 'erp_agreem ... -
Linux下Rails 3.1安装sqlite3
2011-10-25 08:29 1154服务器系统是Red Hat 4.1.2-48。默认已安装sql ... -
Ubuntu Server 64bits 如何安装 ruby-oci8
2011-10-23 06:56 3035安装 Linux软件包 : sudo apt- ... -
将gem包打成jar包
2011-10-16 11:45 830http://www.intellij.org.cn/blog ... -
升級到 Rails 3.1,專案所要做的前置準備工作
2011-10-14 14:28 646http://wp.xdite.net/?p=3137 ... -
Ruby 调用Shell脚本
2011-10-13 15:13 2904// 第一种 用反引号将shell命令引起来,如果是sh ... -
Ruby通过SOAP调用webservice发送短信
2011-10-06 11:27 1615url = 'http://lxt.esms360.co ... -
Sending delayed email from devise
2011-09-27 14:39 659Alternatively, instead of using ... -
让邮件发送也变得有序
2011-09-27 14:10 600邮件发送应该是一个网站中不可或缺的功能,但如果同时触发了大量的 ... -
rails 3 中 生成pdf 2: email pdf 附件
2011-09-27 13:31 995ActionMailer in Rails 3 http:/ ...
相关推荐
4. **前沿技术**:本书覆盖了当时最新的jRuby版本和Rails框架特性,让读者了解并掌握最前沿的开发技术。 ### 结语 《jRuby on Rails WEB2.0》不仅是对于希望将Ruby on Rails技术引入Java平台的开发者来说是一本...
RoR(Ruby on Rails)是一种流行的开源Web开发框架,以其高效和简洁的代码著称。然而,随着网站规模的增长,性能优化成为必不可少的环节。在本文中,我们将探讨一些RoR性能优化的关键方面,主要基于JavaEye网站在...
NULL 博文链接:https://xuxiangpan888.iteye.com/blog/266696
神级ROR教程第四版:最新版 传说中学Ruby只要两本书,一本是ProgrammingRuby(在我的资源列表里也有),另一本就是Agile.Web.Development.with.Rails,即该本书。 Rails just keeps on changing. Rails 3 and Ruby ...
**Ruby on Rails(简称RoR)中文资料** Ruby on Rails(RoR)是一个基于Ruby编程语言的开源Web应用框架,遵循MVC(Model-View-Controller)架构模式,旨在简化Web开发过程,提高开发效率。RoR强调“约定优于配置”...
**神经网络Ror ResNet模型详解** 在深度学习领域,ResNet(残差网络)模型是具有里程碑意义的创新,由He et al.在2015年提出。该模型解决了深度神经网络训练中的梯度消失问题,允许构建非常深的网络结构。而“Ror”...
要让Eclipse支持ROR,你需要安装Eclipse的ROR插件,如"Rails IDE"或"Ruby and Rails Development Tools (RDT)"。这些插件可以通过Eclipse Marketplace来查找并安装。 安装插件后,需要配置Eclipse以识别你的ROR项目...
The title "Flex on Rails" suggests an in-depth exploration of integrating Adobe Flex with Ruby on Rails (RoR), focusing specifically on Flex 3 and Rails 2. This integration allows for the creation of ...
**四、ROR的实例应用** 许多知名网站如GitHub、Airbnb、Shopify等都基于Ruby on Rails构建,证明了其在高性能和可扩展性方面的优秀表现。 总结来说,Ruby on Rails提供了一种高效且优雅的Web开发方式,通过强大的...
Ruby on Rails(RoR)是一种基于Ruby语言的开源Web应用程序框架,它遵循MVC(Model-View-Controller)架构模式,旨在简化Web开发过程。在这个选题方向中,我们主要探讨的是与RoR相关的源代码分析和学习。源代码是...
Ruby on Rails(简称RoR或Rails)是一种基于Ruby语言的开源Web应用框架,它遵循Model-View-Controller(MVC)架构模式,旨在提高开发效率并提供简洁、优雅的代码结构。"ror实例"可能指的是在学习或实践中,通过创建...
在Ruby on Rails(ROR)开发环境中,安装和配置正确的依赖包是至关重要的。这个压缩包包含了一系列用于ROR框架的基础组件,但不包括Ruby本身。让我们深入了解一下这些包的作用和重要性。 首先,`actionpack`是Rails...
基于RoR的博客系统,代码风格简单清晰,前后太完善,适合初学者。
ROR环境 Ruby version 1.9.3 (java) RubyGems version 1.8.24 Rack version 1.4 Rails version 3.2.12 JavaScript Runtime therubyrhino (Rhino) Active Record version 3.2.12 Action Pack version 3.2.12 ...
这本书主要讲了一个完整Web应用的各种基础构建技术,似乎重点放在概念理解层面,代码开发的东西在后面几章,比如RoR2.0与JEE的对比,对于现在很多初步涉入做Web应用产品的同学推荐看一看这本书,也许乍看基础东西不...
Apress Pro ActiveRecord Databases with Ruby and Rails <br>Active Record has primarily been covered as a subsection, or maybe as a chapter or two, within a larger scoped book generally about the ...
### Windows上搭建Ruby on Rails(ROR)环境详解 #### 一、引言 随着Web开发技术的不断发展,Ruby on Rails(简称Rails或ROR)作为一种高效、简洁且优雅的Web开发框架,受到了广大开发者的青睐。然而,在Windows...
### ROR 文件的上传与下载:深入解析与实践 在Ruby on Rails(简称ROR)框架下,处理文件的上传与下载是一项常见的需求,尤其是在构建包含媒体内容的应用程序时。本文将基于给定的文件信息,详细阐述如何在Rails...