Getting started with ServiceMix 4.2 and WebServices (with Maven and Eclipse on Windows)

(Under this post I noted down some great resources for getting started, so if you’re searching for those, have a look at the bottom of this article)

Okay, I had a really hard time getting started with ServiceMix, as there’re so many technologies involved and I knew none of them. Maven. OSGi. ServiceMix. Karaf. Most of the time, you only want something to work so you can apply the same or nearly the same technique again, right? So here’s a little plan what works and where you can start your journey:

- Install maven. Install Eclipse.

- Install the m2 plugin for eclipse.

- Download ServiceMix 4.2.

- Open a windows command terminal. Navigate to %servicemix_home%/bin

- “servicemix.bat” starts ServiceMix. You get into the Karaf console. Typing TAB and “y” shows you a lot of commands you can try out. (If you want, try some … easy administration!)

- Open Eclipse. Seriously. Import –> Maven project

- In the wizard, browse to %servicemix_home%/examples

- Pick the “cfx-osgi” folder and use the pom.xml the wizard finds there for importing the project. Finish the wizard.

- Change the sourcecode of the HelloWorldImpl.java file to do what you want and save that file.

- Right click the project –> Run –> Maven install. A .jar file gets generated.

- Copy that jar file into the %servicemix_home%/deploy folder.

- Get back to Eclipse … there’s a client.html file in the imported project. Right click that –> Open With –> Web Browser

- Click the “send” button. Smile.

- (Optional: Now remove the .jar file from the deploy folder of servicemix. Click the “send” button on the HTML form again. Smile.)

If you want to learn more, you can look into the FUSE ServiceMix documentation (FUSE is documenting and selling support for ServiceMix, but they don’t put much more on top of ServiceMix, so the documentation is pretty good). Or try the text files that come with the examples.

Hope this helped you a bit.

Edits and Updates:

  • I found this tutorial VERY helpful dealing with and understanding BCs: http://servicemix.apache.org/hello-world-bc.html
  • And as you will be using Spring anyways and there’s no way around it, just to understand how simple it works, begin with this small tutorial: Getting started with Spring
  • FUSE is a trademark that’s selling support for servicemix and label servicemix as “FUSE”. No matter if I got that right, FUSE is basically just ServiceMix. As the FUSE people are apt writing nice documentation (and the ServiceMix-page documentation basically sucks), you should head over to FUSE and read their docs (click on documentation and see a lot of nice PDFs). They explain everything you need in a well-written way – OSGi, Spring, Karaf, Maven, CXF, …
  • If you want to use Eclispe and Maven to build OSGi bundles, read this page calmly. It explains how you configure all the OSGi stuff in the pom.xml. Additionally, don’t try to use Eclipse’s plugin-development features as this will mess with your dependency resolution. Maven seems to say: put everything into my hands and you’ll be fine (even if you don’t like me).
  • This is a neat wiki article for getting started with building OSGi bundles for ServiceMix from Eclipse.
  • Here’s a nice article and tutorial explaining how to develop OSGi Bundles with Eclipse.

Utopire – Coding a Browsergame with Java

I’ve got a new hobby. Its called Utopire and is a browsergame. Its basically a clone of “Utopia” which was run by Swirve till it made no more profit and was ported from perl to php by some clueless fans. The new people (and PHP) made the game suck more than ever, but as the concept of the game is simple & great, I decided to rewrite it.

I’m using Struts2, Hibernate + MySQL for that, with jQuery added to JSPs for frontend flavour. So far, everything’s nicely set up. For the timing, I’ll resort to the Quartz-library.

As this is pretty time-consuming, I don’t know when I’ll have something testable or mentionable, but its fun so far and I’ll let you know. By the way, doing a lot of blogposts is also pretty time-consuming … I guess it could be called a hobby, too. But at least I now have a good method of doing this in time.

New Blog Stuff Up

WordPress
Image via Wikipedia

Heya there! Just wanted to let you all know that I was either hacked or WordPress just took down my host’s servers sometimes, so I upgraded to a new version, changed all passwords to secure ones and threw away all those old plugins of mine. I’m sure there’s some stuff not really working as it should, so please drop a note if something bugs you.

I really like the theme by Rob Goodlatte who made this as a proof-of-concept for changing font-sizes in different browser widths. I hope you like it too (it made my bestlist of about five nice themes, maybe I’ll switch if people have problems with this theme).

All the little things & This year of my life

(This is kindof a double post, as I’ve not posted real stuff for some time)

Its very impressive how our life shapes with all the little things we learn. And its all those little things we change in our lives that makes everything a whole new experience. You think I’m on drugs? Nope, I ain’t!

The most time of my life, I’ve been a logical person who had difficulties in understanding human nature and human behaviour. As a logical person, I advocated that no man should ever lie in no situation, and the world would be a better place. Teachers laughted, schoolmates laughted, some tried to persuade me that this just isn’t true. I only trusted upon my logical view of things and nobody could change my perception. Guess what? The human race would be long eradicated by a nuclear war if no man could lie.

Poldi at the window

These were the times when I trusted my own beliefs most, even when people told me something else. It was a very long stage of my life, but I finally made the next level: trying to understand, why people have another opinion, “try out” for some time if this opinion works for me and then accepting or rejecting that opinion/position/view.

For example: I have always had long hair and split ends. Guess that I didn’t understand that I need to use conditioner to make that go away. My opinion was: chemical stuff can’t help my health or the health of my hair. And I was wrong. When I began using conditioner, the split ends were getting better.

So many things just seem like utter nonsense when you see how people behave sometimes. Like watching casting shows in TV. Like smoking. Like going drinking and dancing in a discotheque. Like making music. I even thought listening to music was a strange behaviour when I was about 14 years old. But after some time, you try things out, and some work for you while others don’t. I began liking music and going out to parties for example, but I never liked smoking even if I tried. Well and then after some time, you even try to understand women – a hopeless attempt, some men might think – but even there you can make progress if you really try to understand their point of view.

What I changed this year

Its just that I have a little bit of free time for the first time in about one year – therefore I’m writing this post. And I’m reflecting on what I changed this very year. Change is usually something people don’t like, because their instincts tell them that change is dangerous and that they should just keep everything as it is, because it won’t get worse that way – that is good for survival, the instinct implies. This instinct is called fear. A small interlude from Dune:

I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.
And when it has gone past I will turn the inner eye to see its path.
Where the fear has gone there will be nothing.
Only I will remain.

If you understand that you can choose what you want to change, if you conquer this instinct, you’ll recognize that every change that you do is a positive change in the end. Otherwise you wouldn’t have accepted it … or you just undo it and change back.

And I changed a lot of little things this year. My dear. I hope you my dear reader can reflect the changes you went through this year too. If you want, you should also make a small blog post about what happend this year in your life, because I’d really like to read that. I came to the point where I can say that I love changes – and hearing about them. So this year:

  • I began my diploma thesis on 01.01.2009 and over the course of the year, I needed to unclutter my life to be able to get it done. Some would call this lifehacking. I just stopped playing computer games. Boom. 30% more time. I stopped organizing my week and began organizing my day. Boom. 100% more things got done. I began struturing my online information-digestion through feeds and twitter. Boom. Learning stuff while keeping yourself informed in the shortest time possible. All impressive changes, and needed ones, if you want to use time more effectively.
  • I found a job at the local software company Abelssoft. My salary is fine and didn’t need a car to get to work – again a lot of money saved. My colleagues are very nice and I like working with them – and I also like the work itself, which is a very important matter in being happy, I believe. I also just learned a new programming language (C# .NET) and Abelssoft paid a certificate that measures this skill. Thanks again! You can follow @Abelssoft on Twitter, and this is the website (german verison here).
  • I bought a flat with my girlfriend. A big one. In the times of economic crisis and a drop in (bank) interests, it seemed the smartest thing from a economic perspective. But if you think about the non-economic perspective, its a way more binding statement towards my girlfriend, than a marriage would be. And I’m very happy about my decision. Believe me, the flat is completely new, big and I feel superb when I’m there.
  • I left the church. That means approximately +400€ per year. Nice. I never really believes in god anyways, and if I did, I don’t think Jesus would love me more if I paid the church’s fees.
  • Now for some more little things which changed in my information-digestion: Feedly. After learning what feeds are and how to use them via the Firefox-addon Brief, I just switched to Google Reader to be able to synchronize my feeds (and mainly let those that I have already read not show up anymore) with my iPhone feed-reader. Now that I use Google Reader which in my opinion has a cluttered and unintuitive interface, I found the Feedly-firefox plugin, that lets my feeds look like a newspaper. Hooray, the times of dead paper are gone – and with this kind of interface, maybe I can teach my girlfriend to use feeds someday too.
  • I began listening to podcasts on the bike. Used music before, but riding bike is pretty boring, and I more like listening to music while I’m cleaning up or doing the dishes or something. Fould the following podcasts (both german) to be very interesting: Z and Bitsundso.
  • Another small thing that impact my personal life more than I would have ever imagined: the iPhone. I learned how to use this device as personal organizer (respectively main calendar), ToDo-list, shopping list, feedreader, client for all social networks I use (Twitter, Facebook, Xing, StudiVZ), TV-guide, online-banking-client (damn, I can do bank transfers everywhere with this thing!), (video) camera, instant messenger, radio, podcast-player, music player, navigation-device, pdf-document-reader, voice recorder, gaming device (did you know we have Command and Conquer, Duke Nukem, Need for Speed and many more really good things?), weather information service, eBay-client (which works better and more intuitive than the actual ebay-website), wireless USB-stick, translator, YouTube-client and even TV-reciever (okay, I don’t get too many channels with it). And I can use it as telephone too. You wouldn’t believe it! In one tiny device. All very usable. Thats definitely an upgrade for my personal management.

So I hope your lives got some upgrades too, I’m very pleased with mine this year. For the next year, I’ll have a small list of goals that I want to get done (and that I just entered in my ToDo’s goals section):

  • Try getting more professional at my job.
  • Buy some stuff, so the new flat isn’t all that empty.
  • Write some more blog posts.
  • Main point: I’ll try meeting more friends – I kinda lost sight of them this year and definitely have to change that. But from now on, I’ll have at least my weekends free to tackle that.
  • Play more pen and paper role-playing-games. I miss that, was always fun.
  • Go on vacation with my girl.
  • Get a private server-machine running 24/7. Needs to be low-energy-comsuming and not too expensive. And needs to be silent.
  • Set up a new blog. This wordpress thingy here is too slow, the design isn’t what I want now, and I plain hate PHP. Whats your pick for another blogging platform?
  • Buy a playstation 3 – the Wii has too many bad games, I want more good stuff. And a blueray player too.
  • Pay back the money my parents borrowed me.
  • Upgrade iPhone when there’s time. If you’ll jailbreak, its more time investment, so you gotta plan wisely.

Feel free to answer with your own changes from this year or your plans for next year. Expect to hear more from me more regularly, like every week. Or something like that. Over and out for this week.

Learning to Code – You Really Want to be a Programmer?

There is a lot that you can do wrong. A lot that I did wrong and that took its time. But after all I think I made it. So here are some simple rules that you should follow if you’re trying to become someone who touches keyboards a lot:

Have a goal. If you just want to be a programmer but don’t know anything that you’d like to program, you’ll have problems keeping yourself motivated. Going into a certain direction of technology is a good idea too, so you know what you can concentrate on.

Just do it. (In fact, this statement is the best you can do in any situation of life.) Every time that you’ll write code, you’ll learn something new that will get you closer to your target.

Never miss an opportunity to code. If you have a project where you’re working / studying, try to take responsibility for some functional piece of software. Documentation or user-testing won’t get you further.

Use an IDE. I began with writing java code in a text editor, compiled it by hand and did so for some time, because I thought “Eclipse looks … complex”. It was an error that cost me soo much time. Embrace all help that you can get, if its an IDE, a build tool or whatever tools you’re friends and colleagues use. They all save time, and thats the stuff life is made of.

Don’t forget to use a console too. There are a lot of graphical things out there that want to make you move the mouse more and the keyboard, but often there are no better solutions than just using the command line. Don’t be afraid of it, you’ll have to learn all the commands sooner or later anyways.

Make a list of skills & experiences that you’d like to have. Making your first objects, Unit-testing, working with threads, building a gui, parsing some HTML or XML, getting data into a database or out of it, using the twitter API, building a website, writing a firefox-plugin; HTTP, HTML, CSS, JavaScript, Flash, (a lot more Web-Technologies), Frameworks of all kinds … write down what you think would be useful whenever you meet something new you want to learn … and then make it some kind of long-term-To-Do-List.

Don’t think too much about inheritance, interfaces, reflection, … you can first live without that or just use it by-the-book and will understand what they do soon.

There’s no magic involved. Just code. Like in JUnit, I somehow thought it would verify that my code has no errors if I just configure it correctly – plain wrong, no magic inside! You have to write code that checks everything in your other code. I also thought Struts2 would make websites by magic – again, just code. There’s nothing visible that you don’t code, its just makes just need very few code to get those websites running.

Framework is a signal word. Its means “Software that makes something easier for you”, but you should be aware that you’ll need to invest some time to learn how to use it. Framework should give you a positive feeling, when you hear it, like “I’m here to help you!”. Again, no magic involved. Usually ;-)

Ask. Use online forums, ask friends or people you work with. Google can’t always help (but don’t ask question that Google can answer easily). There is so much that could be known about technology, that noone knows everything (especially when you don’t have your master in computer sciences and 10 years of field-experience). Just accept that and also accept if others don’t have all your knowledge.

Teach. If someone asks you and you know a solution, then help him. Assume he didn’t understand something basic that you know and be sure that you teach it so he can solve the same task again later on. Never just give someone the code, they won’t gain anything from that.

Find someone to learn with. Someone who is the same stupid guy like you and also doesn’t know how to do that complicated stuff. Where one brain gets stuck, two often find a solution and both learn. Working together on a project is a great way to learn. Just make sure the other person keeps up with you, or vice versa.

Never stop learning. Technology evolves with lightspeed, new languages appear, new technology is invented. If you’re involved with computers, you’ll probably be one of the most-learning-and-training persons of the world. Never assume you’re ready to “just do work”. Where would be the fun then?

Get tech feeds. Or follow twitter-users who have the smae interests that you have. From time to time, there will be interesting articles that will teach you good new stuff.

Don’t be afraid to buy books or magazines. Its not always cheap , but if it saves you time learning you should just spend that little money. You’ll get that money back with your skills later.

Get your head around this object-orientation-thingy. Don’t use GOTO. Don’t put the whole code in the main-method. Classes are just there to produce objects and objects are nothing more than some fields and methods in one instance. If you write a main-method, produce an object that does that work from there. Objects can be tested nicely and are more useful.

Its not just coding. Software design, team management, data structures, design patterns, team-collaboration, algorithms, time management are all with you at that party. And much more. And don’t you ever forget your social skills. They might be the most important after all. Even programmers need friends ;-)

Be careful with your coffeine comsumption. A programmer is a person who converts coffee to code, after all. If you still want to code, connect with me on Twitter. What do you think I missed? Do you have more hints for the newbies? What was not ever told YOU, that you should have known from the start? Just add a comment …