websphere 5-->load clases on server startup


EJB programming & troubleshooting: websphere 5-->load clases on server startup

  1. websphere 5-->load clases on server startup (3 messages)

    How do I load some proprietery jar files at the server start up.
    App Server-->WebSPhere 5
  2. As far as I know there no such mechanism, I spoke with an IBM guy once who complained it doesn't in the spec. He told me there is a startup bean as WS extention. You can see http://publib7b.boulder.ibm.com/wasinfo1/en/info/ee/asyncbns/tasks/tasb_confstb.html

  3. Hi David,
    The url u gave does not work :(
    cld u plz correct the url
  4. Using startup beans

    A startup bean is a stateful session bean that is loaded when an application starts. Startup beans enable J2EE applications to execute business logic automatically, whenever an application starts or stops normally.

    Startup beans are especially useful when used in combination with asynchronous bean features. For example, a startup bean might create an alarm object that uses JMS to periodically publish heartbeat messages on a well-known topic. This enables clients or other server applications to determine whether the application is available.

    Steps for this task

    Use the home interface, com.ibm.websphere.startupservice.AppStartUpHome, to designate a bean as a startup bean
    Use the remote interface, com.ibm.websphere.startupservice.AppStartUp, to define a start() and stop() method on the bean.
    The bean's start() method is called when the application starts. It implements any business logic that needs to run at application start time.

    The start() method returns a boolean. True indicates normal application startup and false indicates that the application start process should be aborted. The start() and stop() methods should not use a TX_MANDATORY attribute because there never is a transaction on the thread when the start() or stop() methods are invoked. Any other TX_* attribute can be used. If TX_MANDATORY is used, an exception is logged (need a transaction for mandatory) and the application does not start.

    The bean's stop() method is called when the application stops and implements any business logic that needs to run at this time. Any exception thrown by a stop() method is ignored, but logged to trace.

    The start() and stop() methods on the remote interface use Run-As mode. Run-As mode specifies the credential information to be used by the security service to determine the permissions that a principal has on various resources. If security is on, the Run-As mode needs to be defined on all of the methods called. The identity of the bean without this setting is undefined. For more information about the Run-As mode, see the topic Method extension assembly settings.

    There are no restrictions on what code the start() and stop() methods can run, since the full Enterprise Application Server programming model is available to these methods.

    Use an optional environment property called wasStartupPriority, which is an integer, to specify the start order of multiple startup beans in the same JAR file.
    If the environment property is found and is the wrong type, application startup is aborted. If no priority value is specified, a default priority of 0 is used. It is recommended that you specify the priority property. Beans that have specified a priority are sorted using this property. Beans with numerically lower priorities are executed first. Beans that have the same priority are executed in an undefined order. All priorities must be positive integers. The priority is used to order beans within an EJB JAR file. The order in which this process is applied to different EJB JAR files in a single EAR file is undefined. Beans are stopped in the opposite order to their start priority.
    Startup beans must specify a timeout value of 0. Failure to do so causes the bean to be passivated and results in errors when attempting to call the stop() method when the application is stopped.