Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Deploying Static Content on JBoss Server

DZone's Guide to

Deploying Static Content on JBoss Server

Learn how to deploy static content on a JBoss server.

· DevOps Zone
Free Resource

The DevOps Zone is brought to you in partnership with Sonatype Nexus. The Nexus Suite helps scale your DevOps delivery with continuous component intelligence integrated into development tools, including Eclipse, IntelliJ, Jenkins, Bamboo, SonarQube and more. Schedule a demo today

Recently, I had a question from a commenter on my blog post on installing ELK stack on Ubuntu/Debian. The question was how to serve kibana 3 via a server like jboss. Kibana 3 is essentially (more or less) static content. It serves html and content changes based on it's querying elasticsearch via javascript. I couldn't find any blog with all the instructions in one page for serving static content via Jboss. So here it is:

These instructions are for JBoss Application Server 7:

Install JBoss

If you already have JBoss installed then you can skip this step.

Download and extract JBoss:

cd /tmp  
wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.tar.gz
tar -xvf jboss-as-7.1.1.Final.tar.gz

Move extracted JBoss to /usr/local/share


mv /tmp/jboss-as-7.1.1.Final /usr/local/share/jboss-7.1.1  
Deploying static content to JBoss:


  • Create a directory called yourwebapp.war inside/usr/local/share/jboss/standalone/deployments
  • Create a file name yourwebapp.war.dodeploy in/usr/local/share/jboss/standalone/deployments
  • Create a directory WEB-INF inside yourwebapp.war
  • Create a file web.xml with contents shown below
<?xml version="1.0" encoding="ISO-8859-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
</web-app>
  • Start JBoss
  • Browse to your server's ipaddress:8080/yourwebapp
An example of deploying static content to JBoss:

I am demonstrating static content deployment to JBoss with kibana 3 content.

cd /usr/local/share/jboss-7.1.1/standalone/deployments/  
sudo mkdir -p kibana.war/WEB-INF  
sudo cp -r /tmp/kibana-3.1.2/* kibana.war  
sudo touch kibana.war.dodeploy  

Create web.xml with contents shown below: vi kibana.war/WEB-INF/web.xml


<?xml version="1.0" encoding="ISO-8859-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"  
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
</web-app>  

Start JBoss:


cd /usr/local/share/jboss  
./bin/standalone.sh -Djboss.bind.address=192.168.1.8 -Djboss.bind.address.management=192.168.1.8

Browse to: http://192.168.1.8:8080/kibana

Please replace 192.168.1.8 with your server's ip address



The DevOps Zone is brought to you in partnership with Sonatype Nexus. Use the Nexus Suite to automate your software supply chain and ensure you're using the highest quality open source components at every step of the development lifecycle. Get Nexus today

Topics:
devops ,enterprise-integration ,jboss ,kibana ,elk stack

Published at DZone with permission of Ravi Hasija, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}