I recently came across a new tidbit of info while working with the Date class in the GDK and I thought I would point it out real quick. I wanted a easy way to compare two Date objects while disregarding time. One to represent today’s date and the other to represent a future date. So I took a look at the GDK docs for the Date class and I noticed that since version 1.5.7, Groovys’ Date now has a static parse(..) method and a instance format(..) method which worked out nice for me in terms of writing less code. Here is a snippet of my code:
def myFormat = 'MM/dd/yyyy'
if Date.parse(myFormat, '02/03/2009') >= Date.parse(myFormat, new Date().format('MM/dd/yyyy')) {...}If you did Date comparisons using regular Java, you would know that you couldn’t get away with something like this. I’m loving Groovy more and more everyday.
If you have an even shorter or more succinct way of coding this simple comparison, please share it.
I just wanted to write up a quick note about an issue I recently had regarding looking up a JNDI resource from another Seam webapp in JBoss 4.2. I installed Day CRX as a war into a development JBoss server and followed all the directions that were given from Day’s documentation including changing the Java2ClassLoadingCompliance property to true in the
After completing all the steps, I still could not do a lookup on that name (crx) as I would continously receive NameNotFoundExceptions no matter what I tried. At first I thought maybe my spring configuration was wrong, but I then noticed that Spring was finding it, and saw that the MemoryInitialContextFactory that Day uses was the one throwing the error. I was puzzled to say the least, but realized it had to be some kind of classloading issue.
To wrap this up, I finally got everything to work by doing two things. First I had to put the crx-shared-1.4.0.jar and the jcr-1.0.jar into the server/lib/endorsed folder and not the server/lib like the documenation stated. The other piece to this is Seam overwrites the Java2ClassLoadingCompliance property in a file called WEB-INF/jboss-web.xml and sets it to false. I ended up changing that to true and everything started to work.
If you know a reason why I shouldn’t do what I did or you know another way to get a successful JNDI lookup without having to set Java2ClassLoadingCompliance to true, then please let me know.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jun | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | |||