-
1. Re: Web application startup/initialization method
jaikiran Feb 2, 2007 10:53 AM (in response to dhong1)I havent use OC4J container so am not aware of what that class does. Not clear what you mean by initializing a web application. Do you mean you want to execute some logic when the web application starts?
-
2. Re: Web application startup/initialization method
dhong1 Feb 2, 2007 11:30 AM (in response to dhong1)At the time when JBoss deploy the application, I want it to invoke an initialization routine (i.e. prior to when the user start launching the web client).
For example, this is what the current output looks like:
...
10:48:54,401 INFO [TomcatDeployer] deploy, ctxPath=/MYAPP, warUrl=.../tmp/deploy/tmp58687MYAPP-exp.war/
10:48:56,431 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8081
10:48:56,634 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
10:48:56,666 INFO [JkMain] Jk running ID=0 time=0/63 config=null
10:48:56,666 INFO [Server] JBoss (MX MicroKernel) [4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231054)] Started in 26s:492ms
...
And I want it to do this:
...
10:48:54,401 INFO [TomcatDeployer] deploy, ctxPath=/MYAPP, warUrl=.../tmp/deploy/tmp58687MYAPP-exp.war/
10:48:55,555 INFO EXECUTING MYAPP INITIALIZATION ************
10:48:56,431 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8081
10:48:56,634 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009
10:48:56,666 INFO [JkMain] Jk running ID=0 time=0/63 config=null
10:48:56,666 INFO [Server] JBoss (MX MicroKernel) [4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231054)] Started in 26s:492ms
...
Thanks. -
3. Re: Web application startup/initialization method
genman Feb 2, 2007 2:41 PM (in response to dhong1)Usually you use a .sar file bundled with your .war file component.
Do a web search or wiki search on sar, service, service xml, etc. -
4. Re: Web application startup/initialization method
dhong1 Feb 3, 2007 6:16 PM (in response to dhong1)Yes, starting service is what I need. However, I am not able to find an example of how to bundle a sar into a war file properly so that they are in the same context and the service is automatically started. It would be great if you can point me to an example out there. Thanks.
-
5. Re: Web application startup/initialization method
dhong1 Feb 5, 2007 8:28 PM (in response to dhong1)This may not be the best way to do it, but I got it to work with this trick.
In a standalone service which is loaded before all WARs, I create a thread that waits for a class in the WAR module to be available, and then instantiate an initialization class in that module.