Sun GlassFish Enterprise Server v3 Prelude Troubleshooting Guide

Chapter 2 Specific Issues

This chapter lists problems that you might encounter when using Sun GlassFish Enterprise Server v3 Prelude. The following issues are addressed.

General Issues

Specific Issues

Cannot Access Local Server (http://localhost:8080)

When this error occurs, check the following:

Did the Server Start?

Description

If the console window is still open, the expected message is:


Domain domain Started

where domain is the name of the default domain. This indicates that the default domain was started successfully.

If the console window is already closed, check for messages in the log file:


as-install/domains/domain1/logs/server.log

If startup was successful, the expected message is similar to that on the console, and appears at the end of the log file.

Was the Server Started at the Expected Port?

Description

The server might be running at a different port number than expected, either because it was intentionally installed there, or because another server was already running on the default port when the server was installed.

ProcedureTo Determine Which Port Number the Server Is Actually Using

  1. Examine the server's configuration file:


    as-install/domains/domain1/config/domain.xml
  2. Find the http-listener element.

  3. Inspect the value of the port attribute.

    Be sure to enter the correct port number when invoking the server.


    Note –

    The server's default port number is 8080, however, there are a number of ways in which the expected value can change:

    • A different port number was specified during installation.

    • A previous installation exists.


Cannot Access Remote Server

When attempting to open the start page of Enterprise Server, the initial screen does not appear.

When this error occurs, check the following:

Is the Server Available Locally?

Description

If the server cannot be accessed from the web, but it is running locally, then the server is actually running.

Solution

Verify that the server is running locally.

ProcedureTo Verify That the Server Is Running Locally

  1. Log on to the host where the server is running.

  2. Go to the local web page. For example, if 8080 is the default port, go to:


    http://localhost:8080/

    If the start page does appear, the web connection is encountering a problem that prevents accessing the server remotely. If the start page does not appear, see Did the Server Start?.

Is the Proxy Setting Causing a Problem?

Description

The server should be accessible directly from the host on which it is running (localhost); for example, using the default port 8080:


http://localhost:8080/

Solution

A server instance running on localhost might not be accessible if the server host machine is connected to the web through a proxy. To solve this problem, do one of the following:


Note –

To find the host name and domain for the localhost machine:


Cannot Access the Administration Console

The Administration Console provides an interface for administrative functions. If the Administration Console is not accessible, check the following:

Is the Application Server Running?

Description

The server must be running before the Administration Console can be accessed.

Solution

Review the information in Did the Server Start? to determine if the server is running.

Is the Administration Console Running on the Expected Port?

Description

The default port number for the Administration Console is 4848. However, it could be running on a different port number than expected, either because it was intentionally installed there, or because that port was in use when the server was started.

Solution

Refer to Was the Server Started at the Expected Port? for guidelines on verifying the port on which the Administration Console is running. Be sure to enter the correct port number and HTTP protocol when invoking the Administration Console.

Is the Security Manager Disabled?

Description

The Security Manager is not optional; it must be enabled in Enterprise Server. Because there is no configuration interface in Enterprise Server for disabling the Security Manager, it can only be disabled when you directly modify the domain.xml configuration file in such a way that the following line is removed or commented out:


<jvm-option\>-Djava.security.policy=yourPolicy</jvm-option\>

Solution

Verify that the -Djava.security.policy=yourPolicy option is present in the domain.xml file.

Cannot Access a Server Application

If a particular application cannot be accessed through Enterprise Server, check the following:

Is the Application Server Running?

Description

If Enterprise Server is not running, applications are not accessible.

Solution

Review the information in Did the Server Start? to determine if the server is running. The server must be running before a server application can be accessed.

Was Application Deployment Successful?

Description

An application must be successfully deployed before it can be accessed.

Solution

Check the server's log file:


as-install/domains/domain1/server.log

Administrator User Name or Password Not Known

If you have forgotten the administrator user name, you can find it by inspecting the as-install/domains/domain-name/config/keyfile file, where domain-name is the name of the domain. In the default domain, domain1, the file to inspect is as-install/domains/domain1/config/keyfile. For a different domain, substitute its name in the path.

If you have forgotten the administrator password, you must create a new user name-password pair by removing the user name and password, creating new ones, and restarting the server. (You will not be able to read the password, because it is encrypted in the keyfile.)

ProcedureTo Remove the User Name and Password Completely

  1. Stop the server, if it is currently running.

  2. Change to the appropriate WEB-INF directory; for example:


    as-install/lib/install/applications/adminapp/adminapp_war/WEB-INF
  3. Comment out the entire <security-constraint> element in the web.xml file.

    Do not delete the element, as you will be reenabling it later. This action disables security for command-line operations.


    Note –

    The commands will still expect a value for --username (or -u) and --password (or -w). But these can be dummy values, since the server side does not impose any security.


  4. Start the server.

    At this point, the server does not have command-line security.

  5. Create a plain text file that defines the AS_ADMIN_USERPASSWORD variable as follows:


    AS_ADMIN_USERPASSWORD=adminpassword
    
    adminpassword

    Your choice of password for the administration user's password.

  6. Create an administration user whose password is the password that you defined in the preceding step.


    asadmin create-file-user --groups asadmin --passwordfile=password-file adminuser
    
    passwordfile

    The full path to the file that you created in the previous step.

    adminuser

    The name of the user that you are creating.

    This command adds an entry to the as-install/domains/domain-name/config/keyfile file.

  7. Uncomment the <security-constraint> element in the web.xml file.

  8. Restart the server for the new user name-password to take effect.


    Note –

    After the server is restarted, remote commands must specify adminuser as the administration user and adminpassword as the administration password.


Server Will Not Start on Windows (Port Conflict)

If a message similar to the following is displayed when starting Enterprise Server on Microsoft Windows, a server port conflict has occurred:


Address already in use

This error occurs when another application is running on the Enterprise Server port (default 8080), or because a previous instance of Enterprise Server did not shut down cleanly.

You might also check the following:

Is Another Application Running on the Server's Port?

If another application is using the server's port, stop the other application, then restart Enterprise Server.

Has an Ungraceful Shutdown Occurred on a Previously Running Server?

Use the asadmin stop-domain command to stop the server, or explicitly kill the Java process and then restart Enterprise Server.

Two Server Instances Bind to Same Port on Windows

Description

This problem only occurs on Windows 2000/XP systems with Enterprise Server software, and is due to a known Windows security flaw rather than a problem with Enterprise Server itself.

The problem occurs when two or more instances of Enterprise Server are created using the same port number for the instanceport option; for example:


asadmin create-domain -adminport 5001 options -instanceport 6001 domain
asadmin create-domain -adminport 5002 options -instanceport 6001 domain

When the two domains are started on a UNIX or Linux system, a port conflict error is thrown and the second instance fails to start. However, when the two domains are started on Windows 2000/XP, no error is thrown, both server instances start, but only the first instance is accessible at the specified port. When that first server instance is subsequently shut down, the second instance then becomes accessible. Moreover, when both instances are running, the Windows netstat command only reports the first instance.

Solution

Be sure to use unique port numbers for all server instances on Windows systems.

Cannot Produce a JVM Thread Dump After Server Crash

Description

If Enterprise Server crashes, the server dumps a core file and, by default, restarts with the -Xrs flag, which prevents the dump of a JVM thread dump.

Solution

ProcedureTo Obtain a Server Thread Dump

  1. Type the following command:


    asadmin generate-jvm-report --type=thread
    
See Also

generate-jvm-report(1)

Issues Related to Applications

Error When Deploying EAR

Description

You tried to deploy a traditional EAR type of application in Enterprise Server but received an error message instead.

Solution

Enterprise Server v3 Prelude does not include a full EJB 3.0 implementation and does not support traditional EJB modules. Applications can be packaged for deployment in web archive (WAR) format only. You can download a partial implementation of a few EJB 3.1 features using Update Tool, but the bulk of EJB 3.0 (ejb-jar and .ear support) is not available . If you need a full Java EE 5 implementation, Sun Java System Application Server 9.1 (GlassFish v2) is a better choice for now. Web applications are the only Java EE application type supported by Enterprise Server v3 Prelude.

For related information, see the following:

Cannot Find SunDeploymentManager

Description

You cannot find SunDeploymentFactory.java.

Solution

Enterprise Server v3 Prelude does not include the JSR-88 API (SunDeploymentManager is the implementation of the JSR 88 API). The JSR 88 specification provides a complete description of the APIs required by the Java EE platform to enable development of platform-independent deployment tools.

Cannot Undeploy or Redeploy Application With Open Streams to jar Files (Windows Only)

Description

On Windows systems, after running an application, subsequent attempts to undeploy it or redeploy it throw exceptions about the server being unable to delete a file or rename a directory.

On Windows systems, an application may use getClass().getResource or getResourceAsStream methods to locate a resource inside the application, particularly in jar files that are in the application or accessible to it. If the streams remain open, subsequent attempts to redeploy or undeploy the application can fail. In addition, the Java runtime by default caches streams to jar files for performance reasons.

Solution

Be sure to close streams opened by your applications. Also, if an application needs to be redeployed or undeployed repeatedly, and also needs to obtain a resource from a jar file using getResource or getResourceAsStream, consider using getClass().getResource, which returns a URL object, then invoke the url.setUseCaches method to turn off caching for that jar file, and use url.getInputStream() to obtain the stream.

Although turning off caching for access to the jar file can slow performance, this approach does allow the application to be undeployed or redeployed. Note also that if the getClass().getResourceAsStream method is used instead, then the jar file in which the resource is located is cached (this is the default Java runtime setting) and remains open until the server is stopped.

Issues Related to asadmin

asadmin start-domain Command Fails

The command asadmin start-domain fails with one of the following errors:

Error: CLI143 There is more than one domain...

Description

When issued with no arguments, the command asadmin start-domain fails with the error:


CLI143 There is more than one domain in C:\\Sun\\AppServer\\domains.
Please use operand to specify the domain.
CLI156 Could not start the domain null.

This error occurs when there is more than one domain in the domains directory, none of them is named domain1, and no domain is specified with the start-domain command.

Solution

Specify the domain when issuing the start-domain command:


asadmin start-domain domain-name

For example:


asadmin start-domain mycustomdomain

Error: Could Not Start Domain

Description

This message comes from Sun Java System Application Server 8. The full message looks like either:


Could not start the domain.
There are no domains.

or


Could not start the domain.
No default domain. Need to enter a domain.

This error occurs when Sun Java System Application Server 8 is installed on the same system, and its asadmin command (at /usr/sbin) is found on the PATH before the asadmin command for Sun Java System Application Server 8 at as-install/bin. The situation is especially likely to occur on Solaris and Linux systems when . is not specified as part of the PATH variable. Without . in the PATH, the asadmin command in /usr/sbin is found first, even when the current directory is as-install/bin.

Solution

Make sure as-install/bin is in the PATH ahead of /usr/sbin, or that . is in the PATH ahead of /usr/sbin if you access asadmin by changing directories to as-install/bin. Alternatively, if you do change to as-install/bin to run asadmin, be sure to include./ in the command name; for example:


cd as-install/bin
./asadmin

Cannot Stop Domain Using asadmin stop-domain

Description

You cannot stop the domain using the asadmin stop-domain command.

Solution

Search the server.log file for error messages related to your inability to stop the domain. To kill a process when stop-domain is not working, try $JAVA_HOME/bin/jps and look for the process with ASMain.

Using asadmin set Command Might Produce Unexpected Results

Description

Unexpected results are returned when setting variables in a command, such as:


asadmin set name={$a-b}

In this case, name is set to b, not {$a-b} because the shell syntax ${a=b} is interpreted as “if the variable a is unset, substitute the value b, otherwise substitute the value of a.” This is standard shell behavior. For example, consider the following:


asadmin set default-config.http-service.http-listener.http-listener-1.port=
${http-listener-1-port}

In this case, default-config.http-service.http-listener.http-listener-1.port is set to listener-1-port, which is invalid.

Issues Related to Eclipse

Eclipse GlassFish Server Adapter – Port Conflict When Starting GlassFish

Description

On Windows, the following error message is displayed when you start Enterprise Server v3 Prelude using the server adapter within Eclipse:


Please stop the server process using the same port as the one used
by the Application Server. A server process is already running on this port
but we cannot determine if it's a GlassFish
process (lack of info or credentials)

The message does not list which port is blocked by a server process, making it difficult to locate the blocking process. Obvious candidates such 4848 or 8080 are not blocked, according to TCP View.

Solution

This problem only occurs on Windows platforms and is related to an HTTP connection socket error. For more information, see the following:


Note –

The netstat -ab command shows the PID and might prove useful.


Issues Related to Installation and Upgrade

General Installation

Description

You encounter problems when installing.

Solution

The Enterprise Server installation requires JDK 5 or JDK 6, so check your system for that dependency. Make sure that the JDK 5 or JDK 6 release bin directory is in your PATH so that the java binary used with Enterprise Server comes from the JDK release rather than a JRE implementation. For more information about system requirements and dependencies, see the Sun GlassFish Enterprise Server v3 Prelude Release Notes. For complete installation information and guidelines, see the Sun GlassFish Enterprise Server v3 Prelude Installation Guide.

Cannot Upgrade

Description

You cannot upgrade from Sun Java System Application Server 9.1 (GlassFish v2) to Enterprise Server v3 Prelude. No upgrade option is available.

Solution

Upgrade support is not provided in Enterprise Server v3 Prelude. You cannot upgrade from Sun Java System Application Server 9.1 (GlassFish v2) to Enterprise Server v3 Prelude.

For information about updating an existing Enterprise Server v3 Prelude installation, see Chapter 2, Updating an Existing Enterprise Server v3 Prelude Installation, in Sun GlassFish Enterprise Server v3 Prelude Installation Guide.

Issues Related to JavaMail

Cannot Configure JavaMail Resources

Description

You cannot configure JavaMail resources using the Administration Console.

Solution

JavaMail resources are not supported by Enterprise Server v3 Prelude. The mail.jar and activation.jar files are bundled so that you can create and use mail sessions. However, you cannot obtain mail sessions from a predefined XML resource.

Issues Related to JNDI

Cannot Deploy a Mail Session as a JNDI Resource

Description

You cannot deploy a mail session as a Java Naming and Directory InterfaceTM (JNDI) resource.

Solution

This functionality is not available in Enterprise Server v3 Prelude. You must use the mail session directly. You cannot perform this task in the Administration Console or by using the asadmin utility.

Issues Related to MySQL

Exception When Creating MySQL Connection Pool

Description

On Windows, you get an exception when creating a MySQL connection pool using the Administration Console.

Solution

See Attempt to Use Administration Console to Create a Connection Pool Fails Even if the Driver Is Present (Issue 6671) in Sun GlassFish Enterprise Server v3 Prelude Release Notes.

Issues Related to Security

java.security.AccessControlException: Access Denied Error

Description

The following error occurs from an application client, or appears in the server.log file:

java.security.AccessControlException: access denied
(java.util.PropertyPermission name write...)

There is a permissions issue in the policy files. Either the client.policy file for the application client or the server.policy file for server side components does not have permission to set the property.

Solution

Add the permission in client.policy (for the application client), or in server.policy (for web modules) for the application that needs to set the property. By default, applications only have “read” permission for properties.

For example, to grant read/write permission for all files in the codebase directory, add or append the following to client.policy or server.policy:

grant codeBase "file:/.../build/sparc_SunOS/sec/-" {
   permission java.util.PropertyPermission "*", "read,write";
 };

Mutual Authentication Not Working With the Application Client

Description

This failure can occur when the keystore and truststore properties are not set properly.

Solution

Set the following properties on the JVM:

javax.net.ssl.keyStore=
<keystore-file-path>;javax.net.ssl.trustStore=<truststore-file-path>

To use the application client, set the environment variable VMARGS to the following value:


-Djavax.net.ssl.keyStore=${admin.domain.dir}/${admin.domain}/config/keystore.jks
-Djavax.net.ssl.trustStore=${admin.domain.dir}/${admin.domain}/config/cacerts.jks