200 likes | 412 Views
Application Servers JBoss. Celsina Bignoli bignolic@smccd.net. Application Server. Runtime Environment in which beans live Supplies and manages middleware services Manages the enterprise beans contained within it registers the object provides remote interface for the object
E N D
Application ServersJBoss Celsina Bignoli bignolic@smccd.net
Application Server • Runtime Environment in which beans live • Supplies and manages middleware services • Manages the enterprise beans contained within it • registers the object • provides remote interface for the object • creates and destroys object instances • checks security for the object • manages the active state for the object • coordinates distributed transactions • Optionally manages data persistency • Also referred to as EJB container
Popular Application Servers • BEA WebLogic • Sun Java System Application Server • IBM WebSphere • Oracle Application Server • JBoss Complete list available at http://java.sun.com/j2ee/licensees.html
JBoss • open source Java EE-based application server • Fully implemented in Java • Easy to install and configure • Available under LGPL license • Latest release: 4.0.4 as of May 15 2006 • Web site: www.jboss.org
Installing Java • JBoss 4.0.4 is compatible with J2SE1.4 or higher • Download the full JDK from Sun’s website http://java.sun.com • After installation • create an environment variable JAVA_HOME that points at the Java installation directory • add $JAVA_HOME/bin to the path so you can run Java from command line • to verify the Java installation type java –version at a command line prompt
Download Ant 1.6.5 from http://ant.apache.org To install Ant simply unzip the downloaded file to a directory of your choice After installation: Create an environment variable called ANT_HOME that points to the Ant installation directory Add $ANT_HOME/bin to the system path to run Ant from the command line To verify Ant installation type: ant –version at a command line prompt. Installing Ant
Installing JBoss • Download the JBoss Application Server 4.0.4 from http://www.jboss.org • To install JBoss simply unzip the downloaded file to a directory of your choice • After installation • create an environment variable JBOSS_HOME that points at the JBoss installation directory • add $JBOSS_HOME/bin to the path so you can run JBoss from command line
JBoss Directory Structure • bin/ startup and shutdown scripts • client/ JAR files used by external client applications that remotely access JNDI resources • docs/ various descriptive documents but NOT JBoss documentation. Documentation can be accessed on the JBoss website • lib/ JAR files that make up JBoss • server/ sub-directories for various server configurations. Where you deploy your applications.
JBoss Services as MBeans • JBoss is a thin JMX (Java Management Extensions) microkernel. • JMX is a framework for managing resources such as applications, devices, and services . • a given resource is instrumented by one or more Java objects known as Managed Beans, or MBeans • MBeans are registered in a core managed object server, known as an MBean server . • Each J2EE service that runs inside JBoss is a MBean. • a server configuration is a family of interrelated services
Server Configurations • Minimal • contains the bare minimum services required to start JBoss • starts the logging service, a JNDI server and a URL deployment scanner to find new deployments. • This is what you would use if you want to use JMX/JBoss to start your own services without any other J2EE technologies. • no web container, no EJB or JMS support. • Default • consists of the standard services needed by most J2EE applications. • All • all the available services.
Custom Configurations • You can create your own configuration copying the default directory, giving it a unique name and adding/removing services. Run the server with run –c config_name
Server Configuration Directory Structure • conf/ configuration files for core services • deploy/ deployment directory. Contains hot-deployable services • lib/ • JAR files to support the dynamic JBoss services (MBeans) • data/ • holds persistent data for services intended to survive a server restart • Hypersonic database stores data here.
Server Configuration Directory Structure(2) • log • This is where the log files are written. JBoss uses the Jakarta log4j package for logging • tmp/ • used for temporary storage by JBoss services. • The deployer expands application archives in this directory. • work/ • used by Tomcat for compilation of JSPs
Configure HSQL MBean and TCP Connections • make sure the Hypersonic database (HSQL) is running in client-server mode and accepts TCP/IP connections • Open hsqldb-ds.xml file in the deploy directory • Set connection-url element to jdbc:hsqldb:hsql://localhost:1701 • Uncomment the MBean declaration for the Hypersonic service
Verify JBoss Installation • to verify the JBoss installation type run at a command line prompt • Open url http://localhost:8080 • Access the JMX console http://localhost:8080/jmx-console
Deployment in JBoss • To deploy an application you simply drop a EAR or WAR file in the deploy/ directory. JBoss will handle the rest.
Ant • open source software tool for automating software build processes. • released by the Apache Software Foundation. • similar to make but written in Java and primarily intended for use with Java projects. • uses a file in XML format to describe the build process and its dependencies (build file). • By default the XML file is named build.xml.
Projects • a build file contains one project and at least one (default) target. • A project has the following elements: • name: the name of the project. • default: the default target to use when no target is supplied • basedir: the base directory from which all path calculations are done.
Targets • A target is a set of tasks you want to be executed. • When starting Ant, you can select which target(s) you want to have executed. • When no target is given, the project's default is used. • A target can depend on other targets. Ant resolves these dependencies. • the Ant's depends attribute only specifies the order in which targets should be executed - it does not affect whether the target is executed or not.
Tasks • A task is a piece of code that can be executed. • A task can have multiple attributes • The value of an attribute might contain references to a property. These references will be resolved before the task is executed. • Tasks have a common structure: <nameattribute1="value1" attribute2="value2" ... /> where name is the name of the task, attributeN is the attribute name, and valueN is the value for this attribute. • There is a set of built-in tasks, along with a number of optional tasks, but it is also very easy to write your own.