Wednesday, December 17, 2014

XRebel 1.2

Just released XRebel 1.2. It is amazing, astonishing, splendid, beautiful, awesome, beautiful, beautiful, beautiful! :) I'm most pleased with its ability to show the relation between ORM-level events/queries and the generated SQL queries that are executed via JDBC. Like this:

Or even like this:

The cool part is that even with no special requirements to filtering, the call tree scales very well - the user could see the compact call stack with relevant branching points starting from the incoming HTTP request towards the JDBC calls, or NoSQL... or outgoing HTTP invocations.. even RMI!

/me happy! :)

Saturday, December 6, 2014

Java EE meets Kotlin

Here's an idea - what if one tries implementing Java EE application with Kotlin programming language? So I though a simple example, a servlet with an injected CDI bean, would be sufficient for a start.

Start with a build script:

And the project structure is as follows:

Here comes the servlet:

What's cool about it?

First, it is Kotlin, and it works with the Java EE APIs - that is nice! Second, I kind of like the ability to set aliases for the imported classes: import javax.servlet.annotation.WebServlet as web, in the example.

What's ugly about it?

Safe calls everywhere. As we're working with Java APIs, we're forced to use safe calls in Kotlin code. This is ugly.

Next, in Kotlin, the field has to be initialized. So initializing the 'service' field with the null reference creates a "nullable" type. This also forces us to use either the safe call, or the !! operator later in the code. The attempt to "fix" this by using the constructor parameter instead of the field failed for me, the CDI container could not satisfy the dependency on startup.

Alternatively, we could initialize the field with the instance of HelloService. Then, the container would re-initialize the field with the real CDI proxy and the safe call would not be required.


It is probably too early to say anything for sure, as the demo application is so small. One would definitely need to write much more code to uncover the corner cases. However, some of the outcomes are quite obvious:

  • Using Kotlin in Java web application appears to be quite seamless.
  • The use of Java APIs creates the need for safe calls in Kotlin, which doesn't look very nice.

Thursday, October 30, 2014

Deploying Spring Petclinic demo application to JBoss/WildFly

Spring Petclinic is a very good demo application to experiment with - it is simple enough, yet demonstrates quite a good number of features. Usually I deploy it to Tomcat and obviously don't have any issues with it - it just deploys, runs, and works as expected.

Recently, however, for demonstration purposes, I needed to deploy this application to JBoss (or WildFly). And this is not as straightforward as one might expect.

First I tried with JBossAS 7.1.1.Final. The deployment fails with the following exception:

11:42:38,247 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/petclinic]] (MSC service thread 1-3) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [spring/business-config.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
  at [spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE]
  at [spring-beans-4.1.1.RELEASE.jar:4.1.1.RELEASE]

The latest Petclinic application (as of October 2014) uses JPA 2.1 and JBoss 7.1.1 bundles JPA 2.0 APIs. So I decided that it should probably work out of the box on WildFly since it comes with JPA 2.1 jars. And it did - the application deployed just fine, but then there's another library that prevents the application from operating properly - Dandelion:

Exception starting filter dandelionFilter: com.github.dandelion.core.DandelionException: The protocol vfs is not supported. 
        at com.github.dandelion.core.utils.ResourceScanner.scanForResourcePaths( [classes:] 
        at com.github.dandelion.core.utils.ResourceScanner.findResourcePaths( [classes:] 
        at com.github.dandelion.core.bundle.loader.spi.AbstractBundleLoader.loadBundles( [dandelion-core-0.10.0.jar:] 

The issue was reported but at the time of writing this post the fix wasn't published yet. So hopefully Dandelion v0.11.0 will be capable to be deployed on WildFly.

So to overcome this and deploy Spring Petclinic (at the state of October 2014) to WildFly 8.1 one would have to get rid of the dependency on Dandelion, and rewrite some of the JSPs not to use Dandelion taglibs. Then the application deploys and works just fine.

So after making all the fixes I got Spring Petclinic running deployed to WildFly and could monitor it with XRebel:

Saturday, September 6, 2014

JCrete 2014

I had a honor to take part of the discussions at the JCrete unconference.

JCrete 2014 - The Hottest Java Conference in the World (literally) from Heinz Kabutz on Vimeo.

Geerjan Wielenga has written a good overview of the event in his blog, and so did Yakov Fain. I'd like to second their opinion on the fact that JCrete is awesome.

The event is invite only, and this makes sure that the crowd that gets together has a very good motivation to collaborate on ideas, discuss various topics - all the attendees contribute to the event, everyone is a speaker!

I have attended many discussions in the official part - at the scheduled sessions. But there was also "unofficial part" - the discussions were happening everywhere: in the car while driving to Falassarna, at the beach after lunch, at the dinner. So the density of useful information and ideas you get at this event is very high!

I have attended the discussions about Gralde, developer tooling, profilers, JIT & JITWatch, Java 8 lambdas, sun.misc.Unsafe, Asciidoctor, hardware performance counters, GC- and lock-free programming, and maybe some more. There's a wiki page that includes notes for the various sessions, contributed by the attendees.

The dates for JCrete 2015 are already announced, so if you like geeky discussions, Mediterranean sea and olive oil - I definitely recommend to attend the event.

Friday, August 22, 2014

MVC in Java EE

Java EE is getting MVC. And the crowd is going wild! :)

I'm actually quite positive about this move, although this came a little too late, in my opinion. Java EE has been criticised for not having MVC support, but it stayed opinionated and sticked with JSF. Apparently, MVC is actually a part of JAX-RS, so to speak. Not in the same spec though, it it will have integration points with JAX-RS. And there's also some sort of MVC support in Jersey already.

It is actually cool that it happened, just surprising that it took so long.

Friday, July 18, 2014

IntelliJ IDEA: Have you tried Search Everywhere yet?

The Search Everywhere action, invoked with double Shift key press, was added in IntelliJ IDEA version 13. I guess, most of the IDEA users/fans know about this feature and are enjoying it. At first glance, it just provides the means for search. You can search "everything": classes, files, symbols, actions, settings, etc. However, Search Everywhere widget is full of easter eggs.

Try using to jump between the search result groups. Or try left arrow to navigate in the history of search entries. But also, depending on the nature of the item that was found, the widget can provide some extra actions, like in the screenshot below: the "Show Navigation Bar" entry has an extra switch - on/off - showing that you can actually invoke this action.

Search Everywhere is a little gem in IntelliJ IDEA and all its features are yet to be discovered ;)

Saturday, June 14, 2014

Tuesday, June 3, 2014

RebelLabs: Java Tools and Technologies Landscape for 2014

A great report on Java Tools and Technologies, aka JavaTnT :), was published just recently. As usual, one may say that those is a "biased" numbers. Well, the numbers might be biased. But it is not really clear, the bias agains/towards what?

There are discussions at Reddit and Hackernews about the report. Some would say that the numbers are legit. Some would say that the numbers do not make sense. Of course, the numbers do not make sense if you don't like them ;)

In any case, the results present the JavaTnT landscape pretty well. It would be nice if more people would care to enter their data during the survey instead of arguing about the numbers afterwards. Oh well.. first world problems :)


At DevNation event I picked a very nice device - Mbed NXP LPC1768 and a Xively development board. It is surprisingly easy to program: you don't have to install any software on your own computer - just log in at website, they provide a web-based IDE. The compiled program can be downloaded directly into the host device via USB (just like if it was a flash drive). When the device is reset, the latest binary is picked by the system and executed. Embedded programming have never been easier! :)

DevNation 2014: post factum

DevNation was fun. It would have been even more fun it it wasn't co-located with Red Hat Summit. It basically fell into the same trap as JavaOne with Oracle Open World - being just a side event of the "real" conference.
The schedule was actually awesome but lots of talks didn't receive the attention they deserved due to the dispersed focus and many parallel tracks. The event really has a great potential to become the next big even for Java (and not only Java). There are quite a few videos available from the talks. Here are some interesting ones:

Neal Ford - Opening Keynote: Agile Architecture and Design.

Jason Greene - JVM Finalize Pitfalls: How to Avoid the Danger

 The positive side of DevNation event is definitely the location. I love San Francisco - very nice city!

Friday, March 21, 2014

DevNation 150OFF

A sneak peek into my session about JRebel at DevNation conference in San Francisco :

Check out the full schedule here:

Register with promo code 150OFF and get $150 off the registration fee!

Thursday, February 27, 2014

GeekOUT Conference Early Bird Registration is Live!

Registration to GeekOUT conference in Tallinn is now open! Geekout in numbers:
  • 15 amazing invited talks
  • 14 great speakers
  • Hand-picked vendors @ Demogrounds
  • Kickass party
And a special extra: Reactive Programming workshop with Erik Meijer!

Monday, February 17, 2014

Java 8 Lambdas - The Unintentional Puzzle

I was tinkering with Java 8 lambdas just lately. It happened to be an early morning on a bus from Tallinn to Tartu and I probably didn't sleep enough the night before. So I managed to puzzle myself with this little piece of code:

I actually expected it to print "Hello, lambda!" when executed, but it didn't. Can you figure out why? This is a very simple puzzler, and a very silly mistake that I made. I shouldn't have used the method reference to initialize the runner variable of RunForrestRun class. However, while the example is very simple, it actually shows that the new features do bring some accidental complexity into the language.

Wednesday, February 12, 2014

IntelliJ IDEA for Eclipse users

Finally! With help from the awesome RebelLabs team, I present you the Getting Started with IntelliJ IDEA as an Eclipse User report.

If you're an Eclipse user and considering to give IntelliJ IDEA a try - this is the finest read for you! If you're a convinced Eclipse (or NetBeans) user and not considering to switch to IntelliJ IDEA, still, you might learn something interesting from this report. If you are an IntelliJ IDEA fan, yet, you can find something interesting from this read.

Friday, January 10, 2014

Speaking at Jkofus 2014: Apples and Oranges

I will be speaking at Jfokus in Stockholm, on February the 5th. This is a fun talk again, about the IDEs. I'll be presenting the IntelliJ IDEA part along with Geertjan Wielenga (NetBeans) and Ken Walder (Eclipse).

Thursday, January 9, 2014

Speaking at DevNation in San Francisco, April 13-16

I will be speaking at DevNation conference in San Francisco.

The conference is co-located with Red Hat Summit so it's going to be a big one!

Disqus for Code Impossible