User Guide - JBoss deployment in Standalone mode (without Apache)
- 17/08/2009 8:24 AM
Applicable Plans: Standard Max VPS, All Advanced VPS, All Premier VPS (not for Plesk or cPanel)
User Guide – JBoss deployment in Standalone mode (without Apache)
JBoss Application Server is a full featured, royalty free, Open Source, Sun certified J2EE application server. For more information on the providers of this software, please visit http://www.jboss.org. The JBoss server package that is available to you in your eApps VPS service includes the embedded Tomcat application server, which is used to serve JSP pages and Java servlets. For more information on this open source, royalty free software please see The Apache Software Foundation's web site at http://jakarta.apache.org/tomcat/index.htmlThe eApps Hosting service is designed to make it easy to use JBoss for serving J2EE applications in your Virtual Private Server (VPS). This User Guide is not intended as a reference source for JBoss. See the Links to other information at the end of this document if you need detailed information about JBoss.
The purpose of this User Guide is to explain how to configure JBoss in your VPS on the eApps Hosting service using JBoss in Standalone Mode, without Apache. Instructions on how to deploy JBoss applications using mod_jk and mod_proxy_ajp are found here
The information in this User Guide is based on the assumption that you have already read the JBoss User Guide – Installation and Tuning, and have met all the Prerequisites. If you have not read that User Guide, please do so now. Reading and following that User Guide is the key to success with the information in this User Guide.
Information covered the the Installation and Tuning User Guide, such as how to deploy your applications to the VPS and how to configure JBoss are not covered in this User Guide.
If you follow the guidelines explained in this User Guide you will remain safely inside the eApps Support envelope. If you choose to use a custom configuration that is outside of the guidelines contained in this document, you may be subject to service fees if you need assistance from the eApps Support department.
JBoss is not available in the Standard and Standard Plus plans due to memory requirements. The Standard Max plan does have enough memory to run JBoss and serves as our entry level plan for JBoss users. However, it is important that you select a plan that has enough memory for your application during peak usage.
If you do not need the advanced features of JBoss, and just need support for JSP and Servlets, we recommend that you uninstall JBoss and install Tomcat instead, as Tomcat uses less resources and is not as complex as JBoss to configure and use.
JBoss is a very complex and powerful application that is intended for advanced users. Before deploying your applications with JBoss, make sure that you really need all the complexity that JBoss provides.
JBoss standalone (without Apache)
Some important information about using JBoss in standalone mode
How to set up JBoss to run in standalone mode
How to set up JBoss to run in standalone mode
Examples using JBoss in stand alone mode
Deployment with JBoss serving JSP and Servlets using a WAR file at example.com/mywebapp
Deployment with JBoss serving JSP and Servlets using a WAR file at example.com
Deployment with JBoss serving JSP and Servlets using an EAR file at example.com/mywebapp
Deployment with JBoss serving JSP and Servlets using an EAR file at example.com
Deployment with JBoss serving JSP and Servlets using a WAR file at example.com
Deployment with JBoss serving JSP and Servlets using an EAR file at example.com/mywebapp
Deployment with JBoss serving JSP and Servlets using an EAR file at example.com
Links to other information
JBoss standalone (without Apache)
JBoss includes its own web server, so Apache is not technically needed. It is possible to run JBoss without Apache.In this User Guide, remember to substitute JBossX or jbossX with your version of JBoss, and example.com with your actual domain name.
Due to the complexity of JBoss, it is impossible to give exact instructions for some of these examples, especially in the case of the jboss-web.xml and application.xml files! Keep in mind that these are only examples; you will need to work with your JBoss developer or consult the official JBoss documentation to determine the exact settings for some of these files.
Some important information about using JBoss in standalone mode
The only time this approach is useful is when you are running a commercial or open-source application and the developers of that application have specifically recommended this approach. In other words, the application was purpose built from the ground up to run using JBoss in stand alone mode, without Apache.This approach is best suited when the VPS is only going to be used to run this application, and nothing else. This is because any of the applications that rely on Apache and PHP, such as any of the web mail applications, or Awstats, or phpMyAdmin, etc, will not be available.
Generally this approach is for users who are very familiar with JBoss and Linux server configuration. Most users will see no benefit by using this approach.
How to set up JBoss to run in standalone mode
JBoss cannot run on port 80 because root privileges are required. Since JBoss does not have the ability to start as root, bind to port 80, then switch back to a user without administrative privileges it would have to run as root. This creates a security issue for your system.For the JBoss standalone approach we use xinetd to keep JBoss running on port 8080 and have requests to port 80 redirected to JBoss. This requires us to disable Apache
NOTE: Apache is part of the base environment of the eApps hosting service. The examples explain how to disable Apache. Do not uninstall Apache! Certain system events will synchronize your VPS to the standard base configuration and will automatically re-install Apache without your knowledge.
- Stop and Disable Apache
Login to your Control Panel, and click on the System Tab. If necessary, click the Select Another System (Subscription) link on the left and choose the correct Virtuozzo container.
.
Click on Service Management, and then Services. Click on the httpd service, and click on Stop and then Autostart Off.
This stops the httpd (Apache) service, which stops the web server. This also stops httpd from starting again when the VPS is rebooted.
Using the Command line
Note – this assumes you are logged into the VPS via SSH as the root user
[root@example]# service httpd stop [root@example]# chkconfig httpd off |
- Add the port 80 redirect
[root@example ~]# cd /etc/xinetd.d [root@example xinetd.d]# vi jboss |
Using a text editor (in this example the vi editor) create a new file called jboss with these lines:
# Redirects any requests on port 80 # to port 8080 (where JBoss is listening) service http { socket_type = stream user = root wait = no redirect = localhost 8080 disable = no } |
Restart xinetd for the changes to take effect.
[root@example xinetd.d]# service xinetd restart |
Examples using JBoss in stand alone mode
Deployment with JBoss serving JSP and Servlets using a WAR file at example.com/mywebapp
This deployment example assumes you are serving your JBoss application from the default/deploy directory, using a WAR file and calling the application directly.Remember to substitute JBossX or jbossX with your version of JBoss, and example.com with your actual domain name.
Note for JBoss 5 users - the server.xml file is now located at /opt/jboss5/server/default/deploy/jbossweb.sar/
- server.xml - Add the following host just below the last closing host tag (</Host>) in your /opt/jbossX/server/default/deploy/jboss-web.deployer/server.xml file. This will serve your application at http://example.com/mywebapp and http://www.example.com/mywebapp.
<Host name="example.com" autoDeploy="false" deployOnStartup="false" deployXML="false"> <Alias>www.example.com</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="example.com" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/> <DefaultContext cookies="true" crossContext="true" override="true"/> </Host> |
- jboss-web.xml - To associate your WAR file with a specific host you must add lines like the example below in your application WEB-INF/jboss-web.xml file. In this case we are associating a way with the example.com host.
<jboss-web> <context-root>mywebapp</context-root> <virtual-host>example.com</virtual-host> </jboss-web> |
Deployment with JBoss serving JSP and Servlets using a WAR file at example.com
This deployment example assumes you are serving your JBoss application from the default/deploy directory, using a WAR file and the root context (example.com).Remember to substitute JBossX or jbossX with your version of JBoss, and example.com with your actual domain name.
- server.xml - Add the following host just below the last closing host tag (</Host>) in your /opt/jbossX/server/default/deploy/jboss-web.deployer/server.xml file. This will serve your application at http://example.com and http://www.example.com.
<Host name="example.com" autoDeploy="false" deployOnStartup="false" deployXML="false"> <Alias>www.example.com</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="example.com" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/> <DefaultContext cookies="true" crossContext="true" override="true"/> </Host> |
- jboss-web.xml - To associate your WAR file with a specific host you must add lines like the example below in your application WEB-INF/jboss-web.xml file. In this case we are associating a way with the example.com host.
<jboss-web> <context-root>/</context-root> <virtual-host>example.com</virtual-host> </jboss-web> |
Deployment with JBoss serving JSP and Servlets using an EAR file at example.com/mywebapp
This deployment example assumes you are serving your JBoss application from the default/deploy directory, using an EAR file and calling the application directly.Remember to substitute JBossX or jbossX with your version of JBoss, and example.com with your actual domain name.
Note for JBoss 5 users - the server.xml file is now located at /opt/jboss5/server/default/deploy/jbossweb.sar/
- server.xml - Add the following host just below the last closing host tag (</Host>) in your /opt/jbossX/server/default/deploy/jboss-web.deployer/server.xml file. This will serve your application at http://example.com/mywebapp and http://www.example.com/mywebapp.
<Host name="example.com" autoDeploy="false" deployOnStartup="false" deployXML="false"> <Alias>www.example.com</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="example.com" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/> <DefaultContext cookies="true" crossContext="true" override="true"/> </Host> |
- application.xml - Applications packaged in an EAR must also define the context in the applications application.xml file. For our example we should have lines similar to what is below in this file
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4" 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/application_1_4.xsd"> <display-name>mywebapp</display-name> <module> <ejb>mywebapp-ejb.jar</ejb> </module> <module> <web> <web-uri>mywebapp.war</web-uri> <context-root>mywebapp</context-root> </web> </module> </application> |
- jboss-web.xml - To associate your WAR file inside your EAR with a specific host you must add lines like the example below in your mywebapp.war WEB-INF/jboss-web.xml file. In this case we are associating a way with the example.com host.
<jboss-web> <context-root>mywebapp</context-root> <virtual-host>example.com</virtual-host> </jboss-web> |
Deployment with JBoss serving JSP and Servlets using an EAR file at example.com
This deployment example assumes you are serving your JBoss application from the default/deploy directory, using an EAR file and the root context (example.com).Remember to substitute JBossX or jbossX with your version of JBoss, and example.com with your actual domain name.
Note for JBoss 5 users - the server.xml file is now located at /opt/jboss5/server/default/deploy/jbossweb.sar/
- server.xml - Add the following host just below the last closing host tag (</Host>) in your /opt/jbossX/server/default/deploy/jboss-web.deployer/server.xml file. This will serve your application at http://example.com and http://www.example.com.
<Host name="example.com" autoDeploy="false" deployOnStartup="false" deployXML="false"> <Alias>www.example.com</Alias> <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="example.com" suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log"/> <DefaultContext cookies="true" crossContext="true" override="true"/> </Host> |
- application.xml - Applications packaged in a EAR must also define its context in the applications application.xml file. For our example we should have lines similar to what is below in this file.
<application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4" 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/application_1_4.xsd"> <display-name>mywebapp</display-name> <module> <ejb>mywebapp-ejb.jar</ejb> </module> <module> <web> <web-uri>mywebapp.war</web-uri> <context-root>/</context-root> </web> </module> </application> |
- jboss-web.xml - To associate your WAR file inside your EAR with a specific host you must add lines like the example below in your mywebapp.war WEB-INF/jboss-web.xml file. In this case we are associating a way with the example.com host.
<jboss-web> <context-root>/</context-root> <virtual-host>example.com</virtual-host> </jboss-web> |
Links to other information
JBoss Home Page: http://jboss.org/JBoss wiki: http://www.jboss.org/wiki/Wiki.jsp
Apache 2.2 Documentation: http://httpd.apache.org/docs/2.2/
Mod_jk Home Page: http://tomcat.apache.org/connectors-doc/
eApps Apache User Guide: http://support.eapps.com/apache