Tải bản đầy đủ - 0 (trang)
Chapter 21. JBoss Installation and Configuration

Chapter 21. JBoss Installation and Configuration

Tải bản đầy đủ - 0trang

21.1AboutJBoss

JBossisacollaborativeeffortofaworldwidegroupof

developerstocreateanopensourceapplicationserverbasedon

theJava2Platform,EnterpriseEdition(J2EE).Withmorethan

fivemilliondownloadsinthelasttwoyears,JBossistheleading

J2EEapplicationserver.

JBossimplementsthefullJ2EEstackofservices:

EJB(EnterpriseJavaBeans)

JMS(JavaMessageService)

JTS/JTA(JavaTransactionService/JavaTransactionAPI)

ServletsandJSP(JavaServerPages)

JNDI(JavaNamingandDirectoryInterface)

Italsoprovidesadvancedfeaturessuchasclustering,JMX,web

services,andIIOP(InternetInter-ORBProtocol)integration.

BecauseJBosscodeislicensedundertheLGPL(GNULesser

GeneralPublicLicense,see

http://www.gnu.org/copyleft/lesser.txt),youcanuseitfreely,

atnocost,inanycommercialapplication,orredistributeitas

is.



21.2InstallingJBossApplicationServer

Beforegoinganyfurther,makesureyouhavetheJ2SEJDK1.4

orhigherinstalledandcorrectlyconfigured.

TodownloadtheJBossbinaries,gototheJBosswebsiteat

http://www.jboss.organdfollowtheDownloadslink.Thereyou

willfindallcurrentbinariesinbothzipandtar.gzarchive

formats.Downloadthepackagethatbestmeetsyourneeds.

Extractthedownloadedarchiveinthedirectoryofyourchoice.

UnderWindows,youcanusetheWinZiputilitytoextractthe

archivecontent.UnderUnix,youcanusethefollowing

commands:

$gunzipjboss-4.0.tar.gz

$tarxfjboss-4.0.tar



Thenchangetothe$JBOSS_HOME/bindirectoryandlaunchthe

runscriptthatmatchesyourOS:

Unix:

$run.sh

Windows:

C:\jboss-4.0\bin>run.bat



That'sit!YounowhaveafullyworkingJBossserver!



21.2.1DiscoveringtheJBossDirectoryStructure

InstallingJBosscreatesthedirectorystructureshowninFigure

21-1.



Figure21-1.JBossdirectorystructure



Table21-1describesthepurposesofthevariousdirectories.

Table21-1.JBossdirectories

Directory



Description



bin



ScriptstostartandshutdownJBoss.



client



Client-sideJavalibraries(JARs)requiredtocommunicatewithJBoss.



docs



Sampleconfigurationfiles(fordatabaseconfiguration,etc.)



docs/dtd



DTDs(DocumentTypeDefinitions)forthevariousXMLfilesusedin

JBoss.



lib



JARsloadedatstartupbyJBossandsharedbyallJBoss

configurations.(Youwon'tputyourownlibrarieshere.)



server



VariousJBossconfigurations.(Eachconfigurationmustbeina

differentsubdirectory.Thenameofthesubdirectoryrepresentsthe

nameoftheconfiguration.Asdistributed,JBosscontainsthree

configurations:minimal,default,andall.)



server/all



JBoss'scompleteconfiguration;startsallservices,including

clusteringandIIOP.



server/minimal



JBoss'sminimalconfiguration;startsonlyverybasicservices;cannot

beusedtodeployEJBs.



server/default



JBoss'sdefaultconfiguration;usedwhennoconfigurationnameis

specifiedonJBosscommandline.



server/default/conf



JBoss'sconfigurationfiles.(Youwilllearnmoreaboutthecontentof

thisdirectoryinthenextsection.)



server/default/data



JBoss'sdatabasefiles(embeddeddatabaseorJBossMQ,for

example).



JBoss'shot-deploymentdirectory.(Anyfileordirectorydroppedin

server/default/deploy thisdirectoryisautomaticallydeployedinJBoss:EJBs,WARs,EARs,

andevenservices.)



server/default/lib



JARsthatJBossloadsatstartupwhenstartingthisparticular

configuration.(Theallandminimalconfigurationsalsohavethis

directoryandthenexttwo.)



server/default/log



JBoss'slogfiles.



server/default/tmp



JBoss'stemporaryfiles.



Ifyouwanttodefineyourownconfiguration,createanewsubdirectoryundertheserverdirectorycontainingtheappropriate

files.TostartJBosswithagivenconfiguration,usethe-c

parameteronthecommandline:



Windows:

C:\jboss-4.0\bin>run.bat-cconfig-name

Unix:

$./run.sh-cconfig-name



21.2.2JBossConfigurationFiles

Astheprevioussectiondescribed,JBoss'sserverdirectorycan

containanynumberofdirectories,eachrepresentingadifferent

JBossconfiguration.

Theserver/config-name/confdirectorycontainsJBoss's

configurationfiles.Thepurposeofthevariousfilesisdiscussed

inTable21-2.

Table21-2.JBossconfigurationfiles

File

jacorb.properties



Description

JBossIIOPconfiguration.



jbossmq-state.xml JBossMQ(JMSimplementation)userconfiguration.



jboss-service.xml



DefinitionofJBoss'sserviceslaunchedatstartup(classloaders,JNDI,

deployers,etc.).



log4j.xml



Log4Jloggingconfiguration.



login-config.xml



JBosssecurityconfiguration(JBossSX).



DefaultconfigurationforJBoss'slegacyCMP1.1engine;contains

standardjaws.xml JDBC-to-SQLmappinginformationforvariousdatabases,defaultCMP



settings,loggingconfiguration,etc.

standardjboss.xml Defaultcontainerconfiguration.

standardjbosscmp- Sameasstandardjaws.xmlexceptthatitisusedforJBoss'sCMP2.0

jdbc.xml

engine.



21.2.3DeploymentinJBoss

ThedeploymentprocessinJBossisstraightforward.Ineach

configuration,JBossconstantlyscansaspecificdirectoryfor

changes:$JBOSS_HOME/server/config-name/deploy.This

directoryisgenerallyreferredtoinformallyasthedeploy

directory.

Youcancopytothisdirectory:

AnyJARlibrary(theclassesitcontainsareautomatically

addedtotheJBossclasspath)

AnEJBJAR

AWAR(WebApplicationaRrchive)

AnEAR(EnterpriseApplicationaRchive)

AnXMLfilecontainingJBossMBeandefinitions

Adirectoryendingin.jar,.war,or.earandcontaining

respectivelytheextractedcontentofanEJBJAR,aWAR,or

anEAR



Toredeployanyoftheabovefiles(JAR,WAR,EAR,XML,etc.),

simplyoverwriteitwithamorerecentversion.JBosswilldetect

thechangebycomparingthefiles'timestamps,undeploythe

previousfiles,anddeploytheirreplacements.Toredeploya

directory,updateitsmodificationtimestampbyusinga

command-lineutilitysuchastouch.Toundeployafile,just

removeitfromthedeploydirectory.



21.3AQuickLookatJBossInternals

SinceVersion3.0,JBosshasbeenbuiltaroundafewvery

powerfulconceptsthatallowuserstocustomizeandfine-tune

theirserversforveryspecificneeds,notlimitedtoJ2EE.This

flexibilityallowsJBosstobeusedinverydifferent

environments,rangingfromembeddedsystemstoverylarge

serverclusters.Thenextfewsectionscommentonsomeof

theseconceptsbriefly.



21.3.1MicrokernelArchitecture

JBossisbasedonamicrokerneldesigninwhichcomponents

canbepluggedatruntimetoextenditsbehavior.

ThisdesignfitsparticularlywellwiththeJ2EEplatform,whichis

essentiallyaservice-basedplatform.Theplatformcontains

servicesforpersistence,transactions,security,naming,

messaging,logging,andsoon.

Otherapplicationserversaregenerallybuiltasmonolithic

applicationscontainingallservicesoftheJ2EEplatformatall

times.JBosstakesaradicallydifferentapproach:eachofthe

servicesishot-deployedasacomponentrunningontopofa

verycompactcore,calledtheJBossServerSpine(FigureW-2).

Furthermore,usersareencouragedtoimplementtheirown

servicestorunontopofJBoss.



Consequently,theJBossapplicationserverisnotlimitedtoJ2EE

applications,andindeedisfrequentlyusedtobuildanykindof

applicationrequiringastrongandreliablebase.Forthisreason,the

JBosscoreisalsoknownastheWebOS.



Figure21-2.JBossServerSpinewithsomehotdeployedservices



JBossServerSpineitselfisbasedonSun'sJavaManagement

eXtensions(JMX)specification,makinganydeployed

componentautomaticallymanageableinastandardfashion.In

theJMXterminology,aservicedeployedinJBossiscalledana

managedbean(MBean).



MoreinformationabouttheJMXspecificationcanbefoundattheSun

website,http://java.sun.com/products/JavaManagement/.



21.3.2HotDeployment

SinceRelease2.0,JBosshasbeenfamousforbeingthefirst

J2EE-basedapplicationservertosupporthotdeploymentand

redeploymentofapplications(EJBJAR,WAR,andEAR),while

manyapplicationserversrequiredarestarttoupdatean



application.

ThankstoitsmicrokernelarchitectureandrevolutionaryJava

classloader,JBoss3.0andlaterreleasespushthislogicfurther.

Notonlycantheyhot-deployand-redeployapplications,but

theycanhot-(re)deployanyserviceandkeeptrackof

dependenciesbetweenservices.ThesefeaturesmakeJBoss

usableinverydemandingenvironmentssuchas

telecommunicationssystems.



21.3.3NetBoot

JBossisabletobootitselfandyourapplicationsfromany

networklocationjustbypointingtheJBossServerSpinetoa

simpleURL.Thisallowsyoutomanagetheentireconfiguration

ofaclusterofJBossnodesfromonecentralwebserver.This

impressiveflexibilitymakesdeploymentofnewserversvery

easy(Figure21-3).



Figure21-3.AJBossinstancebootstrappingfrom

threedistinctnetbootservers



JBoss'sbootstrapcodeisapproximately50K,whichmakesitsuitable

formanyembeddedsystems.



21.3.4DetachedInvokers

JBosscompletelydetachestheprotocolhandlersonwhich

invocationsarereceivedfromthetargetservicethateventually

servestherequests.Consequently,whenanewhandler(called

aninvokerinJBoss)foragivenprotocolisdeployedinJBoss,

allexistingservicesandapplicationscanautomaticallybe

reachedthroughthisnewinvocationtransport.Figure21-4

showsdetachedinvokers.

JBoss4.0currentlysupportsthefollowingkindsofinvokers:



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 21. JBoss Installation and Configuration

Tải bản đầy đủ ngay(0 tr)

×