Upgrading to Tomcat 8.0.24

If you upgrade your Tomcat installation to 8.0.24, released on July 6th, and all your POST requests suddenly starts to fail, check

 maxPostSize

of your connectors.

The Tomcat team actually fixed it’s behavior:

The meaning of the value zero for the maxPostSize has also been changed to mean a limit of zero rather than no limit to align it with maxSavePostSize and to be more intuitive

The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than zero. If not specified, this attribute is set to 2097152 (2 megabytes).

I had a 0 (zero) in it… That means absolutely no post data. If the setting makes sense or not is irrelevant, it’s correct that way. So, if you’re post requests fail and you wanted to disable the maximum post size, set it to -1.

Ah, and by the way, since Tomcat 8 you can drop the spring-instrument-tomcat module and the stanza in context.xml:

<Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/>

Tomcat 8 supports load-time weaving of aspects out of the box and for me, having that module on the class path and using the Spring provided class loader, weaving didn’t work.

| Comments (2) »

15-Jul-15


Inaugural talk at EuregJUG

euregjug-smallEarlier this year Stefan Pfeiffer aka @dl1ely approached me, if I would be interested in a Java User Group (JUG) in Aachen, set up as a cross-border, english-language JUG. My spontaneous reaction was something like “sure, great idea”.

Becoming a group member of the iJUG was pretty straight forward, something i wanted to do as an individual for a long time. Thanks to bitstars, we had a room near Aachen centrum, drinks where provided by my company ENERKO Informatik and thanks to O’Reilly in person of Corina we also had some books to raffle.

Our first guest was Bert Ertman, Java Champion and Rockstar and currently fellow at Luminis and he talked about “Building Modular Software Development in the Cloud Age using OSGi”:

DSC03391

The title of his talked was only missing Docker and Microservices to win the buzzword bingo of the day, but actually, the talk was great and really informative, even for people like me who never did anything with OSGi in 13 years.

Slides of the talk are at Slideshare, but then, you’re missing the great demo using components from Amdatu inside Apache Felix.

The evening was a great opportunity getting in contact not only with a great Speaker and software developer but also getting to know more Java aficionados in the Euregio. Becoming a great developer is more than only knowing that stuff you need to know for your everyday work and yesterdays evening was a good start to broader that knowledge and i’m really happy that we could announce Geertjan Wielenga from Oracle as our next speaker at EuregJUG Maas-Rhine.

Thanks to all people involved so far 🙂

| Comments (0) »

29-May-15


#Java20


Blogcake

My part of 20 years of Java spans at least 12 years and started somewhat in 2003.

I was hired after my apprenticeship and university by ENERKO Informatik where i still work. ENERKO back then was a totally Oracle shop, Oracle Database, Oracle Case and Designer and Oracle Forms, so no wonder that my first “own” project at the end of 2002 was a Forms 6i project.

I did some Java in university, but not much. My studies took place in FZ Jülich, we learned Fortran 90, C and some C++. What i see from Java Back then was slow, clumsy and after all, complicated .

Back at ENERKO, my Forms project went really well (actually, it was just replaced by a Vaadin application 3 weeks ago, more than 10 years in production oO). I remember my boss coming to me, drawing some lines on a paper, it must have looked something like this:


ihl

The black dots and lines are power rods and power lines and the “parallel” grey ones are the “right of the way” along the route. Question was, if I could image computing the right of the way and also display it in some way, preferable in SVG (someone else suggested that).

Thats where i really started digging into Java. Computation was easy and parts of the original algorithm are still alive. First application was a ugly, hacked together Swing thing with Apache Batik used for display SVG. It was awful, but it work.

I took a first Java course at trivadis to get Swing (and AWT, does anyone remember that?) right and things got slightly better. SVG didn’t work out for us and thus our Swing based Graphic Framework for drawing arbitrary things came into life (pretty much everyone created them at their first OO course, or?) which is still used today. My colleague Andreas did a great Job since 2010 getting new features into it and preparing it for the future.

I’d love to show some screenshot, but it’s a customers project. TransnetBW GmbH and Netze BW use it for nearly a decade now to support projecting their power grids (mainly 220-kV and 380-kV).

What i could used to was hearing “Java and Swing” is slow over and over again. Yes it was slow, not it isn’t slow anymore. And thats just it. It works really, really well.

IDEs. I wrote a lot about them in my NetBeans testimonial. Back in 2004 or so, Eclipse was my preferred tool and still i must say, kudos to all the Eclipse developers. I certainly cursed a lot over Eclipse, but in the end, it always did the Job get done and helped me a lot develop my skills.

Web development: Had my first Homepage by the end of 1999 and boy, i was so proud of the file based guestbook i had. Having so much success doing the Swing stuff i thought how hard could be doing Java for Websites, wasn’t that the stuff all those skilled developers where doing? Turned out, it could be very hard.

I remember a lecture i had taken by a pretty different Adam Bien. Comparing his patterns and suggestions from back then to the stuff he’s doing now is worlds apart.

It must have been 2004 by then and we as a company where struggling with the end of life for Oracle Forms 6i. Going to the DOAG yearly conference it was all about Jdeveloper, Oracle Forms 10, application servers and such. It seemed nobody had a clue. All that XML, configuration, configuration and then some… I struggled with Struts, J2EE 1.4 and lost. I really concentrated on the Desktop with Java and that paid very well for me.

In 2005 i started Daily Fratze, PHP then Ruby on Rails based. Had a look at Java, but didn’t want to go down the painful way of more config than code. Ruby on Rails was enlightening in December 2005. That was what i wanted to do for the web.

I never stopped using Java, quite the opposite. I even became an SCJP with a score near 100% in 2008, but in 2011 i heard old and tired regarding Java and i somewhat could relate.

Months before that my frustration with Java and the Web ended with me having a look Spring MVC again. I’m stubborn and i wanted to make that work for me. And so it did. Spring has been in my portfolio since the end of 2010 and helped a lot getting Java fun for me again in that time.

Everything that happened for Java and me after that time was just great. I did Java on the Desktop, Server, Middleware and even inside databases. Maybe it was always “write once, run everywhere” but it was “learn once, run everywhere”. We at ENERKO have proven that one can do a full blown GIS system nearly 100% Java. I’ve written several web facing Java based sites that run without a hickup for months.

Actually, i used a lot of programming paradigms, languages and tools the last years, but i’ve alway came back to Java and with all good relationships, it has seen all sorts of high and lows. At the moment, Java and i are at an all-time high. Since Java 8 the language is just great, i learned a lot about functional programming (which maybe doesn’t look as fancy and cool as in other languages, but so what?) and did some great things (some you find at that blog here).

The solutions I create with Java are paying my bills and are even fun to create, but the best are the people that are part of the Java ecosystem. So many kind and brilliant people. All sort of. People creating great IDEs, libraries that are useful in every day usage or people that are just fun to talk to and discuss with. Thanks to all of you.

Cheers to you, Java 🍻, onto the next twenty years:


2014-09-30_big

| Comments (0) »

24-May-15


Change of perspective: A NetBeans testimonial

This post is long overdue since JavaOne 2014. I’m not getting payed for it, it’s more a thank-you to the whole NetBeans team for bringing some fun back into my everyday coding life.

I’ve been an Eclipse user for a long time, i think way back 10 years ago when it didn’t have a name but only version numbers. Back in 2005 it was for us the only real viable Java IDE around. I remember NetBeans as pretty much unusable for us back then and IntelliJ too expensive. Eclipse felt native, fast and actually, intelligent supporting our development.

What we never did was platform development on either Eclipse or NetBeans.

Back then we often had the problem, that some projects were only deployable from the IDE. Or worse: From one developers IDE. Came ANT, things changed for the better, came Maven (downloaded half of the internet) things got even better. Today i wouldn’t touch a thing that is not build able with standard command line tools. I’m actually a big Maven fan, but Maven and Eclipse relationship has been complicated, at least to say, but I made it into a requirement that every productive project or module should be buildable by maven. Having that, we ran into a lot of problems with M2Eclipse over the years, it never was fun. Also updating any installation of Eclipse is a sad thing. Sometimes it works, more often not.

Anyway, we did great stuff with it and with Spring Tools Suite appearing somewhere in 2011/12 for me many problems with Eclipse vanished with the nice pre bundled stuff.

By the end of 2013 i was (and actually, i still am) pretty bad frustrated by project that involves a framework I prefer never ever touching again and some AspectJs that repeatedly crashed *only* in the IDE.

Looking for something relaxing, inspiring i aimed for a clean and simple Java 8 project and i ended up with this. By February / March 2014 the only IDE offering good Java 8 support was NetBeans 7.4 and in March, NetBeans 8, so choosing a new IDE was pretty easy.

Not wanting to change everything, that was one of the first steps:


keys

Setting the profile to “Eclipse” allowed me to keep my old habits regarding shortcuts, navigation and stuff. By now, I’ve switched to the NetBeans profile.

Working out of the box is the great Maven support. Without adding anything to a project (apart from a project specific settings file), everything works as is. Didn’t have any problems regarding lifecycle management or a plethora of additional xml files per dependency like IntelliJ creates. Great.

Learning: NetBeans did help me (and now my coworkers) to get my head around Java 8 lambda expression and basic use case cases:


learn1

into this


learn2

Pretty basic, sure, but everybody needs a starting point and replacing anonymous inner classes is an immediate win.

Some day i was rewriting a complex computation and i discovered “Use functional expression” hint. I didn’t expect it to work as the variables used weren’t effectively final but NetBeans pretty much did something like this:


learn3

The Reduction was actually way more complex than this. I was pretty sure that this was working because I had written tests and already added the JaCoCo Maven plugin which is detected by NetBeans and ensures me that everything is green as described here.

Speaking of code quality: I actually like the NetBeans code formatter, adding curly braces for every branch of control flow and so on. I guess one of the only things i’ve changed are spaces to tabs (yes, i use tabs. I want semantically correct empty space, not spaces).

JavaDukeTeach_larger (Image from Coding Dude) More teaching and learning: NetBeans has an excellent build-in HTML, JS and CSS editor and all of them work hand in hand. The HTML editor proposes CSS classes the platform finds in css files in the projects, as does the JavaScript editor. The later knows about AngularJS functions, attributes and more. Some of my coworkers always look for WYSIWYG editors: I didn’t even bother, i’m way faster with that kind off assist and i learn stuff with it. Also, the pom editor: It completes group and artifact ids and also suggest the most current version. If i do need a GUI editor (for example creating FXML files), NetBeans knows how to call JavaFX scene builder.

The power of content assist also shines with the nb-springboot-configuration-support, which is demonstrated by Geertjan at Oracle.

Other things i’ve used repeatedly: The very fast local history, the ability to restore unversioned files from local history and fast file compares. Fast navigation between classes and corresponding test classes and certainly the good Git integration.

I’ve encountered only some minor problems so far: Sometimes my installation hangs during download of JavaDoc for whatever reason i don’t know. There seems to be a problem with Java 8 parameter names sometimes, but for the last year no bigger deal.

We at ENERKO have used NetBeans 8 through 8.0.2 for the last year creating two successful Spring Boot projects in the energy / commodities market. One an AngularJS application and the other one a traditional, server side rendered Java project. There’s wast knowledge around another Oracle product in our company, namely Oracle Database, but not that much modern Java web stuff, so being able to teach without distraction by tools was essential.

NetBeans IDE helped me a lot learning and teaching modern Java technologies without wasting time on configuring, explaining build failures due to configuration errors etc. and instead concentrating on stuff that actually matters to us: Creating great software. Reducing unnecessary complexity in tooling is an invaluable asset for modern software development.

So, the change of perspective brought by changing our main IDE changed actually more than an IDE.

(By the way, another great application based on the NetBeans platform is the Oracle SQL Developer, useful not only for Oracle databases but for many other databases with JDBC connectors.)

| Comments (0) »

23-Apr-15


First talk at EuregJUG Maas-Rhine: “Building Modular Java Applications in the Cloud Age”

May i bring the first talk at the newly founded EuregJUG Maas-Rhine to your attention: “Building Modular Java Applications in the Cloud Age” will be held by @bertertman on Thursday, May 28th, 2015 at BitStars HQ, Hanbrucher Str. 40 in Aachen:


talk-poster-2015-05-28

Would be great to meet some of you, i really hope we get this JUG going. Thanks a lot to Stefan Pfeiffer aka @dl1ely for all his engagement, i’m happy to be part of it.

| Comments (0) »

20-Apr-15