Skip to content

Getting Glassfish stdout logging under control


By default, Glassfish does an ugly thing: takes an application’s stdout/stderr and wraps it into its own log with INFO level for stdout and WARN level for stderr. Other logging facility normally log to stdout. In the end, a log entry looks pretty stupidly (and it’s damn multiline!): [#|2012-11-21T11:25:07.225+0200|INFO|glassfish3.1.2||_ThreadID=100;_ThreadName=Thread-2;|11:25:07.225 [http-thread-pool-8080(2)] DEBUG c.mycompany.packages.SomeClass – Finally, some […]

Hibernate join bug


Hibernate bug 1895 seems to be still there since 2006. If, for instance, in Grails, such a syntax won’t work for you (it won’t): def books = Book.findAll(“FROM Book AS b JOIN Chapter AS c WHERE = :isActive”) with a NullPointerException in “HqlSqlWalker.createFromJoinElement” — just use alternative join syntax, via WHERE: def books = […]

Grails: mocking domain objects in unit tests


We’re trying Grails, Rails-like web application framework for Java. It’s fine, just that Groovy debugger support is, er, imperfect, even in the best Gruoovy IDE – IDEA. And, if you want to unit test, you won’t have fancy domain class methods addTo* – like Customer.addToOrders(). They’re generated by Grails on startup. In order to have […]

Closures in mainstream languages


C# has closures, you know? A sample of how to use one.

Broken HTML parsing in Java


Given: HTML code, non-valid and non-well-formed. Make it a well-formed XHTML, in Java. We considered JTidy, but it’s source looked too messy and hacky. I looked for a parser that could correct XML – not in sense of schema, but correct any mistakes, and pass out a well-formed XML and error list. I was able […]