Skip to main content

BEASVC.EXE - WebLogic as a Windows Service

I remember the first time I had to work out why WebLogic wouldn't run as a service. It was a frustrating experience. There were no error messages. No Windows error dialog. No console output.

How do you troubleshoot something like this??!!

This short article will show you. For simplicity I'll talk about the node manager, but the same principles apply for running an admin or managed server as a service.

First Steps

First, you still have your server logs. Sure the console output is better, but it's a starting point. Check this log for errors and especially take note of the start up variables such as PATH and CLASSPATH. If the server log isn't being created, that tells you WebLogic probably isn't even being started. (Check that you have a license file if you haven't already.)

Ok, so the logs were no help. The next step is to look at how the service is trying to start WebLogic.

When you install WebLogic as a service, you're really setting up beasvc.exe as the service. This is a tool that BEA/Oracle supplies with your WebLogic installation, and all it does is runs WebLogic using parameters stored in the Windows Registry.

To find out what beasvc is doing, you can either:
  • Use the beasvc '-debug' mode; or
  • Simulate the way beasvc starts WebLogic.
BEASVC Debug Mode

beasvc.exe provides an easy debug mode. To use it, open a command-line console (cmd.exe) and change to the directory where all your domains are located (eg c:\bea\user_projects\). Then run the following command:

WL_HOME\server\bin\beasvc.exe -debug "SVC_NAME"

Where WL_HOME is where weblogic server is installed to (Eg.
c:\bea\weblogic92) and SVC_NAME is the name of the service.

Running beasvc with this option will give you a lot of useful information. You can find out more about the '-debug' option here.

Simulating BEASVC.EXE

If the '-debug' option isn't helping, or you need to test something specific, you can always simulate how beasvc starts WebLogic.
Normally to start WebLogic, you'd go to the startWebLogic.cmd (or other) script, but since you're starting WebLogic as a service this script is useless.

What we need to do is get all the environment variables and start-up parameters and then run WebLogic at the command-line.

To find the start-up parameters in the Windows Registry, first obtain the full service name from the Windows Services management console. To do this, right-click on the service you are troubleshooting, and click Properties. Copy the 'Display Name' field.

In regedit, search for the service using this display name. (On the Find dialog, select 'Look at: Keys' only.)

When you've found the node, expand it and select 'Parameters'. This contains all the important start-up parameters and environment variables.


Now that we have the start-up parameters used by beasvc, we can easily simulate it.

First, open a command console (cmd.exe) and change to the directory specified by the ExecDir registry entry.

Set the PATH variable to the value of the Path registry entry. Now run java.exe with no options. If it does not execute, you know that the registry's Path entry is incorrect. You can either edit it with regedit, or fix your installsvc.cmd script and run it again.

Finally, run java.exe again, this time followed by the CmdLine registry entry. This should run WebLogic as beasvc.exe would, except any errors will be printed to the console window.

Common Problems

With services, I frequently encounter various problems caused by incorrect CLASSPATH or PATH values - usually directory names with spaces that aren't surrounded by quotes. Java can interpret these as separate command line parameters, rather than a single file path.

As a general rule, avoid installing WebLogic to a directory that has a space in the name. If you do, use the old 8dot3 path name (use the DIR /X command to obtain these).

Resources

If you're having trouble working out why an exception is being thrown, you can check if this site covers your scenario: http://www.insideexceptions.com/. It's a good resource for administrators who understand java.

Comments

  1. Good posts Casey, keep up the good work.

    CM.

    ReplyDelete
  2. Chris,

    do you know, how to find out parameters of stop status to complete the entire simulation?

    ReplyDelete
  3. Hi Anitka, If you're stopping the process via the Windows Services Computer Management Console, you're really just killing the process. (So you can simulate by using the Windows Task Manager.)

    It is possible to change this behavior so that a graceful shutdown occurs when you stop the service. The steps for doing this can be found here: http://e-docs.bea.com/wls/docs81/adminguide/winservice.html

    ReplyDelete
  4. Should "classpath" generated from original script tagged to the cmdLine registry string ? Could you provide working registry string values for Path and CmdLine ? Trying to resolve -
    Error in java application .......

    The following line contains specific error details .......
    Unable to find a JVM!

    ReplyDelete
  5. John, There is bug with certain JVMs when running on some 64-bit OSs which results in the "Unable to find a JVM!" error message. See the 3rd post here: http://forums.oracle.com/forums/thread.jspa?threadID=1062305

    ReplyDelete
  6. Exceptional! Thank you!

    ReplyDelete

Post a Comment

Popular posts from this blog

BAD_CERTIFICATE - A corrupt or unuseable certificate...

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators.
Symptom
In wls_utc, when trying to test a webservice using SSL, the following error message is received: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received.
If SSL debugging is enabled, the following error also appears in the logs: ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)' <1254822672320>>
verification failed because RSA key public exponent [3] is too small
Cause
The certificate encryption is of a weaker strength than expected by newer versions of Java.
Solution
Add the flag "-Dweblogic.security.SSL.allowSmallRSAExponent=true" to the server startup parameters.
References


None.

Connection refused: No available router to destination

This is a simple symptom-cause-solution blog entry only. I hope these blogs will help fellow administrators.
Symptom

The following exception occurs in WebLogic server logs. Most likely to occur during WebLogic server start-up, but similar exceptions may occur at other times.
java.net.ConnectException: t3://myserver:8000: Destination unreachable; nested exception is: java.net.ConnectException: Connection refused: connect; No available router to destination] at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:49) at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:773) at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:363) at weblogic.jndi.Environment.getContext(Environment.java:307) at weblogic.jndi.Environment.getContext(Environment.java:277)
Cause
This message (Connection refused: connect; No available router to destination) is a kind of "catch…