Register   Login   About   Study   Enterprise   Share
Internet / AI Technology University (ITU/AITU)
Fast Login - available after registration







|

Top Links: >> 80. Technology >> Internet Technology Summit Program >> 4. Web Apps Frameworks >> 4.3. Servlets and Java Server Pages
Current Topic: 4.3.2. Application Servers - JBoss or WildFly
You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
4.3.2. Application Servers - JBoss or WildFly
The second by popularity Java-based Application Server is JBoss AS by Red Hat.
Red Hat became a big umbrella on many open source projects. Starting with Linux, Red Hat acquired JBoss and more organizations specialized on open source software.

In the recent re-incarnation JBoss AS changed its name to WildFly, although the main structure and the features are mostly the same. We will describe the features based on the JBoss 7 documentation.

JBoss (WildFly) application server as well as Tomcat supports JSP and Servlets. JBoss AS also offers transactional support and more powerful security features. The "Full Profile" distribution of JBoss AS includes Java Messaging Services provided by HornetQ project under JBoss distribution.

JBoss has a different from Tomcat directory structure. Configuration and deployment is very different.
AS 7 Directory Structure includes the following directories: (the most important directories, which we actually will use, are in bold.)

bin - Start up scripts, start up configuration files and various command line utilities like Vault, add-user and Java diagnostic report available for Unix and Windows environments
bin/client - Contains a client jar for use by non-maven based clients.
bundles - Location of OSGi bundles
docs/schema - XML schema definition files
domain - Configuration files, deployment content, and writable areas used by the domain mode processes run from this installation.
modules - AS 7 is based on a modular class-loading architecture. The various modules used in the server are stored here.
standalone - Configuration files, deployment content, and writable areas used by the single standalone server run from this installation.
appclient - Configuration files, deployment content, and writable areas used by the application client container run from this installation.
welcome-content - Default Welcome Page content

Standalone Directory Structure
The standalone mode is the most often used configuration, when JBoss AS runs as a single process.
The configuration files, deployment content and writable areas used by the single standalone server are found in the following subdirectories under the top level "standalone" directory:
configuration - Configuration files for the standalone server that runs off of this installation. All configuration information for the running server is located here and is the single place for configuration modifications for the standalone server.
data - Persistent information written by the server to survive a restart of the server
deployments - End user deployment content can be placed in this directory for automatic detection and deployment of that content into the server's runtime. Think of this directory as similar to the webapps directory in Tomcat. You can start JBoss and drop into this directory a war file, for example, BASE.war. JBoss will notice this compressed application, unzip it, deploy and start running. (war-files are actually compressed with the ZIP algorithm).
NOTE: The server's management API is recommended for installing deployment content. File system based deployment scanning capabilities remain for developer convenience.
lib/ext - Location for installed library jars referenced by applications using the Extension-List mechanism
log - standalone server log files
tmp - location for temporary files written by the server
tmp/auth - Special location used to exchange authentication tokens with local clients so they can confirm that they are local to the running AS process.

The most important configuration file is ~jboss/standalone/configuration/standalone.xml.
This file is a single place where you provide information on the listening port (default=8080) and secure port (default=443). Right there is the section for data sources, where default definition is for ?In-Memory? H2 Database Engine, available with the JBoss AS distribution.
Of course, for production you might need a real database, such as Oracle or PostgreSQL. You can just add the? datasources? ? section a proper definition, including a driver name with the related module, or a jar file, which supports the driver.
This is the extract from the standalone.xml file with the datasources subsystem section defining for Oracle Express database.



pool-name="myDB" enabled="true" use-java-context="true"
use-ccm="true">

jdbc:oracle:thin:@localhost:1521:xe

oracle

5
10
true


myUserName
myPassword










oracle.jdbc.driver.OracleDriver





Was it clear so far?


The section includes the reference to the pool name myDB, which can be used in java program to identify this data source.
Can you see the reference to jta? This is a promise to manage database transactions with Java Transaction API supported by the JBoss container.
There is a user name and a password in the security section. You can see the connection URL.
Do not miss a very important connection between the lines:

oracle

and



This is the pointer to the module location of the JDBC driver ? jar file that supports this database.

How to start and stop JBoss?
This is the easiest part!
Open a command prompt in ~jboss/bin ? directory and type:
$ startup - to start JBoss AS
or
$shutdown - to stop JBoss AS

Assignments:
1. Read more from JBoss documentation: https://docs.jboss.org/
2. Download and install JBoss from JBoss archive ? use 64 bit binary
3. Installation is usually just means uncompressing the ZIP file int c:/ - drive. Rename the uncompressed directory to jboss, so you will have c:/jboss directory structure.
4. Start JBoss by opening a command line prompt in the c:/jboss/bin ? directory and type:
startup
5. Open a browser and enter http://localhost:8080 - you should see a JBoss Welcome screen.
6. Stop JBoss.
7. Download and install the latest version of WildFly from http://wildfly.org/downloads/
8. Rename the unzipped directory in the c:/wildfly similar to c:/jboss.
9. Start wildfly by opening a command line prompt in c:/wildfly/bin ? directory and typing:
startup
10. Open a browser and enter http://localhost:8080 - you should see a Welcome screen.
11. Stop the server by opening a command line prompt in c:/wildfly/bin ? directory and typing:
shutdown
12. Open the c:/wildfly/standalone/configuration/standalone.xml ? flie and change the listening port to 80.
13. Start the server, open the browser and enter: http://localhost
14. You should see the Welcome page of the server. This time there is no need to type the port number, because port 80 is the default port for any browser.
15. Stop the server.
| Check Your Progress | Propose QnA | Have a question or comments for open discussion?
<br/><subsystem xmlns="urn:jboss:domain:datasources:1.0">
<br/>   <datasources>
<br/>     <datasource jta="true" jndi-name="java:/jdbc/lportal" 
<br/>pool-name="myDB" enabled="true" use-java-context="true" 
<br/>use-ccm="true">
<br/>        <connection-url>
<br/>jdbc:oracle:thin:@localhost:1521:xe
<br/>        </connection-url>
<br/>        <driver>oracle</driver>
<br/>        <pool>
<br/>           <min-pool-size>5</min-pool-size>
<br/>           <max-pool-size>10</max-pool-size>
<br/>           <prefill>true</prefill>
<br/>          </pool>
<br/>          <security>
<br/>            <user-name>myUserName</user-name>
<br/>            <password>myPassword</password>
<br/>          </security>
<br/>          <validation>
<br/>            <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/>
<br/>            <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/>
<br/>            <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
<br/>           </validation>
<br/>         </datasource>
<br/>         <drivers>
<br/>         <driver name="oracle" module="com.oracle.ojdbc6">
<br/>           <xa-datasource-class>
<br/>oracle.jdbc.driver.OracleDriver
<br/>           </xa-datasource-class>
<br/>         </driver>
<br/>       </drivers>
<br/>    </datasources>
<br/></subsystem>
<br/>






Was it clear so far?



The section includes the reference to the pool name myDB, which can be used in java program to identify this data source.
Can you see the reference to jta? This is a promise to manage database transactions with Java Transaction API supported by the JBoss container.
There is a user name and a password in the security section. You can see the connection URL.
Do not miss a very important connection between the lines:
<br/><driver>oracle</driver>
<br/>

and
<br/><driver name="oracle" module="com.oracle.ojdbc6">
<br/>

This is the pointer to the module location of the JDBC driver ? jar file that supports this database.

How to start and stop JBoss?
This is the easiest part!
Open a command prompt in ~jboss/bin ? directory and type:
$ startup - to start JBoss AS
or
$shutdown - to stop JBoss AS

Assignments:
1. Read more from JBoss documentation: https://docs.jboss.org/
2. Download and install JBoss from JBoss archive ? use 64 bit binary
3. Installation is usually just means uncompressing the ZIP file int c:/ - drive. Rename the uncompressed directory to jboss, so you will have c:/jboss directory structure.
4. Start JBoss by opening a command line prompt in the c:/jboss/bin ? directory and type:
startup
5. Open a browser and enter http://localhost:8080 - you should see a JBoss Welcome screen.
6. Stop JBoss.
7. Download and install the latest version of WildFly from http://wildfly.org/downloads/
8. Rename the unzipped directory in the c:/wildfly similar to c:/jboss.
9. Start wildfly by opening a command line prompt in c:/wildfly/bin ? directory and typing:
startup
10. Open a browser and enter http://localhost:8080 - you should see a Welcome screen.
11. Stop the server by opening a command line prompt in c:/wildfly/bin ? directory and typing:
shutdown
12. Open the c:/wildfly/standalone/configuration/standalone.xml ? flie and change the listening port to 80.
13. Start the server, open the browser and enter: http://localhost
14. You should see the Welcome page of the server. This time there is no need to type the port number, because port 80 is the default port for any browser.
15. Stop the server.

| Check Your Progress | Propose QnA | Have a question or comments for open discussion?

Have a suggestion? - shoot an email
Looking for something special? - Talk to me
Read: IT of the future: AI and Semantic Cloud Architecture | Fixing Education
Do you want to move from theory to practice and become a magician? Learn and work with us at Internet Technology University (ITU) - JavaSchool.com.

Technology that we offer and How this works: English | Spanish | Russian | French

Internet Technology University | JavaSchool.com | Copyrights © Since 1997 | All Rights Reserved
Patents: US10956676, US7032006, US7774751, US7966093, US8051026, US8863234
Including conversational semantic decision support systems (CSDS) and bringing us closer to The message from 2040
Privacy Policy