Skip to content

Deploying with WebLogic

kares edited this page Nov 2, 2012 · 4 revisions

Oracle WebLogic Server 11g (and possibly other newer as well as older versions) require a bit of tuning to deploy JRuby-Rack applications.

We'll set the required configuration in WebLogic's proprietary deployment descriptor weblogic.xml :

<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
  </container-descriptor>
</weblogic-web-app>

If you're using Warbler to package up your application into a .war create config/weblogic.xml and copy the above content into it. Than update config/warble.rb to include this file into the archive's WEB-INF directory :

Warbler::Config.new do |config|
  # ...

  # Files for WEB-INF directory (next to web.xml). This contains
  # web.xml by default. If there is an .erb-File it will be processed
  # with webxml-config. You may want to exclude this file via
  # config.excludes.
  config.webinf_files += FileList["config/weblogic.xml"]

  # ...
end

Explanation

  • prefer-web-inf-classes makes sure your application java classes (e.g. packaged in .jar files) are preferred over the server classes. This avoids class collisions e.g. if JRuby uses the same library as the container but with a different version (they both use JodaTime - without this your deployment might end up with exceptions such as a "missing withYear method on org.joda.time.DateTime").

  • show-archived-real-path-enabled enables the use of ServletContext.getRealPath method to map packaged files into FS paths, this is not strictly required as JRuby-Rack has some workarounds but should not hurt.

Clone this wiki locally