You need to install and configure Sun Java System Application Server 9.x or Project Glassfish

Instructions:

1. Go to the domains/domain/config directory of the application server installation.

You will find two JKS keystores located in the directory. One is called cacerts.jks and the other is keystore.jks. The cacerts.jks file is used to store the Certification Authority (CA) certificates. The keystore.jks file is used to store locally generated certificates. There is a default key located in both the keystores called s1as which is created when you install the application server.

To view the certificates in the keystore use the keytool utility as follows

keytool -list -v -keystore keystore.jks -storepass changeit

This will display the certificates in the keystore.

2. Import the CACert.org root (class 1) and class 3 certificates from here. Select the PEM format files and save them to the local drive.

NOTE: You will want to import these files into both the cacerts.jks and keystore.jks files. You will need the files in your keystore.jks file to import the signed certificate later.

5. You should get an immediate response on the site as well as an email with the certificate located in it. Copy the certificate from the site and save it in a file called signed.crt. The file should contain something that looks like the following.

6. We imported the CACert.org certificates so that we could do the next step without issues. We will want to import the new certificate to the keystore and combine it with our private key. We do this by using the same alias we assigned to the private key (keyEntry).

8. Configure the application server to use the new key. I try it on the HTTP Service --> HTTP Listeners --> http-listener-2. Select the security enabled, SSL3, TLS, and All supported ciphers checkboxes. Fill in the Certificate Nickname as server. Save and restart the application server.

9. Check the configuration by going to https://localhost:8181

FINISHED

Congratulations you are on SSL. Once I am sure that everything is working, I immediately set the admin site to use SSL/TLS as an important security measure.

Thursday, November 30, 2006

I have found that there is no really good description on how to download and install the FindBugs plug-in for Netbeans 5.5. The plug-in is part of a larger project on java.net called Software Quality Environment (SQE) If you want to use SQE and FindBugs. Do the following:

2. Navigate to the IDE Configuration --> System --> Autoupdates Types item in the tree. See below

3. Right click on the Autoupdate Types item to bring up the context menu. Select New --> General Update Center. This will bring up the menu below. I named my update center FindBugs and pressed Finish. See Below.

4. Click on the new FindBugs update center in the tree and change the Server URL entry to

Learn Collections and use them correctly. Use "lightweight" collections and avoid "heavyweight" collections where synchronization is not required.

Initialize objects using a constructor with the least amount of requirements. If you need to use a number of parameters other than the default values, consider using the inverse of the object. In other words, if the object contains an int which is initialized to zero (0), then use the object with the default value and treat initialization parameters as the exception.

Reduce the distance between objects during operation. It is better to perform complex operations locally.

Use System.currentTimeMillis() for performance measurements to determine execution time

Use the -verbose:gc flag on the JVM to determine if the heap size is too small.

Use constants where possible by using static final in the variable declaration.

Use Enum instead of integer constants. Enums are more flexible and are typesafe.

Avoid casting and using instanceof

Use synchronized methods instead of code blocks.

Avoid synchronized calls within a synchronized method or code block.

Avoid using synchronization over IO operations except as required to maintain correct operation. For example: JPA inside a servlet.

Turn off auto-commit and use transactions to improve throughput.

Use -Xms and -Xmx flags to set the minimum and maximum heap sizes. Try to size appropriately to prevent wasting resources.

J5SE

Looping

Do not recalculate constants inside a loop.

"Fast Fail" - If a method fails, or throws an exception have it exit the loop quickly. Break loops early.

Use local variables in loops. javac can assign an exact location of a local variable for a method at compile time.

Strings

Avoid using Strings when you are modifying them. Strings are immutable. Therefore to "modify" a String, object creation and destruction must occur. Use StringBuilder and StringBuffer when Strings must be modified.

Create Strings using the short form syntax to avoid creating additional objects.

For example use: String s1 = "ABC";

instead of: String s1 = new String("ABC");

Never use String or StringBuffer for parsing characters. Use a character array.

Try to set the StringBuilder or StringBuffer to the size required, or maximum size required during initialization to prevent a performance penalty while resizing.

Avoid using StringTokenizer if there is a performance requirement. Use a more specific (custom) tokenizer to split Strings. StringTokenizer is a generic utility that is synchronized internally.

Use StringBuilder instead of StringBuffer unless synchronization is required.

Collections

Avoid using generic object collections. Use generics with collections to avoid having to cast objects.

Use a LinkedList over an ArrayList if there a large number of insertions and deletions.

Use a HashMap instead of a TreeMap unless there is a requirement to maintain a sort order.

Use a HashSet over a TreeSet unless there is a requirement to maintain a sort order.

When using Vector, try to set the initial size to the expected maximum size to prevent having to grow the Vector. If you must grow a Vector use a reasonable value to increase the size.

It is extremely important to try to appropriately size a HashTable to prevent reorganization.

J5EE

Reduce the number of network operations by returning complete results rather than smaller intermediate results.

If database design constraints impose a specific database, use the advantages of the database where possible.

If operations are performed on the database, consider using stored procedures and making JDBC calls.

Do not use Entity Beans unless you must, use Java Persistence API (JPA) instead.

Do not use Java Persistence API (JPA) unless you need it, or want to use some of its advanced capabilities.

Limit the subset of data required to the minimum required for your program. Do not pull a whole row of data from table when you require only a few fields.

When given a choice use local interfaces and local method calls on EJBs

Shorten the distance between servers. Try to maintain dependent servers as close as possible. In clustered environments, try to keep remote communications on a separate private network interface.

It is generally better to use a coarser stateless session bean to avoid JNDI lookups for fine grained operations.

Avoid stateful session beans except as necessary.

Set timers for non-activity on stateful session beans as low as possible to prevent "dead" connections waiting to timeout.

Use Data Transfer Objects (DTO) to maintain granularity. DTOs must be Serializable.

Tuesday, October 31, 2006

I completely removed Netbeans including all directories in my home folder. I also removed glassfish and started with a complete new installation.

Once I performed the installation, everything worked as it was supposed to do. The only difference between this install and the previous installations was that I downloaded updates to the IDE after installing and before I installed the Enterprise Pack.

I could not reproduce which I could do consistently two days ago. I have installed the updates and it continues to work. I closed the issue on Issuezilla.

Sunday, October 29, 2006

Which to use for a particular application depends entirely on the environment, or preference.

@PersistenceUnit annotation is used in J5SE applications to handle Java Persistence API (JPA) persistence management. You may use a PeristenceUnit in an application inside a container, but it must be managed by the developer instead of the container.

@PersistenceContext annotation is used for Container Managed Persistence (CMP). This relieves the developer of having to worry about connection management.

Netbeans 5.5 was released today. The new visual web pack preview is included. The visual web pack provides the same level of functionality from Creator 2 to Netbeans. I am so excited to get it running on my Mac.

The visual components of JSF are realized for the first time in Netbeans. So far the only thing I do not like is that Creator 2 projects are not interchangeable with Netbeans. If you Open a Creator 2 project in Netbeans it will not work again in Creator 2.

I installed the Enterprise Pack with an existing installation of Glassfish 9.1 (V2 Build 19 Milestone 2), and the server would not start. I tried a number of things but it appears some corruption occurs. If you use the default included application server everything works as expected.

Saturday, October 28, 2006

I was just trying to decide if I wanted to open a Blogger account, and I selected a random person going by... Little did I know I would pick someone from my home state who does not live very far from me. Rachel Parker is her name and here is her blog.

Strange coincidence...or fate. One can never tell, but it was definitely the deciding factor. I shall leave it as providence.

Finally I have had a chance to complete the steps required to graduate the GreenJUG site from the java.net incubator. I still need lots of assistance from the Java user community to make our JUG a success, but this will come with time and perseverance.

I have asked for some items to give away at meetings from Sun, O'Reilly, and JetBrains. Sun and O'Reilly have really stepped up to offer a bunch of goodies. We will see if JetBrains will offer some goodies.