3 Simple Methods to Deploy to JBoss

You’ve just built a beautiful application.

You tested your code. And you’re sure it’ll work…on the first try.

All you need to do is deploy your application to your server.

It’s the easy part…right?

But now you’re staring at a screen full of server errors.

And you start to wonder..

It’s hard to tell if there’s a problem in your code or if the deployment process went wrong. So, here are..

What You’ll Need

  1. JBoss Developer Studio w/ JBoss EAP 6.4+ Download here
  2. JBoss Maven Repositories (Section 1: Steps 4-7)
  3. This sample project (or use your own)

Before You Start..

  1. Build your project
    • Right click your project -> Run As -> Maven Build… -> Goals: clean install -> Continue
  2. Find your server directory
    • Navigate to the Servers tab in JBoss Dev Studio and double click on your server
    • Click Runtime Environment. Your server directory will be under Home Directory. We call this $JBOSS_HOME
    • For me, $JBOSS_HOME is /Volumes/tioluMAC/jboss-eap-6.4/
  3. Note that methods 1 & 2 only work for standalone mode

METHOD 1 (Recommended): Deploy by copy

  1. Start your server
    • In a terminal, run $JBOSS_HOME/bin/standalone.sh
  2. Copy the artifact to your deployment folder
    • In your project target folder, find the .war file
    • Copy this file to $JBOSS_HOME/standalone/deployments folder
    • Remove any .failed file in that directory
  3. Verify the deployment
    • Check the logs
    • Go here

METHOD 2 (Easiest): Deploy from JBoss Developer Studio

  1. Right click your project -> Run as -> Run on Server -> Finish
  2. Check your console
  3. Go here

Sometimes this method fails because Eclipse didn’t add your dependencies to the deployment. If this happens..

  1. Right click your project -> Select properties
  2. Click on Deployment Assembly
  3. Click Add -> Java Build Path Entries -> Maven dependencies

METHOD 3 (Domain Mode): Deploy from Web Console

  1. Add a management user (if you don’t have one)
    • In a terminal, run
      $JBOSS_HOME/add-user.sh -m -u 'jboss' -p 'jbosspass1!'
  2. Start your server in domain mode
    • $JBOSS_HOME/bin/domain.sh
  3. Go to http://localhost:9990 and login with the user above
  4. Click Deployments -> Add -> Choose file
  5. Click Assign -> select a server group
  6. Check the logs
  7. Go here

Now you can be comforted to know that any problems are from your code — not the deployment method 😉

But seriously, I hope this saves you some headache.

Happy Coding,

-T.O.

 

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑