Help on startup service of webMethods

Hi All,

Developing a simple poc in webMethods_9.6.

My java service has the while loop (service will not end - unless the shutdown service is called).

The concern part is, for whatever reason if the Integration server is automatically restarted, my IS server is not coming up since i have added that java service is start up and the service is not completely executed (because of the while loop). (Stuck in the package)

Can anyone help me how to achieve it ?

Thank you…

Yes IS will stuck/hang/crashes some times the if the service is going thru infinite loop (may not recover)

So in your programming logic don’t you have logic for exit-Loop condition as it sounds to be it’s going to infinite loop and try to debug it with lesser volume of data or check the JS syntax to see where it went wrong with the for loop code block.

Attach your JavaService code if possible to peek.


Thanks for the quick reply RMG…

Just thought of adding some more info about my requirement. My POC service will wait for the connections, as soon as the client connects to my service, i will be acknowledging it. (Which is way i cant end my loop). Rather than changing my code, would like to understand, is there anyway to add as a startup.!

Any idea how it can be achieved? :?


Are you trying to startup the IS or Java service?

startup the IS… with java service as a startup service of the package.

What is your OS the IS hosted on?

Development environment - Windows server - 2008 R2 enterprise edition, 64 bit


please describe your business case in detail?
Which type of connections are you trying to check?

When it is about ART-Based connections you can use Built-In-Services for that in comnbination with PackageDependencies.


Assuming you truly need this loop - like Holger, I’m also interested in learning more details because perhaps you don’t really need this loop - but again, assuming for now you truly need this loop, then your startup service should spawn a new thread and you should execute the loop inside that thread. This way your startup service can complete and your loop can continue to run.


Sorry for the delay Holger and Percio.

My Business case :-

I developed a code in webMethods 9.6 (Java service) - Socket programming.
To accept / listen to the connections i need a while loop in it. Because of this while loop - i’m not able add this as a startup service.
Reason is, if server got restarted - the IS will get stuck in between, that’s the worry part for me at the moment.


you mentioned a shutdown service in one of your earlier posts to this thread.

Did you try to put this service as a Shutdown service to the package properties?

Another option to check for might be to put server into Quiesce mode before restarting.
See IS Administrators Guide for details on Quiesce mode.


Thanks Holger, my shut down service will be different java service, where i will close the port. the ports are getting closed in shutdown service. I’m worrying in case of any restart happened, it will get stuck in between.

I’ll try to explore the Quiesce Mode from IS Administrator guide.



Again, you need to spawn a new thread and place your loop inside that thread. Your problem is because you have the while(true) loop inside the startup service, your startup service never completes and the IS thinks it’s still starting. You can easily test this theory by replacing the while(true) loop with a call to Thread.sleep. Suppose you sleep for 1 minute, you should see in your logs that the IS is now taking 1 minute longer to start than before.

By the way, at some point, back in the webMethods Advantage days, there was a sample socket adapter package. You may want to search the “samples” section for that package to see if it still exists. If I recall correctly, it was called WmSocket or something like that.


Thanks Percio, i’ll try to implement the thread and lets see how it behaves.Also i tried to see the samples for the socket adapter package, unfortuantely i couldn’t find it, hence i proceeded with the new java service. thanks again for the inputs.


Can any one explain about package startup services in webMethods ?

Hi Sasi,

please provide more informations about your request.

Provide your wM version please.


We are using 9.7 version.


and what exactly do you want have explained regarding startup services?


Hi Sasi,

A startup service is one that Integration Server automatically executes when it loads a package into memory.

Startup service is mainly used if you want to automatically execute specific service during server startup/reload package/enable package.

You can find more info about startup/shutdown/replication services in Service_Development Help guide.


One thing about startup service is, do not think the package will work only after startup service executed.
During the execution of startup service, the services in the package could be invoked by others, even it could cause problems.
So just consider startup service will be automatically invoked after package loaded, no any other guaranty.