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 02, 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

How To Integrate OIOSAML.JAVA with your Tomcat J2EE Application

Here are some step-by-step instructions on how to integrate the OIOSAML.JAVA with you java application so authentication can be preformed via a Shibboleth 2 IdP. This integration is assuming that your java application is being deployed to a Apache Tomcat Server, you are familiar with Shibboleth IdP's and SP's, and that you have access to the necessary IdP information that you will need.

[Read More]

Posted on Feb 03, 2009 by Mike Jennings in Java | 1 Comments | Permalink

Webinar: Apache Tomcat Tips and Tricks from the Pros

There is a nice webinar being hosted by the guys at SpringSource:


Webinar: Apache Tomcat Tips and Tricks from the Pros

On Tuesday, November 25th, join Apache experts and committers Mark Thomas and Filip Hanik as they outline top tips and tricks to make management and administration of Apache Tomcat easier, faster and more productive. This webinar will cover:

*Setting up your Apache Tomcat infrastructure for large scale deployments
*How to upgrade and easily rollback different Apache Tomcat and JVM versions
*How to migrate your Apache Tomcat configurations during upgrades
*Apache Tomcat connector configurations
*Best practices around virtual host configurations in Apache Tomcat
*Undocumented configurations options

When
Tuesday, November 25, 2008
1:00pm EST/10:00am PST

REGISTER NOW

Posted on Nov 20, 2008 by Mike Jennings in Java | 0 Comments | Permalink