Object Relational Mapping with JPA / Kodo 4

Download Report

Transcript Object Relational Mapping with JPA / Kodo 4












What is JBoss
JBoss Architecture
JBoss Internals
JBoss Installation
Directory Structure
Jboss Enterprise Application Platform
Starting / Stopping the server
Jboss Administration Console.
JMX Console
Twiddle Utility
QA Session
http://weblogic-wonders.com

Open source implementation of the Java EE suite of services

Great deal of customization due to modularization of the services like.
◦
◦
◦
◦
◦
◦
Enterprise JavaBeans (EJB)
Java Persistence API (JPA)
Java Messaging Service (JMS)
Java Transaction Service/Java Transaction API (JTS/JTA)
Servlets and JavaServer Pages (JSP)
Java Naming and Directory Interface (JNDI)

Advanced and fully extensible, cross component model, aspect integration,
server runtime environment

Community Jboss Application Server and Jboss Enterprise Application Platform.
http://weblogic-wonders.com

Developed by Jboss Inc, now a RedHat division.

JBoss AS 4.0, a Java EE 1.4 features embedded apache tomcat.

JBoss AS 4.2 also functions as a Java EE 1.4 but deploys EJB 3.0 by default

JBoss AS 5.1, released as of 2009, operates as a Java EE 5 application server
built on top of a new JBoss microcontainer.

JBoss AS 6.0, an unofficial implementation of Java EE 6, was released on
December 28, 2010. JBoss AS 6 does not support the full Java EE 6 stack

JBoss AS 7, the current stable release, was released on July 12, 2011.
http://weblogic-wonders.com
Community Jboss Application Server:



Used by developers to test and integrate middleware capabilities.
Best suited for early to advanced prototyping and development
http://www.jboss.org/jbossas/downloads/
Jboss Enterprise Application Platform:




Integrates JBoss Application Server, with JBoss Hibernate, JBoss Seam, and other
leading open source Java technologies from JBoss.org into a complete, simple
enterprise solution for Java applications.
Integrated, tested and certified Enterprise Platforms.
Evaluation copy : http://www.jboss.com/downloads/
http://docs.redhat.com/docs/enUS/JBoss_Enterprise_Application_Platform/5/html/Installation_Guide/Introduction
.html
http://weblogic-wonders.com

Jboss Microcontroller : POJO based kernel ,wires all the services. Core of the
server.

Full support for EJB 3.0

JBoss Messaging is a high performance JMS provider, rewrite of JBossMQ.

JBossCache enhancing the performance for caching the data

JBossWS is the web services stack for JBoss 5 providing Java EE compatible web
services,

JBoss Transactions is the default transaction manager for JBoss 5.

JBoss Web is the Web container in JBoss 5, an implementation based on Apache
Tomcat that includes the Apache Portable Runtime (APR).

JBoss Security has been updated to support pluggable authorization models
including SAML, XACML and federation
http://weblogic-wonders.com




Crux of Jboss, which is the foundation architecture into which you can plug only
the services that your application needs
You can use bean configuration files in the server/xxx/conf directory to configure
the MicroContainer.
Jboss 5.0 still provides few services based on JMX (Java Management eXtensions)
to access the MBeans.
JMX Service is defined by JMX kernel is server/xxx/conf/jboss-service.xml, some
Mbeans defined are below.
◦
◦
◦
◦
◦
◦
The logging Service
The Thread Pool - used to supply threads to run various services
The Java Naming and Directory Interface - JNDI
Various MBeans for managing security - includes JAAS
Various MBeans related to accessing JMX services
Various MBeans related to the remoting service

http://weblogic-wonders.com
http://weblogic-wonders.com
Pre-Requisites
◦ Enterprise Application Platform 5 requires a Java 6 JDK or JRE.
Installation Methods.

ZIP download: Extract the ZIP folder. Faster way.

RPM installation: Suitable for production deployment on Red Hat Enterprise
Linux system

Graphical Installer: In addition to installing the base files, the installer offers
automation of optional component installation, and basic out-of-the-box
security configuration
http://weblogic-wonders.com
Steps

Download the software from RedHat site. (Evaluation Copy)
Application Platform <release> Binary Installer
https://access.redhat.com/downloads/evals

Execute the command java -jar jboss-eap-installer-<release>.jar

Specify the installation directory

Select the packages you would like to install


For ex. WebServices stack

Specify the JMX Security

Install the native libraries

Perform the post installation activities like securing the JMX console, Admin
Console etc.
http://weblogic-wonders.com

Bin: Contains all the scripts to start the server, installing the server as a Service.

Client: Contains all the client specific jar files.

Common: Contains the jar files that are common to all the server profiles.

Docs: Contains the documents and examples.

Lib: Contains the library files.

Native : Contains the native libraries

Server: Contains server configurations. By default the Jboss installation contains
the below server configurations.






Minimal:
Default :
All:
Standard :
Web:
Production:
http://weblogic-wonders.com


Incorporates native operating system components and connectors
Higher server performance, as native operating system code becomes available for
the server to optimize tasks.

Apache Portable Runtime (APR)

OpenSSL for implementing SSL and TLS

Tomcat Native (TC-Native)

mod_jk connects the Tomcat JSP container to the Apache webserver, providing
load-balancing.

mod_cluster is an httpd-based load balancer.

ISAPI is a connector for the Microsoft IIS web server.

HornetQ a JMS messaging provider which provides high performance
http://weblogic-wonders.com


Conf :Contains the bootstrap.xml bootstrap descriptor file for a given server
configuration. This defines the core microcontainer beans.
Data: Used by services that want to store content in the file system. It holds
persistent data for services intended to survive a server restart.

Deploy: Contains the hot-deployable services, applications

Lib: Contains library files specific to the server configuration.

Log: This is where the log files are written


tmp Used for temporary storage by JBoss services. The deployer, for example,
expands application archives in this director
Work: Directory is used by Tomcat for compilation of JSP
http://weblogic-wonders.com
Starting the Server:

Move to JBOSS_DIST/jboss-as/bin directory and execute the run.bat (for Windows)
or run.sh (for Linux) script, as appropriate for your operating system.



Note: Below are the default settings.
The server is bound to 127.0.0.1 for security reasons. To enable remote access by
binding JBoss services to a particular interface, simply run jboss with the -b
option.


$JBOSS_HOME/bin/run.bat –b
The server runs on port 8080 and to change the settings, we can run it as below.


$JBOSS_HOME/bin/run.bat
$JBOSS_HOME/bin/ run -Djboss.service.binding.set=ports-01
Specify alternate server profile.

$JBOSS_HOME/bin/ run –c <alternate-server-profile>
Stopping the server:

You can run the shutdown script to shutdown the server.

$JBOSS_HOME/bin/shutdown.sh
http://weblogic-wonders.com












JBOSS_HOME URL: file:/H:/jboss-6.0.0.Final/
Bootstrap: $JBOSS_HOME\server/default/conf/bootstrap.xml
Common Base: $JBOSS_HOME\common/
Common Library: $JBOSS_HOME\common/lib/
Server Name: default
Server Base: $JBOSS_HOME\server/
Server Library: $JBOSS_HOME\server/default/lib/
Server Config: $JBOSS_HOME\server/default/conf/
Server Home: $JBOSS_HOME\server/default/
Server Data: $JBOSS_HOME\server/default/data/
Server Log: $JBOSS_HOME\server/default/log/
Server Temp: $JBOSS_HOME\server/default/tmp/
http://weblogic-wonders.com
Port
1099
1100
8083
4444
4445
3528
8089
8090
8091
8092
8093
1701
Description
JNDI
HAJNDI for clustering
WebService for downloading RMI classes
RMI/JRMP Invoker, invokes JMX services
RMI/JRMPHA Invoker, invokes clustered JMX services
CORBA ORB
JMS RMI InvocationLayer
JMS OIL InvocationLayer
JMS UIL InvocationLayer
JMS OIL2 InvocationLayer
JMS UIL2 InvocationLayer
Hypersonic Database
8080 WebServer (Tomcat/Jetty)
Location
server/default/conf/jboss-service.xml
server/all/deploy/cluster-service.xml
server/default/conf/jboss-service.xml
server/default/conf/jboss-service.xml
server/all/deploy/cluster-service.xml
server/all/conf/jacorb.properties
server/default/deploy/jms/rmi-il-service.xml
server/default/deploy/jms/oil-service.xml
server/default/deploy/jms/uil-service.xml
server/default/deploy/jms/oil2-service.xml
server/default/deploy/jms/uil2-service.xml
server/default/deploy/hsqldb-ds.xml
server/default/deploy/jbosswebtomcat41.sar/META-INF/jboss-service.xml

Start automatically when you boot a Windows host computer

JBoss AS comes with Windows service executable as part of Jboss Native library
that can run JBoss Application Server as service.


The service executable jbosssvc.exe transforms run.bat and shutdown.bat batch
scripts to services. This means that any change made to those scripts will be
used both in service and command line mode.
http://www.jboss.org/jbossweb/install/service.html
http://weblogic-wonders.com
Lab - 1

Installation and exploring the directory structure.

Installing the Jboss App. Server.

Exploring the directory structure.

Starting and stopping the server.

Changing the default ports.

Binding to different IP interfaces.
Lab – 2

Exploring the memory arguments.

Changing the default memory argument values
Lab – 3

Jboss as windows service
http://weblogic-wonders.com

Included from Jboss 5.1.0 distribution list onwards.

Uses the Embedded Jopr (As it runs as a part of Jboss Admin Server).


Default username / password is admin/ admin defined in the below file.
server/configuration/conf/props/jmx-console-users.properties
Change/ update the roles by editing the below file.
server/configuration/conf/props/jmx-console-roles.properties
http://weblogic-wonders.com
The Admin Console is secured by the JAAS security domain jmx-console .
Enabling Authentication on the Admin Console
 In this web.xml file:JBOSS_HOME/server/PROFILE/deploy/management/consolemgr.sar/web-console.war/WEB-INF/web.xml ensure the following securityconstraint fragment is uncommented
Enabling Security Domain on the Admin Console
 In this jboss web.xml file:
JBOSS_HOME/server/PROFILE/deploy/management/consolemgr.sar/web.console.war/WEB-INF/jboss-web.xml
 ensure the following fragment is included.



<jboss-web>
<security-domain>java:/jaas/jmx-console</security-domain>
</jboss-web>
http://weblogic-wonders.com
Features:

Provides an overview of the server configuration

Configuring the ports using the Service Binding Manager.

Deploy, Re-deploy, Undeploy and control the applications.

Configure, manage JMS resources

Configure, manage connection factories.

Add, remove, configure and control the Data Sources.

Gather metrics related to the EAP instances, JMS Queues, Topics, Data Sources
http://weblogic-wonders.com

It’s a JBoss Management Console which provides a raw view of the JMX MBeans
which make up the server.
Things we can do with JMX Console.

Display the JNDI tree : Lists the JNDI object bound using service=JNDIView

Generate a thread dump: Capture the thread dumps using
jboss.system:type=ServerInfo Mbean

Display the memory pool usage : Using the jboss.system:type=ServerInfo mbean

Manage the deployment scanner: Enable/ Disable the Hot Deployment scanner.

Redeploy an application

Shut down JBoss
http://weblogic-wonders.com
Features:

Jboss Management console.

Comprehensive insight about the Jboss

$SERVER-PROFILE\deploy\management\console-mgr.sar\web-console.war

$SERVER-PROFILE\deploy\management\console-mgr.sar\web-console.war\WEBINF\classes\

web-console-users.properties

web-console-roles.properties
http://weblogic-wonders.com

JMX: Its Java Management Extension allows to integrate modules, containers,
and plug-ins. These components are collectively called Mbeans.

Executed by Twiddle.sh / twiddle.bat under the $JBOSS_HOME/bin folder.

twiddle.bat –h

usage: twiddle [options] <command> [command_arguments]

Connecting to a remote server using twiddle.

twiddle.bat -s localhost:1099 serverinfo –d
jboss

List the Mbeans that can be accessed.

twiddle.bat -s localhost:1099 serverinfo –l



References:
http://docs.jboss.org/jbossas/jboss4guide/r1/html/ch2.chapter.html
http://weblogic-wonders.com

In JBoss log4j is used for logging.

Controlled by <server-profile>/conf/jboss-log4j.xml file.

Defines different appenders, message format, log levels etc.

By default, JBoss produces output to both the console and a log file
(log/server.log).

Console default level is INFO.

No default log level for server log, so everything is logged (DEBUG).
<appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<!-- <param name="File" value="${jboss.server.log.dir}/server.log"/> -->
<param name="File" value="C:/server.log"/>
<param name="Append" value="true"/>
http://weblogic-wonders.com
Lab - 4

Exploring the Admin console and JMX console.

Checking the services
Lab – 5


Exploring the Twiddle utility.
Examples to getting Server Information, Global JNDI Information,Jboss Logging
Information,Thread Pool information:
Lab – 6

Understanding the logging feature.

Changing the default logging level.
http://weblogic-wonders.com
Q-A
http://weblogic-wonders.com