- 浏览: 121201 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
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 2097hi, 我们这里没办法装solaris-64的服 ... -
spring2.5.6 + hibernate3.3.1.GA的项目在jboss4及5下 nosuchmethod异常
2009-10-05 10:58 1354NoSuchMethodException: org.hibe ... -
发现tomcat6.0.20布署的一个变化.
2009-09-18 09:06 1055以前tomcat的发布虚拟目录,起作用的是 conf/Cata ... -
linux下启动oracle要点
2009-08-15 10:46 1006使用oracle账号登录。 编辑 .bash_profile ... -
配置dns服务器时,debug
2009-07-22 15:47 903今天用 ubuntu9 + bind9装 dns服务器 写错 ... -
apache,rewrite + proxy
2009-07-20 15:23 889AddType image/x-icon .ico < ... -
将个性化数据保存到其它位置
2009-07-19 18:05 805namespace Wingtip.Providers { ... -
完整的apache2配置. [虚拟主机,rewrite二级域名,proxy转发]
2009-07-14 16:56 3445<VirtualHost *> ... -
Can Jetty Hot Deploy?
2009-06-02 17:12 1790Jetty is fully hot deployable, ... -
[问题已解决]stickysession=JSESSIONID 无效.. 这可怎么办啊.
2009-04-13 20:02 5654这是 apache部分的配置 <Proxy ba ... -
apache2.2 tomcat5.5 virtualhost load balance
2009-04-12 01:34 1066LoadModule proxy_module modu ... -
oc4j thread问题
2009-04-09 23:06 871在使用oc4j的datasource时可能引发线程问题. ... -
有多个IP的机器上, 将某个tomcat绑定到指定IP
2009-04-05 16:24 2359打开 conf/server.xml 在 <Conn ... -
glassfish v2.1 安装
2009-04-03 14:05 2404glassfish v2.1发布了,看[官方介绍,修正了500 ...
相关推荐
### Oracle 下的 OC4J 配置入门指南 ...通过以上步骤,您可以顺利地在 Oracle 环境下完成 OC4J 的配置和 WebService 的发布。这些步骤不仅适用于初学者,对于有一定经验的开发人员来说也是很有帮助的。
- **教程**:可能是逐步指导如何在OC4J上部署和运行Java EE应用的教程,或者如何利用OC4J进行开发的实例教程。 - **示例代码**:这些代码片段或完整的示例项目,可以用来学习OC4J的API用法,以及如何实现特定的功能...
- 启动OC4J服务:在`D:\OC4J\j2ee\home`目录下运行`java -jar oc4j.jar`。 - 停止OC4J服务:在新的命令行窗口中执行`java -jar admin.jar rmi://localhost:23791 admin admin-shutdown`。 - 重新启动OC4J服务:同样...
Oracle Containers for J2EE (OC4J) 是Oracle公司提供的一款轻量级、高性能的J2EE应用服务器,它是Oracle应用服务器产品家族的一部分,专为开发和运行小型到中型的J2EE应用程序而设计。OC4J的独特之处在于其轻便的...
- **强制关闭OC4J服务**:在另一个命令行窗口中运行`java -jar admin.jar ormi://localhost:23791 admin admin –shutdown force`。 需要注意的是,默认的管理端口为23791,相关配置可以在`d:\oc4j\j2ee\home\...
在部署Java应用到OC4J时,开发者通常会将所有依赖的JAR文件(包括XercesImpl和xml-apis)放入OC4J的应用服务器目录或者类路径中,确保运行时能够正确加载到这些库。这样,应用就可以利用这些库的功能来处理XML数据,...
Oracle的OC4J(Oracle Containers for Java)是Oracle公司提供的一款轻量级Java应用程序服务器,它集成在Oracle Application Server中,用于运行Java EE应用程序。自动部署脚本的创建是为了简化OC4J上的应用部署过程...
在IT领域,尤其是在Java开发与应用服务器管理方面,Oracle Containers for J2EE(OC4J)作为Oracle的一个关键组件,提供了强大的容器环境用于部署和运行Java应用程序。OC4J配置文件是确保应用服务器正常运作、优化...
在本话题中,我们将深入探讨如何在iOS OC项目中加载和播放GIF。 1. **GIF的基本概念** GIF是一种基于LZW压缩算法的无损图像格式,支持多帧动画,每帧之间可以设置不同的延迟时间,组合起来形成动态效果。 2. **...
如何配置OC4J环境及安装指南 如何配置OC4J环境及安装指南
在OC4J中,首先需要在`application.xml`文件中声明一个`<data-sources>`元素来指定数据源配置文件`data-sources.xml`的位置: ```xml ``` 通常情况下,`application.xml`和`data-sources.xml`文件都位于`j2ee/...
- **Secure Sockets Layer (SSL)**:OC4J支持SSL协议,可以在客户端和服务端之间建立加密的通信通道,保护数据不被窃听。 - **Common Secure Interoperability Version 2 (CSIv2)**:这是一种跨平台的安全协议,用于...
- **OC4J**: Oracle Container for Java,是Oracle Application Server的一个组成部分,用于支持Java应用程序的部署。 - **ESB**: Enterprise Service Bus,企业服务总线,用于实现不同系统之间的集成和服务交互。 -...
6. **多线程支持**:为了不影响UI的流畅性,加载和显示GIF的操作通常应在后台线程进行,而更新UI则在主线程执行,这涉及到多线程编程的知识。 7. **自定义配置**:为了满足不同场景的需求,工具类可能允许设置动画...
- 在命令行下运行`java -jar oc4j.jar`来启动OC4J服务。 #### 四、注意事项 - 在进行配置前,请备份原始文件,以防配置错误导致的问题。 - 配置文件中的路径需根据实际情况调整。 - 确保使用的JDK版本与OC4J兼容。...
在iOS开发中,处理GIF动画是一项常见的任务。GIF是一种支持动画的图像格式,广泛用于网络中的动态图片。在Objective-C(OC)中,原生的UIImage类并不支持GIF动画的显示,因此开发者需要借助第三方库来实现。本教程...
在iOS开发中,加载动画(Loading Animation)是用户体验设计中不可或缺的一部分,特别是在处理网络请求或者数据加载时。这种视觉反馈可以提升用户对应用性能的认知,同时也能增添界面的互动性。"OC Control Loading...
3. **事务管理**:通过集成Oracle Transaction Manager,OC4J能够支持分布式事务处理,确保数据的一致性和完整性。 4. **集群与负载均衡**:OC4J支持集群部署,可以在多个服务器之间实现负载均衡,提高系统的可用性...