- 浏览: 118971 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
myprincejava:
请问博主?都是通过ajp来分发的,我通过你这个配置怎么imag ...
[问题已解决]stickysession=JSESSIONID 无效.. 这可怎么办啊. -
peterwei:
<div class="quote_title ...
面试时应该问什么? -
dotjar:
我也是有些郁闷,辞职成功了,但是不想投简历,不想找工作
面试时应该问什么? -
yinjj472:
应该是面试官想了解一下你对系统的了解程度,从这方面可以看出你对 ...
面试时应该问什么? -
happyforever82:
没要关注 自己Up 求评价`~~
面试时应该问什么?
http://download.oracle.com/docs/cd/B25221_04/web.1013/b14433/startclas.htm
2 Developing Startup and Shutdown Classes
This chapter provides guidelines on developing startup and shutdown classes that are called after OC4J initializes or before OC4J terminates.
Startup classes can start services and perform functions after OC4J initiates; shutdown classes can terminate these services and perform functions before OC4J terminates. The oc4j.jar
must be in the Java CLASSPATH
when you compile these classes.
OC4J deploys and executes the OC4J startup and shutdown classes based on configuration of these classes in the server.xml
file.
Developing Startup Classes
Startup classes are executed only once after OC4J initializes. They are not re-executed every time the server.xml
file is touched. Your startup class implements the oracle.j2ee.server.OC4JStartup
interface that contains two methods—preDeploy
and postDeploy
—in which you can implement code for starting services or performing other initialization routines.
-
The
preDeploy
method executes before any OC4J application initialization. -
The
postDeploy
method executes after all OC4J applications initialize.
Each method requires two arguments—a Hashtable
that is populated from the configuration and a JNDI Context
to which you can bind to process values contained within the Context
. Both methods return a String
, which is currently ignored.
Note: It is strongly recommended that you give your startup class a public, no-argument constructor. Otherwise, java.lang.IllegalAccessException may be thrown when OC4J attempts to invoke a member method of this class. |
Once created, you must configure the startup class within the <startup-classes>
element in the server.xml
file. You access this file by selecting Advanced Properties on the OC4J home page. Each OC4JStartup
class is defined in a single <startup-class>
element within the <startup-classes>
element. Each <startup-class>
defines the following:
-
The name of the class that implements the
oracle.j2ee.server.OC4JStartup
interface. -
Whether a failure is fatal. If considered fatal, then when an exception is thrown, OC4J logs the exception and exits. If not considered fatal, then OC4J logs the exception and continues. Default is not fatal.
-
The order of execution where each startup class receives an integer number that designates in what order the classes are executed.
-
The initialization parameters that contain key-value pairs, of type
String
, which OC4J takes, which are provided within the inputHashtable
argument. The names for the key-value pairs must be unique, as JNDI is used to bind each value to its name.
In the <init-library>
element in the server.xml
file, configure the directory where the startup class resides, or the directory and JAR filename where the class is archived. The path
attribute can be fully-qualified or relative to j2ee/home/config
.
The configuration for the TestStartup
class is contained within a <startup-class>
element in the server.xml
file. The configuration defines the following:
-
The
failure-is-fatal
attribute is true, so that an exception causes OC4J to exit. -
The
execution-order
is 0, so that this is the first startup class to execute. -
Two initialization key-value pairs defined, of type
String
, which will be populated in theHashtable
, of the following:"oracle.test.startup" "true" "startup.oracle.year" "2002"
<!---->
Note:
The names of the key-value pairs must be unique in all startup and shutdown classes, as JNDI binds the name to its value.
Add the following notation to the server.xml
file to define the TestStartup
class:
<startup-classes> <startup-class classname="TestStartup" failure-is-fatal="true"> <execution-order>0</execution-order> <init-param> <param-name>oracle.test.startup</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>startup.oracle.year</param-name> <param-value>2002</param-value> </init-param> </startup-class> </startup-classes>
The container provides the two initialization kay-value pairs within the input Hashtable
parameter to the startup class.
The following example shows TestStartup
, which implements the oracle.j2ee.server.OC4JStartup
interface. The preDeploy
method retrieves the key-value pairs from the Hashtable
and prints them out. The postDeploy
method is a null method. The oc4j.jar
must be in the Java CLASSPATH
when you compile TestStartup
.
import oracle.j2ee.server.OC4JStartup; import javax.naming.*; import java.util.*; public class TestStartup implements OC4JStartup { //public, no-argument constructor public TestStartup() { } public String preDeploy(Hashtable args, Context context) throws Exception { // bind each argument using its name Enumeration keys = args.keys(); while(keys.hasMoreElements()) { String key = (String)keys.nextElement(); String value = (String)args.get(key); System.out.println("prop: " + key + " value: " + args.get(key)); context.bind(key, value); } return "ok"; } public String postDeploy(Hashtable args, Context context) throws Exception { return null; } }
Assuming that the TestStartup
class is archived in "../app1/startup.jar"
, modify the <init-library>
element in the server.xml
file as follows:
<init-library path="../app1/startup.jar" />
When you start OC4J, the preDeploy
method is executed before any application is initialized. OC4J populates the JNDI context with the values from the Hashtable
. If TestStartup
throws an exception, then OC4J exits since the failure-is-fatal
attribute was set to TRUE
.
Developing Shutdown Classes
Shutdown classes are executed before OC4J terminates. Your shutdown class implements the oracle.j2ee.server.OC4JShutdown
interface that contains two methods—preUndeploy
and postUndeploy
—in which you can implement code for shutting down services or perform other termination routines.
-
The
preUndeploy
method executes before any OC4J application terminates. -
The
postUndeploy
method executes after all OC4J applications terminate.
Each method requires two arguments—a Hashtable
that is populated from the configuration and a JNDI Context
to which you can bind to process values contained within the Context
.
Note: It is strongly recommended that you give your shutdown class a public, no-argument constructor. Otherwise, java.lang.IllegalAccessException may be thrown when OC4J attempts to invoke a member method of this class. |
The implementation and configuration is identical to the shutdown classes as described in "Developing Startup Classes" with the exception that the configuration is defined within the <shutdown-classes>
and <shutdown-class>
elements and there is no failure-is-fatal
attribute. Thus, the configuration for a TestShutdown
class would be as follows:
<shutdown-classes> <shutdown-class classname="TestShutdown"> <execution-order>0</execution-order> <init-param> <param-name>oracle.test.shutdown</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>shutdown.oracle.year</param-name> <param-value>2002</param-value> </init-param> </shutdown-class> </shutdown-classes>
Assuming that the TestShutdown
class is archived in "../app1/shutdown.jar"
, add another <init-library>
element in the server.xml
file as follows:
<init-library path="../app1/shutdown.jar" />
发表评论
-
在普通用户下运行apache2
2009-12-02 13:18 2060hi, 我们这里没办法装solaris-64的服 ... -
spring2.5.6 + hibernate3.3.1.GA的项目在jboss4及5下 nosuchmethod异常
2009-10-05 10:58 1319NoSuchMethodException: org.hibe ... -
发现tomcat6.0.20布署的一个变化.
2009-09-18 09:06 1024以前tomcat的发布虚拟目录,起作用的是 conf/Cata ... -
linux下启动oracle要点
2009-08-15 10:46 975使用oracle账号登录。 编辑 .bash_profile ... -
配置dns服务器时,debug
2009-07-22 15:47 863今天用 ubuntu9 + bind9装 dns服务器 写错 ... -
apache,rewrite + proxy
2009-07-20 15:23 842AddType image/x-icon .ico < ... -
将个性化数据保存到其它位置
2009-07-19 18:05 778namespace Wingtip.Providers { ... -
完整的apache2配置. [虚拟主机,rewrite二级域名,proxy转发]
2009-07-14 16:56 3405<VirtualHost *> ... -
Can Jetty Hot Deploy?
2009-06-02 17:12 1765Jetty is fully hot deployable, ... -
[问题已解决]stickysession=JSESSIONID 无效.. 这可怎么办啊.
2009-04-13 20:02 5620这是 apache部分的配置 <Proxy ba ... -
apache2.2 tomcat5.5 virtualhost load balance
2009-04-12 01:34 1036LoadModule proxy_module modu ... -
oc4j thread问题
2009-04-09 23:06 847在使用oc4j的datasource时可能引发线程问题. ... -
有多个IP的机器上, 将某个tomcat绑定到指定IP
2009-04-05 16:24 2328打开 conf/server.xml 在 <Conn ... -
glassfish v2.1 安装
2009-04-03 14:05 2375glassfish v2.1发布了,看[官方介绍,修正了500 ...
相关推荐
oc4j资料包,供大家使用
特转载如下:当然你也可以参考OC4J自带的readme.txt。下面这篇文章也基本上是对oc4j手册的简单翻译。官方提供的下载OC4J现在已经是10g-10.1.3.3了,支持jdk5.0,并且可以使用图形化来实现配置。
oracle下的oc4j配置 入门配置
一个全面的OC4J配置文件 一个全面的OC4J配置文件
oracle 文档 oc4j esb
如何配置OC4J环境及安装指南 如何配置OC4J环境及安装指南
OC4J里配置数据源 OC4J里配置数据源 OC4J里配置数据源
[Oracle.Developer.Suite.10g]中OC4J的常用配置
这个文档是对oc4j配置的全部过程,如果细看,肯定可以搞定oc4j的搭建的!
OC4J的安装配置部署,绝对原创,很详细的配置,包括一些可能出现问题的解决办法。
oc4j jar包 经测试过可用 xercesImpl-2.9.1.jar xml-apis-1.3.04.jar
大家來看看這個服務器
还在为找不到jar文件烦心吗,不用了到我空间来有你想要的,持续更新。。。 oc4j-clapi.jar
获取数据是加载动画
NULL 博文链接:https://sambafeng.iteye.com/blog/777777
managers who want to understand the security features of OC4J. It discusses the Oracle Application Server Java Authentication and Authorization Service (JAAS) Provider in detail, as well as discussing...
记载GIF动画
oc宝典 oc宝典 oc宝典 oc宝典 oc宝典 oc宝典oc宝典 oc宝典 oc宝典
OC4J服务器配置手顺.xls 自己写的,目前项目中应用 实践中的结晶
linux,ias,oracle10g,oc4j,linux,ias,oracle10g,oc4j