WSS4J on Mac OSX Fix

I have been having a heck of a time with using anything on my Mac OSX that uses the WSS4J Web Services Security file. I have been trying to use the WSS4J that is used in SoapUI and Apache CXF. I had all of these projects setup and working without fail, then all of a sudden everything just stopped working.

After doing some research I found that Apple decided to change the Java cacerts keystore default password from “changeit” to “changeme”. Since WSS4J tries to connect to the cacerts keystore first with the default password of “changeit” the applications throw a exception and never try to load my local keystores.

To fix this issue, I went to /Library/Java/Home/lib/security/ and ran the following command to change the keystore password back to “changeit” which fixed all of my issues.

sudo keytool -storepasswd -new changeit -keystore /Library/Java/Home/lib/security/cacerts -storepass changeme

I really don’t know why Apple decided to change the default password of the cacerts keystore from what ever other version on the planet is, but I sure hope that they change it back.

Posted on May 13, 2010 by Mike Jennings in Java | 0 Comments | Permalink

Maven Complaining about jms-1.1.jar; cannot read zip file

I have a project that I am converting over to maven. Everything was going great until I decided to add log4j into the mix. When I added log4j version 1.2.15 as a dependency and tried to compile my project, I got the following error.

[INFO] ------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------
[INFO] Compilation failure
error: error reading /Users/gjenning/.m2/repository/javax/jms/jms/1.1/jms-1.1.jar; cannot read zip file

I don’t know why log4j caused a issue with the jms-1.1.jar file and throws a fatal error, but it does. To fix this issue, all I had to do was change the log4j dependency version from 1.2.15 to 1.2.14 and all now works great.

Posted on Mar 26, 2010 by Mike Jennings in Java | 0 Comments | Permalink

Using OGNL to access Static Methods in Struts 2

One of my favorite things that OGNL can do in WebWorks and Struts 2 is call any static method using the OGNL scripting language. You can do this by using the notation

@classname@methodname(arg)
This in the past has worked great for me, but when you are using Struts 2.1.x there is a new properties value that needs to be added to your struts.properties file. Add the following line:
struts.ognl.allowStaticMethodAccess=true

This value is set to false by default, so you are not able to access static methods. Since I was not aware of this, I wasted about a hour trying to hunt down why the method was never being called.

The good thing is that you can still access static constants using OGNL by calling

@classname@CONSTANT

For more info on this change check out JIRA WW-2160

Posted on Aug 24, 2009 by Mike Jennings in Java | 0 Comments | Permalink

Eclipse 3.5 is very nice

I recently got really pissed off at Netbeans 6.1 while I have been developing some projects. Every time I tried to save a workspace and create a new one, everything would go all haywire. I would have to re-import my code into a blank project, and just pray that everything would continue to work if something changed. Well since a new version of Eclipse has recently been released, I figured why not give it a shot.

Well off I went to go and download Eclipse and see what new things would be incorporated into the new release. I will have to say that this release of Eclipse is really nice. I have been very impressed with it and the Eclipse community in a whole. Not only is the new version very stable, the community has rapidly updated there tools to work with this new release.

I will say that one of the best additions is the Java Import feature. In previous releases, if you did not import a Jar, it would not tell you in a little drop down bubble and allow you to select that jar. Now it is part of the code completion bubble, which is how most other ide’s work.

I am running this software on my Mac, which did not really work very well in the last release. This release works flawlessly on my Mac, which is a big relief as well.

Posted on Jul 03, 2009 by Mike Jennings in Java | 0 Comments | Permalink

java.lang.OutOfMemoryError: PermGen space Errors in OC4J

The "java.lang.OutOfMemoryError: PermGen space seems to be something that happens a lot to me when I run the standalone oc4j on my local desktop. It seems to happen more and more to me now, especially when developing large enterprise applications. As this is a annoying error it is also one that is easy to work around.

To fix this you will need to modify the oc4j startup script to give the JVM more memory. To do this go to you will to locate the the “oc4j.cmd” file. On my computer it is in ORACLE_HOME/bin. In this directory there should be two files, a “oc4j” and a “oc4j.cmd” file. These files are used to start oc4j. One for Windows and the other for Unix. Modify these files and make the JVMARGS variable look like this.

JVMARGS=-Xmx512m -Xms512m

Now when you start oc4j you will have more memory in the JVM allocated to OC4J.

Posted on May 03, 2009 by Mike Jennings in Java | 0 Comments | Permalink