Checking package initialization

Hello!

In some of our packages we specify some services as startup services. IS executes these services automatically when the package is loaded.

Sometimes some of the services fail, i.e. throw an exception. But the package is still active in IS, and services from it can be executed.

Is it possible (and how?) to programmatically check whether some of the package startup services failed during the last loading of the package? I.e. without having to search through some log files (server.log).

Thanks!

What is your webMethods version? Did you explore WmRoot package?

The version is 8.2.2. I did not explore WmRoot package because I didn’t know what to look for. And since the admin console does not display anything special for the packages I assume that there is no service to get this information.

Why did you ask your questions? Do you know a particular solution which depends on the version used?

I asked you the version detials because the services in WmRoot package (which is used internally) varies/changes from version to version (as per my knowledge).

According to me there should be one service that might tell the whether the startup/shutdown services are loaded/unloaded within a package.

If we do not find the a specific service in WmRoot I am quite sure there must be a Java API publicly or privately available.

We need to explore more on the above points.

Startup service exception won’t interrupt the package activation process, just insert a message to server log.

But you can control it bypass exception mechanism:

  1. Add try/catch sequence to your startup service, make sure it won’t throw out exception
  2. In the cache sequence, do whatever you want to the exception information, e.g. log it
  3. Invoke service to disable current package

Please try attached package, the divide 0 exception will occur randomly when startup service invoking, if it occurs the package won’t be enabled.
TestFML2.zip (5.44 KB)
TestFML2.zip (5.44 KB)

1 Like

Thank you, this was the information I needed. So the server does not store this information in a way that can be consumed programmatically. Once it’s known you can advise an appropriate solution.

Again, thank you.

If i remember correctly , package detail screen also displays load time errors. Please check.

Yes, there is a “Load errors” area there, but it’s empty even if a startup service failed. I think, they do not consider it a load error.

As Wang suggested best will be to catch error in catch block and write some kind of alert mechanism code. send out an email or write error to a separate log.