Java

Oracle Java in Linux - The easy way

Since Oracle Java can no longer be available in the various Linux distributions, for licensing reasons, a number of more or less complicated guides have been written about how to install Oracle Java manually. This is another such guide, but less ambitious and hopefully easier to understand and use. It only describes how to install the JRE (the Java Runtime Environment), integrate it with Firefox and create a shortcut to the Java Control Panel.

Importing site certificate into Java Runtime certificate store

When your Java program attempts to connect to a server that has an invalid or self signed certificate, such as an application server in a development environment, you may get the following exception:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

To make your Java runtime environment trust the certificate, you need to import it into the JRE certificate store.

Debugging bean customizers and property editors in NetBeans

When you are developing GUI components you may want to create some nice bean customizers and property editors for them. But how do you debug them? The NetBeans developers may smile at this, knowing that there is a much better way, but I don't so smile away...

The trick is to start a new NetBeans instance in debugging mode. This is a built in feature of NetBeans module projects so we first need a simple NetBeans module. It doesn't have to do anything so you can create it in less than a minute using the New Project wizard:

Cherry Linux keyboard and Java

Since I couldn't get the KeyMan utility that came with my Cherry keyboard to work with SuSE 10.3 I had problems getting the Cut, Copy and Paste keys to work. I tried using the KDE KHotKey service instead, and by defining input actions that map these keys to Ctrl+X, Ctrl+C and Ctrl+V I could use them in most applications.

Starting with Java 1.6 though, this isn't enough. Seems like Java can't handle mappings made for KHotKeys. To get the keys to work with Java applications I had to do two things:

Preventing remote access to datasources

When you define a JDBC connection pool in Glassfish (AKA Sun Java System Application Server 9) and JDBC resources for it, you usually include a user name and password as pool properties.  You may think that this information is available only to deployed applications, but in fact anyone with IP access to the servers ORB port (3700 by default) can fetch the entire datasource definition using a simple JNDI lookup. If the database server is also accessible, then you have a security problem.

Using Apache as a proxy to access a J2EE web application

OK, you have created a great web application and now you want to expose it to the world, or perhaps a limited subset of it. You probably don't want to allow full access to your application server so you need a proxy.

The apache proxy module (mod_proxy) can be used with a simple configuration like below:

<IfModule mod_proxy.c>

<Proxy *>
  Order allow,deny
  Allow from all
  SSLRequireSSL
</Proxy>

Pages

Subscribe to RSS - Java