· 一:jboss简介
jboss是一套可以基于j2ee框架的全套解决方案,他包括JBoss/Server,JBoss/spyderMQ, JBoss/Jaws,JBoss/Zola,JBoss/Zoap,JBoss/Castor,JBoss/Tomcat。这些产品可以非常合理的搭建基于j2ee框架的软件产品和软件工程。 虽然他的诞生才一年多,但是就像apache一样,他是完全公开源代码的,他是真正具有生命力的产品的他将像其他免费软件一样成为成功的Application server。
本文主要是介绍如何安装该软件产品,如何配置他与Tomcat的结合,如何通过Tomcat的Servlet调用Ejb。最终完成Apache+Tomcat+jboss的Web综合解决方案。我本人也是在上个星期天才刚刚认识他的,短短的5天我也只是大概的了解了他的功能和特点。对他的大部分功能不是十分清楚,如果我有时间我会把有关jboss的其他内容逐步介绍给大家,但不是现在。
好了现在开始我们的Apache+Tomcat+Jboss的旅程吧。
( 一)系统环境简介:
硬件平台:
PC 233 32M RAM 6GHand Disk
操作系统:
red head liunx 6.1 (由于jdk1.3的要求,必须使用6.1以上的版本,或者将glibc更新到2.1.2.11版本或更高。)
应用环境要求:
jdk1.3
jaxp1.0.1
Apache 3.1.2
Tomcat 3.2 beta 4 (jakarta-ant,jakarta-servletapi,jakarta-tomcat)
jBoss 2.0 BETA-PROD-PRE-05
interestEJB.tar.gz 测试EJB的源代码。
安装过程叙述如下:
假设当前目录是:/home/liling
准备工作如下:
mkdir tomcat
mkdir jboss
cp j2sdk-1_3_0-linux-rpm.sh /home/liling/.
cp jakarta-ant.tar /home/liling/tomcat/.
cp jakarta-servletapi.tar /home/liling/tomcat/.
cp jakarta-tomcat.ta /home/liling/tomcat/.
cp jboss-cvs-sources.zip /home/liling/jboss
cp interestEJB.tar.gz /home/liling/jboss
一:安装jdk1.3
sh j2sdk-1_3_0-linux-rpm.sh
rpm -iv j2sdk-1_3_0-linux-rpm
将看到/usr/java/jdk1.3目录
JAVA_HOME = /usr/java/jdk1.3
PATH = $PATH:/usr/java/jdk1.3/bin
export JAVA_HOME
export PATH
jar -xvf jaxp-1_0_1.zip
将看到在当前目录生成jaxp1.0.1目录
CLASSPATH=$CLASSPAHT:/home/liling/jaxp-1.0.1/jaxp.jar:/home/liling/jaxp-1.0.1/parser.jar
export CLASSPATH
一:安装Tomcat。
Tomcat的安装过程包括安装ant和servletapi的过程
首先将Tomcat的jakarta-tomcat.tar.gz解包。然后读取README的过程安装。
cd /home/liling/tomcat
gz -d jakarta-tomcat.tar.gz
tar -xvf jakarta-tomcat.tar
cd jakarta-tomcat
vi README
将看到如下安装过程
cd $JAKARTA_HOME/jakarta-ant
./bootstrap.sh <-- Unix
This should result in the creation of a file "ant.jar" in the "lib"
subdirectory, which will be used when building Watchdog.
cd $JAKARTA_HOME/jakarta-servletapi
./build.sh dist <-- Unix
This should result in the creation of a file "servlet.jar" in the "lib"
subdirectory, which will be used when building Watchdog.
cd $JAKARTA_HOME/jakarta-tomcat
./build.sh <-- Unix
按照上面的过程完成安装将会出现下面的目录:
./build
./build/ant
./build/serletapi
./build/tomcat
./dist
./dist/servletapi/lib
在./build/tomcat/bin/startup.sh和./build/tomcat/bin/shutdown.sh 用于启动和停止tomcat。
· 二:安装jboss。
配置TOMCAT_HOME环境变量:
TOMCAT_HOME=/home/liling/tomcat/build/tomcat
export TOMCAT_HOME
cd /home/liling/jboss
jar -xvf jboss-cvs-sources.zip
cd src
cd build
./build.sh
· 三:启动jboss:
cd /home/liling/jboss/dist/bin/
/run.sh
· 四:配置Tomcat与Jboss
cd /home/liling/jboss/dist/conf
vi jboss.conf
会看到如下提示:
<!-- -- Uncomment this to add "Integrated Stack (fast) Tomcat support".
-- This service allows you to integrate the stack of Tomcat and jboss.
-- Invocations are not going through network but pass native pointers resulting in dramatic speed increases.
-- This service allows the J2EE deployer to add and remove Tomcat contexts dynamically
-- through JMX for you and in effect deploy EARs. Note that tomcat´s server.xml file will not be processed:
-- you can only use JMX to add contexts. Use the J2EE deployer to deploy full EARs on this stack
-- Be sure to set your ´TOMCAT_HOME´ environment variable before starting JBoss.
--
-- The ARG tag is the port to run tomcat on.
--
-- MLET CODE = "org.jboss.tomcat.EmbeddedTomcatService" ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/">
-- ARG TYPE="int" VALUE=8080>
-- /MLET>
-->
在上面的提示下添加下面的内容
< MLET CODE = "org.jboss.tomcat.EmbeddedTomcatService" ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/" >
< ARG TYPE="int" VALUE=8088 >
< /MLET >
还会看到下面的提示:
< !--
-- Uncomment this to add "Stand-alone Stack Tomcat support".
-- This means that JSP and Servlets will work with EJB in different stacks and
-- communicate through network invocation. If you benchmark j2ee please use "integrated stack".
-- Also note that you cannot use the J2EE deployer with Tomcat in this configuration.
-- Be sure to set your ´TOMCAT_HOME´ environment variable before starting JBoss.
-- Note: this reads the server.xml configuration file of Tomcat, you can´t use the j2ee deployer
--
-- MLET CODE = "org.jboss.tomcat.TomcatService"
ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/" >
-- /MLET >
-- >
在上面的提示下添加如下内容:
< MLET CODE = "org.jboss.tomcat.EmbeddedTomcatService" ARCHIVE="jboss.jar" CODEBASE="../../lib/ext/" >
< ARG TYPE="int" VALUE=8088 >
< /MLET >
现在在启动jboss可以看到如下提示:
[EmbeddedTomcat] Starting
[EmbeddedTomcat] Testing if Tomcat is present....
[EmbeddedTomcat] OK
[EmbeddedTomcat] ContextManager: Adding context Ctx( )
[EmbeddedTomcat] path="" :jsp: init
[EmbeddedTomcat] PoolTcpConnector: Starting HttpConnectionHandler on 8088
[EmbeddedTomcat] Started
这表示Integrated Stack (fast) Tomcat support已经启动成功。
[Tomcat] Initializing
[Tomcat] Initialized
[Tomcat] Starting
[Tomcat] Testing if Tomcat is present....
[Tomcat] OK
[Tomcat] Starting Tomcat...
[Tomcat] Starting tomcat. Check logs/tomcat.log for error messages
2000-11-21 08:26:02 - ContextManager: Adding context Ctx( /examples )
2000-11-21 08:26:02 - ContextManager: Adding context Ctx( /admin )
2000-11-21 08:26:02 - ContextManager: Adding context Ctx( )
2000-11-21 08:26:02 - ContextManager: Adding context Ctx( /test )
2000-11-21 08:26:04 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
[Tomcat] Started
jboss与tomcat的使用经验总结
最新推荐文章于 2019-06-18 21:36:04 发布