3 Simple Methods to Deploy to JBoss
Here are 3 simple methods to deploy any application to JBoss
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
- JBoss Developer Studio w/ JBoss EAP 6.4+ Download here
- JBoss Maven Repositories (Section 1: Steps 4-7)
- This sample project (or use your own)
Before You Start..
Step 1: Build your project
- Right click your project -> Run As -> Maven Build... -> Goals: clean install -> Continue
Step 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/
Step 3: Note that methods 1 & 2 only work for standalone mode
METHOD 1 (Recommended): Deploy by copy
Step 1: Start your server
- In a terminal, run $JBOSS_HOME/bin/standalone.sh
Step 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
Step 3: Verify the deployment
- Check the logs
- If you used our sample project, go here
METHOD 2 (Easiest): Deploy from JBoss Developer Studio
Step 1: Right click your project -> Run as -> Run on Server -> Finish
Step 2: Check your console
Step 3: Go here
Sometimes this method fails because Eclipse didn’t add your dependencies to the deployment. If this happens..
Step 1: Right click your project -> Select properties
Step 2: Click on Deployment Assembly
Step 3: Click Add -> Java Build Path Entries -> Maven dependencies
METHOD 3 (Domain Mode): Deploy from Web Console
Step 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!'
Step 2: Start your server in domain mode
- $JBOSS_HOME/bin/domain.sh
Step 3: Go to http://localhost:9990 and login with the user above
Step 4: Click Deployments -> Add -> Choose file
Step 5: Click Assign -> select a server group
Step 6: Check the logs
Step 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.