新兴开放源码J2EE应用平台

来源: 作者: 2007-11-21 出处:pcdog.com

access  apache  j2se  java  jsp  

  新兴开放源码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.confListen *:80(在所有地址上监听80端口)ServerName ApacheDirectoryIndex 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 +ForwardURICompatJkWorkersFile D:/Apache2/Apache2/conf/JK/workers.propertiesJkLogFile D:/Apache2/Apache2/conf/JK//mod_jk.log JkMount /*.jsp ajp13JkMount /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/* ajp13JkMount /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/* ajp13JkMount /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=ajp13worker.ajp13.port=8009worker.ajp13.host=localhostworker.ajp13.type=ajp13worker.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) omething## the final value for y will be value omething## 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=8007worker.ajp12.host=localhostworker.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=8009worker.ajp13.host=localhostworker.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=lbworker.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## Windowsworker.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)b

上一篇:详解J2EE的13种核心技术
下一篇:扬扬的J2EE学习笔记(二)J2EE的客户端/服务器