1. Introduction to this section This chapter mainly introduces JBoss (free EJB servers), and how to install JBoss, build your first EJB and client. About what is EJB, and how to develop, etc. These have many books on EJBs, which will not be explained here. The description information is running on the Windows platform, of course you can apply on other supported platforms (eg Linux, etc.).
2. About JBoss JBOSS support EJB 1.1 and EJB 2.0 specification, it is a container and server that manages EJB. Similar to Sun's J2SDK Enterprise Edition (J2EE), JBoss Core Services is just a EJB server. JBoss does not include a Web container for Serverlers / JSP Page, of course, can be used with Tomcat or Jetty. JBoss needs a relatively small memory and hard disk space. You can run well on 64M memory and a few megabytes. Sun's J2EE requires a minimum memory of 128m, and 31M hard disk space. JBoss start speed is 10 times faster than J2EE. Moreover, it can embed the SQL database server for persistence Bean processing, which will start automatically when startup. (J2EE loads separate cloudscape sql server). One of the very good features of JBoss can "hot" deployment, "hot" deployment means that in deploying bean just simple copying bean JAR files to deployment path, if Bean has been loaded, JBoss uninstall it, then load a new version BEAN. If you need more JBoss features, you can view websites about the JBoss Forum. If you need to support, you can pay the JBossGroup LLC if you need it. This chapter step by step to help you start distributed with JBoss: how to create a simple bean, and how to deploy and test on the JBoss server. 3, the essential condition JBoss is written in pure Java, requiring a Java system and JDK1.3 compatible. In order to be cheap and run, you need Ant 1.4 or above. How to get and install it in the next section. Of course, you have to develop EJB foundations.
4. Installing Ant We have seen this name on many books and web pages. What is it used? Ant is a Java-based build tool. There is now a lot of Build tools, such as make, gnumake, nmake, jam, etc., and these tools are very excellent. Ant is a cross-platform Build tool. The reason that Ant can cross the platform because Ant no longer needs you to write shell commands, Ant's profile is XML-based task tree, which allows you to run a variety of tasks, the task run is the implementation of a specific task interface Objects are completed. There are two versions of Binary and Source to download the latest version 1.5.2. Binary version: http://ant.apache.org/old-releases/v1.5.2/binaries/source version: http://ant.apache.org/old-releases/v1.5.2/source/ About these two The difference between the version can be referred to http://ant.apache.org/. If you can't download it, you can't ask me QQ: 182244794, Email: Amaryllis@163.net. After downloading Ant, you decompressed files, all files will be placed under an Apache-Ant-1.5.2 path. Ant documents are released in a DOCS / Manual directory, you can open web DOCS / Manual / INDEX.html to browse about the contents of the Ant document. I use the Windows system released under the C: /Apache-ant-1.5.2 path. 1) Set an ANT_HOME environment variable to point to your Ant directory. 2) Set the Java_Home environment variable to point to your JDK directory. 3) Add% ANT_HOME% / bin to the PATH environment variable. 4) When you do not run Ant without any parameters, Ant will find a file called build.xml in the current directory. If not found, there will be the following tips: buildfile: build.xml does not exist! Build failed In order to test whether the Ant installation is successful, I built a new build.xml file, put it in the current directory% Ant_Home% / Samples. Build.xml content is as follows:
target>
echo>
target>
javac>
target>
Target>
project>
Run Ant display results as follows:
c: /apache-ant-1.5.2/samples> antBuildfile: build.xmlInit: AsimpleHelloObject: [echo] Wrote AsimpleHelloObject.javacompile: [javac] Compiling 1 source file to c: /apache-ant-1.5.2/samplesrun: [java] asimplehelloObject.main Was called [echo] Ant Appers to be successfully installedbuilde surcess processfultotal Time: 11 seconds.
The ANT you installed here is successful. If the following warning Warning:.. JAVA_HOME environment variable is not set If build fails because sun * classes could not be found you will need to set the JAVA_HOME environment variable to the installation directory of java that you need to set the JAVA_HOME environment specified you. Install the JDK directory. How to use all kinds of commands in Ant, I will write "ANT Document" introduced later.
5, install JBoss 1) Before installing and running JBOSS, you must check if JDK is installed, you need to set the JDK directory in the PATH environment. 2) Download the JBoss server. JBoss is a compressed file that you can download the latest version. In order to support Web Server, I use the Windows platform, so I downloaded JBoss3.0.6-Tomcat4.1.18. You can download it directly from http://prdownloads.sourceforge.net/jboss/. If you are using a UNIX / LUNIX platform, you can also download the appropriate JBoss server from this URL. 3), install (1) Lunix / UNIX installation A, you downloaded the JBoss server L for UNIX / LUNIX version to extract files to a temporary directory with JDK JAR tools. B. Set JBoss_Dist points to the top directory after the JBoss decompressed. c, then to this directory CD JBoss_Dist / bin sh run.shl after running, display information is as follows: BASH-2.04 $ / bin / sh run.shjboss_classpath =: run.jar: ../ lib / crimson.jarjboss.home = /TMP/JBoss-2.2.2using jaas loginconfig: file: /tmp/jboss-2.2.2/conf/default/AUTH.CONFUSING Configuration "default" [info] Java Version: 1.3.1, Sun Microsystems Inc. [INFO] Java VM: Java HotSpot (TM) Server VM 1.3.1-b24, Sun Microsystems Inc. [Info] System: Linux 2.2.16-22, i386 [Shutdown] Shutdown hook added [Service Control] Registered with server [Service Control] Initializing 24 MBeans ... [Service Control] Started 24 Services [Default] JBoss 2.2.2 Started In 0m: 7S (2) WINDOWS installation A, download jboss3.0.6-tomcat4.1.18.zip, then use WinZip to unfained to one Directory, I decompressed in c: /jboss3.0.6-tomcat4.1.18 directory B, basically no configuration after decompression, use the Run.bat command under the bin directory. C, run the run.bat command, please see if there is any abnormality in the background. D. If you run successfully, please visit http: // localhost: 8083, a blank page will appear. Access http: // localhost: 8080 will appear in Tomcat, if Apache Tomcat / 4.1.12 - HTTP Status 500 - No Context Configured to Process this Request error, this is normal because you have not yet released. EAR or .war application. Of course, jboss-3.2.orc3_tomcat-4.1.18.zip does not have such a problem, because the web test file WebTest.ear visits http: // localhost: 8082 you can see in directory server / default / deploy / JBoss boots service. You can run http: // localhost: 8080 / jmx-console will appear related pages.
(3) Window NT and 2000 Supplements For NT and Win2K systems If you want to install NT or Win2K service, you can add JBOSS to the system service, avoid you to run the run.bat command each time you need to run the run.bat command, just when the system is Automatically start the JBoss server when starting. A, first you need to download the JavaService.exe file. l Edit a batch file, your named file name, deposit the same directory as JavaService.exe.
I named jboss_tomcat_service.bat This file is @echo offecho -------- echo usage:% 0 jdk_home tomcat_home (classic / hotspot / server) echo note: you may not use spaces in the path names. If you Know howecho to fix this, please tell me.echo jdk 1.4 does not com with hotpot server by default, you mustecho install this seperately if you wish to use it.echo example:% 0 ../jdk ../jboss30 hotspot echo - ------- IF "% 1" == "Uninstall" goto uninstall if "% 1" == "-uninstall" goto uninstall if "% 1" == "" goto usage if "% 2" == "" GOTO USAGE IF "% 3" == "" goto usage if "% 1" == "-help" goto usage if "% 1" == "-" GOTO USAGE IF "% 1" == "/ ? "goto usage: installjavaservice.exe -install jboss306% 1 / jre / bin /% 3 / jvm.dll -djava.class.path =% 1 / lib / Tools.jar;% 2 / bin / run.jar -start Org.jboss.main -stop org.jboss.main -Method systemExit -Or% 2 / bin / out.txt -ouse% 2 / bin goto EOF: Uninstall javaservice.exe -uninstall jboss306goto EOF: usage echo ----- --- To Install JBoss 3.0.6 Do Echo usage:% 0 JDK_HOME JBOSS_HOME (Classic / Hotspot / Server) echo NOTE:. You MAY NOT use spaces in the path names If you know how echo to fix this, please tell me echo JDK 1.4 does not come with hotpot server by default, you must echo install this seperately if you wish. To use it. echo example:% 0 ../jdk ../jboss30 Hotspot Echo -------- Echo -------- To Uninstall JBoss 3.0.6 Do Echo usage:% 0 Uninstall echo -------- Goto EOF: EOF E, run the following command jboss_tomcat_service c: /j2sdk1.4.0_02 c: /jboss-3.0.0.0.0.02, C: /J2SDK1.4.0_02 is Java installation Directory c: /jboss-3.0.6_tomcat-4.1.18 is a directory installed by jboss,