15.2.1 Notes common to Application Server versions
(1) Notes common to OSs
This subsection describes the notes common to OSs.
- Compatibility with the earlier Java SE versions
Some Java SE 6 functionality is not compatible with the earlier versions of Java SE (J2SE). For details, see the relevant page (http://www.oracle.com/technetwork/java/javase/compatibility-137541.html).
- Other changes in Java SE 6
For details on the other extensions and changes in Java SE 6, see the relevant page (http://www.oracle.com/technetwork/java/javase/releasenotes-136954.html).
- JVMPI and JVMDI
JVMPI and JVMDI are removed. Instead of these interfaces, use JVM TI.
- Functionality for obtaining the GC memory information
The JP.co.Hitachi.soft.jvm.MemoryInfo class that obtains the GC memory information is available with Developer's Kit for Java. This class is not available with other products.
- Loading of classes in URLClassLoader
When a class is loaded from a jar file via URLClassLoader, the objects created in JavaVM during the loading process might not be deleted until JavaVM is terminated. When appropriate, restart the Java application.
- Using Java2D
To avoid the DirectDraw and Direct3D problems in Java2D, specify true in the sun.java2d.noddraw property that disables DirectDraw and Direct3D.
- Maximum method length
According to the JavaVM specifications, the byte code of one method must be less than 64 kilobytes.
If the byte code exceeds 64 kilobytes, an error occurs when a class file is generated, or the java.lang.LinkageError exception occurs when a class is loaded.
Also, if the byte code is less than 64 kilobytes, but is extremely complicated and has a large number of lines, the following negative effects might occur:
- The execution of garbage collection takes a very long time.
- The JIT compilation takes a very long time.
- The JIT compilation consumes a lot of memory.
Additionally, if the functionality to output the local variable information is enabled, the following negative effects might also occur:
- The output of the extension thread dump takes time.
- The obtaining of the thread stack trace takes time.
- The generation of an exception object when an exception occurs takes time.
Therefore, we recommend that you specify less than about 500 lines, excluding comments and blank lines, for each method in the Java source.
- Serialized version UID (serialVersionUID)
With JDK 1.4 or later, if the serializable nested class contains an explicit reference to the class object (for example, Class c = Object.class;), the value of the default serialized version UID differs from the versions earlier than JDK 1.4 in both the nested class and the class including that class. This is because of the changes in the javac command implemented in JDK 1.4. If all of these conditions are satisfied, add the serialized version UID (serialVersionUID) in the serializable class.
- Closing the file descriptor
The child processes started with java.lang.Runtime.exec() and java.lang.ProcessBuilder.start() communicate with each other through the streams fetched with the Process.getInputStream, getErrorStream, or getOutputStream methods respectively.
With the parent process, note that three file descriptors are consumed even if these methods are not used.
Close the file descriptors in the following cases:
- When the Process object is finalized
- When Process.destroy() is invoked
- When the close() method is explicitly invoked for these streams
- System properties java.ext.dirs and java.library.path
In the system property java.ext.dirs, specify a directory that allocates the jar files containing classes that are loaded on higher priority than the normal application classes. The default values are as follows:
- In Windows
- JDK-installation-directory\jdk\jre\lib\ext
- In UNIX
- /opt/Cosminexus/jdk/jre/lib/ext
Also, in the system property java.library.path, specify the search path of the native library for the user. The default values are as follows:
- In Windows
- "JDK-installation-directory\bin, system-directory, Windows-directory, %PATH%, current-directory"
- In AIX
- Value set in the environment variable LD_LIBRARY_PATH, directory of the native library beneath JDK, /usr/lib:/lib
- In HP-UX
- Directory of the native library beneath JDK, value set in the environment variable LD_LIBRARY_PATH, /usr/lib:/usr/lib/hpux64:/usr/ccs/lib/hpux64
- In Linux
- Directory of the native library beneath JDK, value set in the environment variable LD_LIBRARY_PATH, /usr/lib64:/lib64:/lib:/usr/lib
- Storage time of the positive DNS cache
JDK has the functionality for caching query results of the DNS host name resolution. The cache functionality includes a positive cache that stores the results of a successful resolution and a negative cache that stores the results of a failed resolution.
Among these, only when the security manager is disabled, the default storage time of the positive cache for the DNS query results changes from "permanent cache" to "implementation dependent". For the same behavior as JDK 5.0, set the value of the security property networkaddress.cache.ttl to -1. For details, see the relevant page (http://docs.oracle.com/javase/6/docs/api/java/net/InetAddress.html).
- Messages output by the instrumentation functionality
If memory is insufficient while the instrumentation functionality is being processed, the following message is displayed and the processing of the instrumentation functionality might fail. For details, see the relevant page (http://docs.oracle.com/javase/jp/1.5.0/api/java/lang/instrument/package-summary.html).
- Message contents
- *** java.lang.instrument ASSERTION FAILED ***
- Timeout of java.net.Socket.connect()
The socket connection for java.net.Socket.connect() times out as per the timeout value for the TCP communication specified in the OS. When the TCP communication timeout value is reached, the connection times out even if the timeout value specified in java.net.Socket.connect() has not been reached, and even if the timeout value is not specified.
When the connection times out at the TCP communication timeout value, the java.net.ConnectException exception containing the following detailed message is thrown:
- Message contents
- Connection timed out: connect [errno=10060, syscall=select]
For details on the TCP communication timeout, see the OS documentation.
- Class loading time
With Java, a class file is read into the memory (class loading) when that class is required for the first time during the execution of a program. Therefore, if the class loading frequency is high during the initial execution of a particular processing, the processing time might be longer than the second and subsequent times. In this case, improve processing time by loading the classes required for execution in advance.
- Default encoding
The default Application Server encoding is as follows:
- In Windows
- Windows-31J (MS932)
- In UNIX
- When LANG is C or POSIX: US-ASCII (ASCII)
- When LANG is jp_JP, jp_JP.eucJP, ja_JP.ujis,japanese, or japanese.euc: x-euc-jp-linux (EUC_JP_LINUX)
- When LANG is ja_JP.utf8: UTF-8 (optional name UTF8)
- Garbling of characters between different OSs
The mapping to the character code Unicode varies depending on the OS. Therefore, garbling might occur in the following cases. The typical characters that are garbled include -, ~, //, -, 「, 」, and ャ.
- When Unicode encoding such as UTF-8 is used to pass the above character data between different OSs
- When the class files created from a source program with a literal string containing the above characters are executed as they are without recompilation, on different OSs
- Files used with the Java APIs
The configuration files, such as the policy file or login configuration file, used with Java APIs, must be encoded using the UTF-8 encoding method.
- Encoding of the URL strings handled by java.net.URL
The encoding for the URL strings handled by java.net.URL is Modified UTF-8 and not the standard UTF-8. If a string that is not Modified UTF-8 is passed, java.lang.IllegalArgumentException occurs.
- UTF-8 encoding for the string operations with the JNI function
In JNI, the encoding to be used for the functionality performing the following string operations is Modified UTF-8 and not the standard UTF-8:
- NewStringUTF
- GetStringUTFLength
- GetStringUTFChars
- ReleaseStringUTFChars
- GetStringUTFRegion
- Maximum jumpable length for determining the if statement
According to the JavaVM specifications, the jumpable length for determining the if statement is up to 32 kilobytes. If the jump destination exceeds 32 kilobytes, java.lang.LinkageError occurs.
- Maximum file size
The java.util.zip and java.util.jar packages do not support JAR files or ZIP files exceeding 4 gigabytes.
- map, transferFrom, and transferTo methods of the java.nio.channels.FileChannel class
The map method does not support files exceeding 2 gigabytes.
Also, the count specification in the transferFrom and transferTo method does not support a value of 2 gigabytes or more.
- Stack size of threads
When you use a function such as the JNI function AttachCurrentThread() to connect the native thread to JavaVM, use a thread with a stack size greater than the value specified in the -Xss option for connection.
(2) In Windows
This subsection describes the notes for Windows.
- No support for the third-level and fourth-level characters of JIS X0213:2004 in the AWT components
The AWT components do not support the third-level and fourth-level characters of JIS X0213:2004. Such characters are garbled in the information output by the AWT components. To handle these characters in Windows Server 2012, Windows Server 2008, Windows 8, Windows 7, and Windows Vista, use the Swing components.
- Garbage collection elapsed time for the JavaVM log files
The garbage collection elapsed time for the JavaVM log files is output up to the seventh place after the decimal point in second units (100 nanoseconds).
In Windows, with version 08-70 or earlier, a valid number is output up to the seventh place after the decimal point (100 nanoseconds). With 08-70 or later, a valid number is output up to the sixth place after the decimal point (1 microsecond), and 0 is always output in the seventh place after the decimal point (100 nanoseconds).
- Libraries that cannot be used with the JNI programs
The following libraries cannot be used with the JNI programs because the information managed in JavaVM might be updated incorrectly:
- java.io.tmpdir property
In the java.io.tmpdir property, specify an existing directory with write permissions. The initial value of the java.io.tmpdir property is the directory obtained with the GetTempPath() function of the Windows API.
Also, with the dynamic class loading functionality of Java RMI and java.io.File.createTempFile() of the Java API, a temporary file is created in the directory specified in the java.io.tmpdir property. To operate the functionality normally, do not delete the creation destination of the temporary file while the JavaVM process is running.
- Starting independent processes that require administrator privileges (In Windows Server 2012, Windows Server 2008, Windows 8, Windows 7, and Windows Vista)
To start independent processes with administrator privileges using java.lang.Runtime.exec() or java.lang.ProcessBuilder.start() from a java application started by a user who does not have administrator privileges:
- Add a manifest to the command to be started as an administrator privilege. For details on how to add a manifest, see the OS documentation.
- Start the process through Windows cmd.exe.
For example, to start sample.exe, the operations are as follows:
- Runtime.getRuntime().exec("cmd.exe", "/c", "sample.exe");
- new ProcessBuilder("cmd.exe", "/c", "sample.exe").start();
When you start this java application, the User Account Control dialog box appears. Click Continue to continue the application.
- Data sharing by java.util.prefs.Preferences.systemNodeForPackage (In Windows Server 2012, Windows Server 2008, Windows 8, Windows 7, and Windows Vista)
If a user who does not have administrator privileges uses java.util.prefs.Preferences.systemNodeForPackage, the functionality for sharing data between different users cannot be used.
For example, when the same key is specified in the argument, different data is returned among different users.
- Garbling of characters during encoding
To handle the following characters with a java program, specify MS932, windows-31j, or cswindows31j in the encoding. If any other encoding is specified, the characters might be garbled.
![[Figure]](figure/zu150100.gif)
- (Example)
![[Figure]](figure/zu150200.gif)
In this program, the IBM extension characters are encoded with eucjis, so after execution, the characters are garbled as follows:
java encode_eucjis
???
To avoid the garbling, encode by specifying MS932, windows-31j, or cswindows31j.
- UTF-8 encoding supported by Java
The UTF-8 encoding supported by Java is UTF-8 without BOM. The data stored by specifying "UTF-8" as "character code" in a Windows text editor (notepad) becomes UTF-8 with BOM, so the data cannot be handled with Java.
(3) Notes common to UNIX
This subsection describes notes common to UNIX.
- fork system call
If you generate or execute a child process of a copy of the current process only by issuing the fork() system call in the native method or native code invoked by JNI and JVMTI, the operations of that parent-child process are not guaranteed. After generating the child process by issuing the fork() system call, make sure that you load the new program with the exec() system call and then start the program. Also, to generate a child process in the Java environment, we recommend use of the java.lang.Runtime.exec() method of the Java class library.
- Signals
If a signal handler is registered for the following signals with the native method or native code invoked by JNI and JVMTI, the operations might not function properly:
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGFPE, SIGBUS, SIGSEGV, SIGPIPE, SIGTERM, SIGUSR2, SIGCHLD, SIGXCPU, SIGXFSZ, signal of number (_SIGRTMAX-2)
- Receiving signals while the system library functions and system call are being invoked
The following signals might be received during the invocation of the system library functions and system call:
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGFPE, SIGBUS, SIGSEGV, SIGPIPE, SIGTERM, SIGUSR2, SIGCHLD, SIGXCPU, SIGXFSZ, signal of number (_SIGRTMAX-2)
When you invoke a system library function and system call, the processing of the applicable function is interrupted due to the receipt of these signals and an error is returned (EINTR is set in the errno value). In this case, take the appropriate action (for example, re-execution).
- Libraries that cannot be used with the JNI programs
The following libraries cannot be used with the JNI programs because the information managed in JavaVM might be updated and become invalid:
- setjmp()
- longjmp()
- _setjmp()
- _longjmp()
- sigsetjmp()
- siglongjmp()
- Passing of character data to Windows
To pass the character data to Windows, specify MS932, windows-31j, or cswindows31j for the encoding.
If you specify Shift_JIS or SJIS, the following characters are converted into invalid character codes:
![[Figure]](figure/zu150100.gif)
- Maximum number of threads that can be generated
The maximum number of threads that can be generated in the entire system is /proc/sys/kernel/threads-max. Also, the maximum number of threads that can be generated per user is the value of nproc (same as ulimit -u) in /etc/security/limits.conf. Adjust these values in accordance with the system.
- Number of notification pending monitors
The information on the notification pending monitors obtained by using the JVMTI interface might be invalid.
(4) In AIX
This subsection describes notes for AIX.
- Exception message for Runtime.exec
If an exception occurs with Runtime.exec, the error message might be garbled.
- java.security.SecureRandom class
The default random number generator of the OS used by the SecureRandom class is /dev/urandom file. If you specify file:/dev/random in the java.security.egd property, you can use the /dev/random file. However, if the /dev/random file is used, the speed at which the random numbers are generated for the OS is limited. Therefore, if you implement the following processes in which the SecureRandom class obtains random numbers from the /dev/random file at short intervals, note that the processing does not finish until the OS finishes random number generation:
- When the generateSeed() method of the SecureRandom class is invoked
- When the getSeed() method of the SecureRandom class is invoked
For details on the java.security.egd property, see the relevant page (http://docs.oracle.com/javase/6/docs/technotes/guides/security/jaas/JAASRefGuide.html).
- Print support using java.awt.print
The AIX print sub-system supported by the java.awt.print package print API of Developer's Kit for Java is the System V print sub-system. To use the Print API, set up the System V print sub-system as follows:
- Execute the smit printer command.
- Choose Print spooling, Change/ Display the current print sub-system, and then Current print sub-system. Use the Tab key to change to SystemV.
- Environment variable LANG
If a value other than the following values is specified in the environment variable LANG, the exception message output by the java.nio.channels package might be garbled:
- java.io.tmpdir property
Specify an existing directory with write permissions in the java.io.tmpdir property. The initial value of the java.io.tmpdir property is /tmp.
Also, with the dynamic class loading functionality of Java RMI and java.io.File.createTempFile() of the Java API, a temporary file is created in the directory specified in the java.io.tmpdir property. To operate the functionality normally, do not delete the creation destination of the temporary file while the JavaVM process is running.
(5) In HP-UX
This subsection describes notes for HP-UX.
- No support for the third-level and fourth-level characters of JIS X0213:2004 in the AWT components
The AWT components do not support the third level and fourth level characters of JIS X0213:2004. Such characters are garbled in the information output by the AWT components. To handle these characters, use the Swing components.
- Exception message for Runtime.exec
If an exception occurs with Runtime.exec, the error message might be garbled.
- java.security.SecureRandom class
With the platform on which the /dev/random file exists, you obtain the random numbers generated by the OS from the /dev/random file using some of the API of the SecureRandom class. The random numbers are obtained from the /dev/random file when all the following conditions are satisfied:
- file:/dev/random/ is specified in securerandom.source in the java.security.egd property or in the java.security file
- The generateSeed() method or getSeed() method of the SecureRandom class is invoked
The speed at which the random numbers are generated for the OS is limited. Therefore, if you execute the process of obtaining the random numbers at short intervals, note that the processing does not finish until the OS finishes random number generation.
- Library path loaded in a java program
The paths specified for the libraries loaded with the java.lang.System.load method and java.lang.Runtime.load method are ignored, and the library is loaded from the path specified in the environment variables SHLIB_PATH and LD_LIBRARY_PATH.
- java.nio.MappedByteBuffer.isLoaded method
If you use the isLoaded() method that queries whether the direct buffer exists in physical memory, you cannot query whether a specific memory area exists in physical memory. The return value of the isLoaded() method is always false.
- java.lang.Thread.setPriority method
The priority order of each thread depends on the OS-based control. Therefore, even if you specify the priority order of the threads with the setPriority() method, the order is not enabled.
- Environment variable LANG
If a value other than the following values is specified in the environment variable LANG, the exception message output by the java.nio.channels package might be garbled:
- java.io.tmpdir property
Specify an existing directory with write permissions in the java.io.tmpdir property. The initial value of the java.io.tmpdir property is /var/tmp.
Also, with the dynamic class loading functionality of Java RMI and java.io.File.createTempFile() of the Java API, a temporary file is created in the directory specified in the java.io.tmpdir property. To operate the functionality normally, do not delete the creation destination of the temporary file while the JavaVM process is running.
(6) In Linux
This subsection describes notes for Linux.
- Single-byte Katakana
Among the characters established by JIS X 201, single-byte Katakana cannot be used with the GUI implementation using the JavaSE API.
- java.security.SecureRandom class
With the platform on which the /dev/random file exists, you obtain the random numbers generated by the OS from the /dev/random file using some of the API of the SecureRandom class. The random numbers are obtained from the /dev/random file when all the following conditions are satisfied:
- file:/dev/random/ is specified in securerandom.source in the java.security.egd property or in the java.security file
- The generateSeed() method or getSeed() method of the SecureRandom class is invoked
The speed at which the random numbers are generated for the OS is limited. Therefore, if you execute the process of obtaining the random numbers at short intervals, note that the processing does not finish until the OS finishes random number generation.
- java.io.tmpdir property
Specify an existing directory with write permissions in the java.io.tmpdir property. The initial value of the java.io.tmpdir property is /tmp.
Also, with the dynamic class loading functionality of Java RMI and java.io.File.createTempFile() of the Java API, a temporary file is created in the directory specified in the java.io.tmpdir property. To operate the functionality normally, do not delete the creation destination of the temporary file while the JavaVM process is running.
- Using the product with Red Hat Enterprise Linux 5.1
To use the product in an environment in which IPv6 of Red Hat Enterprise Linux 5.1 is enabled, specify true in the java.net.preferIPv4Stack property.