Deploying PlayFramework Apps in JBoss

After you created your web application you need to create the WAR file that will insert the framework and other dependent libs inside the folder that you specify:

play war myapp -o myapp.war

Now to deploy on JBoss, you need to do some changes on your WAR file:

  • Create a file called jboss-web.xml in the myapp.war/WEB-INF/ directory container the following:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">



com.example:archive=myapp.war
java2ParentDelegation=false



  • Download hibernate-validator and hibernate annotation using the compatibility matrix (Hibernate Compatibility Matrix). Play is using hibernate core 3.3.2 GA. Once you are done, place the relevant jars in the myapp.war/WEB-INF/lib directory. You should end up with:
    • hibernate-annotations.jar
    • hibernate-entitymanager.jar
    • hibernate-validator.jar
    • hibernate-commons-annotations.jar
    • hibernate-search-3.1.1.GA.jar
    • hibernate3.jar (Do not overwrite this library, as Play! has a modified version of it)
  • Now that we’re prepared for WAR, you need to move your application to the deployment folder of JBoss. The default folder for it is: jboss_home/server/default/deploy (jboss_home == folder of jboss). There are some things you need to be aware of:

    1. Use a superior java version in JBoss to avoid class version errors
    2. Verify that the WAR folder has the necessary permissions. In my case I needed to make a “chown -R jboss myapp.war” where jboss is the user that controls the jboss application server
    3. Do a “tail -f jboss_home/server/default/log/server.log” to see if your application is being deployed. You’ve an Administration Console in http://yourserverip:8080
    4. Don’t change your routes file at runtime. Stop the war, change routes and then start the war (in the administration console I said before)
  • Now you should have your application working. You can access to your app at: http://yourserverip:8080/myapp.war
  • This tutorial was tested in JBoss 5.0.1

Thanks to Nicolas Leroux from lunatech.com for helping me to create this tutorial.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • LinkedIn
  • MySpace
  • Twitter
This entry was posted in Internet, play, Software Development and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>