Technical Tips

We have created a series of Questions and Answers section to help current and new users take advantage of all features the Wrapper can offer. A Newsletter is sent to our users announcing the latest Technical Tips for the Java Service Wrapper. Each issue contains tips explaining how to use the powerful features of our product.

Index

How can I distribute the Java Service Wrapper and my Java application to different platforms?

The Delta Pack bundles the binaries and libraries required for the Wrapper to run on all supported platforms *. It also contains the Windows Bat files and Unix Shell script used to launch the Wrapper. Use of these scripts make it easier to launch the Wrapper as they will automatically select the appropriate binaries for the current platform. In other words, they let you launch the Wrapper in a transparent way, using the same commands across the different UNIX platforms (Windows using separate bat script files).

With a single configuration file, you will be able to configure the Wrapper to run your Java Application either as a console application or as Windows Service/Unix Daemon on the different OSs. It is also possible to have platform-specific configuration whenever the need arise.

The Delta Pack is available in all editions starting from Version 3.2.0.

Click here for the full article.

Understanding the DEP and ASLR Windows security features.

Starting with version 3.5.33, the Wrapper specifies that its binaries are compatible with the Windows Data Execution Prevention (DEP) feature, and indicates that it should be randomly rebased at load time by the OS using the Address Space Layout Randomization (ASLR) feature.

The use of these two features has no noticeable performance impact and allows the Wrapper to run in a much safer way. DEP marks memory regions allocated by the Wrapper as non-executable and thus prevents shellcode that would be injected by malware from being executed. ASLR protects against buffer overflow attacks by randomizing the locations of different parts of the program in memory. Every time the Wrapper runs, the stack, heap, and libraries are moved to a different address in virtual memory so that attackers can no longer learn through trials where their target is.

Click here for the full article.

The Java Service Wrapper makes it easy to turn almost any Java application into a Unix Daemon in minutes.

Usually, Java applications are run in a terminal on Unix systems. This requires a user account to be logged on to the system at all times, and a command prompt to be open.

There are several drawbacks to this, ranging from security, to system performance, to simply having the risk of a user pressing the wrong key on the command prompt and killing the Java application.

The Java Service Wrapper addresses these issues by making it possible to install your Java application as a daemon. It offers automatic detection of service management tools (also known as init systems) available on your OS, or lets you configure a specific system to use when launching your application as a daemon. Running as a daemon means that your application will run in the background, be launched on system startup automatically, and shutdown cleanly when the system shuts down.

Click here for the full article.

The Java Service Wrapper helps you configure your Java application so that it will always run on a designated subset of processors.

Normally it is left up to the operating system to decide which CPUs or cores of the machine will be used to run an application. Depending on the number of threads required by the application at any given time, and the needs of other applications, the OS will try to move threads around as needed to keep the overall load on each CPU balanced.

Dedicating specific CPUs to your application can be a way to ensure that it will always have enough CPU resources. On the contrary, you could explicitly keep some processors unused in order to guarantee sufficient resources for other processes running on the same machine. In this Tech Tip, we will show you how Java applications will always run on a designated subset of processors.

Click here for the full article.

The External Tools menu in Eclipse can start the Java Service Wrapper.

server It is possible to run the Java Service Wrapper as an external tool to test your application from Eclipse. This saves you from switching windows each time you want to launch your application with the Wrapper.

Click here for the full article.

Add a remote Java application in the Debug Configuration in Eclipse.

Deadlock Eclipse(R) has a great set of tools such as the debugger. A debugger allows a user to control a program while it is executing. Using a debugger to understand how a program works is a good way to find potential bugs. The debugger can be remotely attached to a JVM running in the Wrapper and you can see step by step what is happening. In the following example, you will see how the debugger is easy to setup.

Click here for the full article.

The Java Service Wrapper includes automatic Crash detection, reporting and recovery.

Recover Java as a language was designed to make it impossible for user developed code to result in an application crash. Any error would result in a nice clean exception being thrown which could be caught, and then handled appropriately.

The reality, as any long time Java developer or system administrator knows, is that the Java Virtual Machine (JVM) itself can and does crash. This is because the JVM is itself a program written in native code, and like any very large complicated program, the JVM has some bugs in it.

Click here for the full article.

The Java Service Wrapper provides a number of methods to cleanly shutdown an application from both internal and external sources.

CTRL-C When people first start using the Java Service Wrapper, they are usually interested in how to integrate their application with the Java Service Wrapper to run as a Service or to have their application monitored. Once an application is setup and integrated with other systems however, the question of how to shutdown often comes up.

In this Tech Tip, we have gone through the API and collected all of the various ways you can shutdown the Wrapper in one place. There are probably a few tips which even experienced Wrapper users are not aware.

Click here for the full article.

The Java Service Wrapper provides the ability to schedule a number of actions with timers.

Timer

Many large applications require the ability to run scheduled tasks or perform actions at specific times or at regular intervals. The problem is that different OS platforms each provide their own way of scheduled actions. When the application needs to be able to run across all of those platforms it is often necessary to implement this functionality for each platform individually.

In this Tech Tip, we will introduce you to Wrapper timers, which make it possible to schedule all kinds of actions in a platform independent way and then deploy them with the rest of your application.

Click here for the full article.

The Java Service Wrapper includes automatic Freeze detection, reporting and recovery.

Freeze When a mission critical system starts hanging or freezing, it can be a nightmare situation for the system administrator, development team, and everyone who makes use of the system. Identifying and fixing the problem can take days or even months in some cases. In the meantime, the system is in active use and needs to stay running.

For many organizations, every minute a system is down not only has a direct effect on sales, but also on the reputation of the organization and teams managing the system. In most cases the Java Service Wrapper freeze detection, can reduce downtime from hours to seconds so end users are often not aware that there was ever a problem.

Click here for the full article.

The Java Service Wrapper has the ability to map network drives and printers for your services.

Mapping In Windows environments, it is common for users to map network drives and printers so they can be accessed by their local system. Windows Services often have the same requirements, but Windows makes it very difficult for services to access those shares when the service is launched on system startup. Often services will have access to shares when started in a running system, but the shares will not be accessible when the system is rebooted.

The Java Service Wrapper makes it possible to configure and access network drives and printers reliably without the need for a user to be logged in.

Click here for the full article.

The Java Service Wrapper makes it easy to turn almost any Java application into a Windows Service in minutes.

Java App Server Java applications running on Windows systems tend to be run in a console on a Desktop because of Java's lack of the ability to run as a Windows Service. This has a number of disadvantages; security issues because a user is logged in, system performance due to the unwanted Desktop, and the simple risk that a user might press the wrong key and affect the console, to name a few. Many applications solve these problems by running as a Windows Service, all without the need to write a single line of code in most cases.

Click here for the full article.

The Java Service Wrapper includes automatic Deadlock detection, reporting, and recovery.

Deadlock Most applications go through a series of rigorous tests before being deployed or released. As we all know, however, in the real world unexpected problems can be encountered. Unfortunately, one common problem with large multi-threaded applications are deadlocks. They can be fatal and very difficult to track down and fix.

The Java Service Wrapper includes the ability to automatically monitor your application for deadlocks in a very light weight way, which causes almost no change in performance. When a deadlock is detected, the Wrapper is able to immediately respond in the way you want it to. At the same time, it will also record the precise conditions of the deadlock so a developer can easily fix it.

Click here for the full article.