分享
 
 
 

新兴开放源码J2EE应用平台

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

新兴开放源码J2EE应用平台

注:这是两年前写的了,现在jbuilder已经用2005了,JBoss也用4。x了,mysql也用5.0了,新的功能

所能实现的功能毫无疑问不止这些,有时间再补上!

一.平台架构描述

本平台由三部分组成,开发环境、应用服务器环境和数据存储环境;

1. J2EE开发环境

JBuilder 7 企业版配合JBoss 3.0.0,开发环境配置如下:

a) 配置数据库连接驱动,我们使用MySql, 因此需要配置mysql_odbc或mysql_jdbc,其中如果使用jdbc的话,需要建立新的库,此库包含了mysql_jdbc驱动,并把该库加入到项目库中;

b) 配置JBoss的JBuider 7插件(配合插图):

i. 首先把插件打包文件拷贝到JBuider 7/lib/ext目录中;

ii. 启动JBuilder, 在工具菜单中选择配置服务器;

iii. 从服务器列表中选择JBoss 3x;

iv. 然后选中“启用服务器”复选框;

v. 选择JBoss的安装目录,此时切换到“定制页”;

vi. 选择JBoss的起始目录和工作目录,最后确认提交;

vii. 并重启JBuilder,在项目属性里配置自己需要的服务器:其中,运行时服务器为Tomcat 4.0,项目服务器为不同模块服务对应不同的服务器;

2. J2EE应用服务器

应用服务器有三个模块组成:JBoss 3.0.0, Tomcat 4.0.3, Apache 2.0.4;

c) JBoss主要提供EJB等企业级组件和其他相关服务,其配置如下:

i. 首先,要配置java 1.4.1平台,即设置Java_home和classpath;

ii. 其次,解压JBoss(内嵌Tomcat 4)到特定文件夹;

d) 配置阿帕奇到tomcat的连接:

i. 修改apache的配置文件httpd.conf

Listen *:80(在所有地址上监听80端口)

ServerName Apache

DirectoryIndex index.html index.html.var index.html.en index.jsp(添加自己需要的目录起始文件名)

DefaultType application/octet-stream(使服务器可以处多种类型的文档)

AddDefaultCharset GB2312(自己需要的响应缺省字符集)

ServerName Apache

DirectoryIndex index.php index.html index.htm index.shtml index.html.en index.jsp(目录起始文件名)

ErrorLog logs/dummy-host.example.com-error_log

CustomLog logs/dummy-host.example.com-access_log common

(虚拟主机)

Include D:/Apache2/Apache2/conf/JK//mod_jk.conf(包含mod_jk的配置文件)

ii.mod_jk.conf的内容如下实例

LoadModule jk_module D:/Apache2/Apache2/conf/JK//mod_jk.dll

JkLogLevel info

JkOptions +ForwardKeySize +ForwardURICompat

JkWorkersFile D:/Apache2/Apache2/conf/JK/workers.properties

JkLogFile D:/Apache2/Apache2/conf/JK//mod_jk.log

JkMount /*.jsp ajp13

JkMount /servlet/* ajp13

Alias /test "E:/Room/testonline2.5/defaultroot"

Options Indexes FollowSymLinks MultiViews IncludesNoExec

AddOutputFilter Includes html

AllowOverride None

Order allow,deny

Allow from all

JkMount /test/servlet/* ajp13

JkMount /test/*.jsp ajp13

AllowOverride None

deny from all

Alias /account "E:/Room/wsopt/account"

Options Indexes FollowSymLinks MultiViews IncludesNoExec

AddOutputFilter Includes html

AllowOverride None

Order allow,deny

Allow from all

JkMount /account/* ajp13

JkMount /account/*.jsp ajp13

AllowOverride None

deny from all

iii.ajp13工作的配置文件workers.properties描述如下:

workers.tomcat.home=%tomcat_home%

workers.java.home=%java_home%

ps=

worker.list=ajp13

worker.ajp13.port=8009

worker.ajp13.host=localhost

worker.ajp13.type=ajp13

worker.ajp13.1bfactor=1

参考:

# workers.properties -

#

# This file provides jk derived plugins with the needed information to

# connect to the different tomcat workers. Note that the distributed

# version of this file requires modification before it is usable by a

# plugin.

#

# As a general note, the characters $( and ) are used internally to define

# macros. Do not use them in your own configuration!!!

#

# Whenever you see a set of lines such as:

# x=value

# y=$(x)\something

#

# the final value for y will be value\something

#

# Normaly all you will need to do is un-comment and modify the first three

# properties, i.e. workers.tomcat_home, workers.java_home and ps.

# Most of the configuration is derived from these.

#

# When you are done updating workers.tomcat_home, workers.java_home and ps

# you should have 3 workers configured:

#

# - An ajp12 worker that connects to localhost:8007

# - An ajp13 worker that connects to localhost:8009

# - A jni inprocess worker.

# - A load balancer worker

#

# However by default the plugins will only use the ajp12 worker. To have

# the plugins use other workers you should modify the worker.list property.

#

#

# OPTIONS ( very important for jni mode )

#

# workers.tomcat_home should point to the location where you

# installed tomcat. This is where you have your conf, webapps and lib

# directories.

#

workers.tomcat_home=C:/Apache Tomcat 4.0

#

# workers.java_home should point to your Java installation. Normally

# you should have a bin and lib directories beneath it.

#

workers.java_home=c:/j2se

#

# You should configure your environment slash... ps=\ on NT and / on UNIX

# and maybe something different elsewhere.

#

ps=

#

#------ ADVANCED MODE ------------------------------------------------

#---------------------------------------------------------------------

#

#

#------ DEFAULT worket list ------------------------------------------

#---------------------------------------------------------------------

#

#

# The workers that your plugins should create and work with

#

# Add 'inprocess' if you want JNI connector

worker.list=ajp13,ajp12

# , inprocess

#

#------ DEFAULT ajp12 WORKER DEFINITION ------------------------------

#---------------------------------------------------------------------

#

#

# Defining a worker named ajp12 and of type ajp12

# Note that the name and the type do not have to match.

#

worker.ajp12.port=8007

worker.ajp12.host=localhost

worker.ajp12.type=ajp12

#

# Specifies the load balance factor when used with

# a load balancing worker.

# Note:

# ---- lbfactor must be 0

# ---- Low lbfactor means less work done by the worker.

worker.ajp12.lbfactor=1

#

#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------

#---------------------------------------------------------------------

#

#

# Defining a worker named ajp13 and of type ajp13

# Note that the name and the type do not have to match.

#

worker.ajp13.port=8009

worker.ajp13.host=localhost

worker.ajp13.type=ajp13

#

# Specifies the load balance factor when used with

# a load balancing worker.

# Note:

# ---- lbfactor must be 0

# ---- Low lbfactor means less work done by the worker.

worker.ajp13.lbfactor=1

#

# Specify the size of the open connection cache.

#worker.ajp13.cachesize

#

#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------

#---------------------------------------------------------------------

#

#

# The loadbalancer (type lb) workers perform wighted round-robin

# load balancing with sticky sessions.

# Note:

# ---- If a worker dies, the load balancer will check its state

# once in a while. Until then all work is redirected to peer

# workers.

worker.loadbalancer.type=lb

worker.loadbalancer.balanced_workers=ajp13,ajp12

#

#------ DEFAULT JNI WORKER DEFINITION---------------------------------

#---------------------------------------------------------------------

#

#

# Defining a worker named inprocess and of type jni

# Note that the name and the type do not have to match.

#

worker.inprocess.type=jni

#

#------ CLASSPATH DEFINITION -----------------------------------------

#---------------------------------------------------------------------

#

#

# Additional class path components.

#

worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar

#

# Setting the command line for tomcat.

# Note: The cmd_line string may not contain spaces.

#

worker.inprocess.cmd_line=start

# Not needed, but can be customized.

#worker.inprocess.cmd_line=-config

#worker.inprocess.cmd_line=$(workers.tomcat_home)$(ps)conf$(ps)server.xml

#worker.inprocess.cmd_line=-home

#worker.inprocess.cmd_line=$(workers.tomcat_home)

#

# The JVM that we are about to use

#

# This is for Java2

#

# Windows

worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)client$(ps)jvm.dll

# IBM JDK1.3

#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so

# Unix - Sun VM or blackdown

#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)client$(ps)libjvm.so

#

# And this is for jdk1.1.X

#

#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll

#

# Setting the place for the stdout and stderr of tomcat

#

worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout

worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr

#

# Setting the tomcat.home Java property

#

#worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)

#

# Java system properties

#

# worker.inprocess.sysprops=java.compiler=NONE

# worker.inprocess.sysprops=myprop=mypropvalue

#

# Additional path components.

#

# worker.inprocess.ld_path=d:$(ps)SQLLIB$(ps)bin

#

iv.在tomcat的主配置文件server.xml中加入以下内容:

在中加入ajp13服务的请求监听器:

在中加入ajp13主机的监听器:

v. 另外要检查tomcat是否启动了ajp13服务,如果没有启动,要在tomcat主配置文件中加入启动该服务的描述:

iii.注意:apache的要与tomcat的一一对应。

3. 数据存储环境

数据存储环境采用MySQL, 该数据库具有速度快,sql标准等特点。可以采用两种方式与之建立连接关系,即odbc和jdbc,前者是比较成熟的,而jdbc却会导致汉字乱码,原因是该数据库没有默认的字符集,仅在应用服务器上建立odbc数据源是可以接受的。

4. 该平台所需的文件列表如下:

a) mod_jk.dll

b) MyODBC-3.51.04.exe

c) j2sdk-1_4_1-windows-i586.exe

d) apache_2.0.40-win32-x86-no_ssl.exe

e) mysql-max-3.23.52-win.zip

f) mysqlgui-win32-static-1.7.5-2.zip

g) mysql-connector-java-2.0.14.zip

h) JBossEntWizard3x_v2.2.1_JBuilder7.zip

i) jboss-3.0.0_tomcat-4.0.3.zip

二.平台应用程序部署

1. Web应用程序部署

a) Web应用程序打包(.war)后放入%jboss_home%/server/default/deploy下,系统将能够自动部署,虚拟目录名就是包名;

b) 把打包文件解压到一特定文件夹,在阿帕奇的主配置文件中加入一个新的、别名与jboss的虚拟目录相同的虚拟目录(真实目录指向解压后的特定文件夹)

2. 企业应用程序部署

a) 在JBuilder中,同一个项目下建立ejb应用程序;

b) 配置ejb的jndi名;

c) 配置web应用程序的ejb属性,即ejb-ref-name, ejb-ref-link, ejb-home, ejb-remote;

d) 新建一企业应用程序(.ear),并编译之;

e) 部署企业应用程序(.ear)。

f) 这时,web应用程序的上下文为根。

三.实例程序:JBossTest, 一个登录的演示。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有