Saturday, October 13, 2012

How to configure Jboss 7 - The Essence of JBoss AS 7

How to use and configure JBoss AS 7 on Windows Vista?

Hi there! in this post i wanna share with you some of the new features of JBoss 7. Our company works since years with JBoss (Versions 5, 6 and going to upgrade to 7) As a client developer i didn't have much chance to explore and understand JBoss in deep and details. That's the reason i am diving into the JBoss world extending my know-how a little bit. The books i read are all heavy weights. So i tried to extract the essence of it, making it easy for you and me to get started with and to have a source to look for, when trying to do more specific things with. I will not show or discuss to many architectual designs in deep and things like that. If you are looking for architectual designs in deep, i recommend the book from Francesco Marchioni called: JBoss AS7 Configuration, Deployment and Administration. In this first post, we will see how to install JBoss 7 on windows vista and how to install the JBoss tools with Eclipse as an IDE.

Getting started: Installing the environment. We will do it, step by step don't worry.

  • you'll need the Java Development Kit where JBoss 7 will be running
  • you'll need to install JBoss 7
  • you'll need to install an IDE. In this case eclipse is the best for me.  

Downloading and installing the JDK

go to: Java Development Kit JDK and download the JDK the fits to your PC-Hardware (34Bit or 64Bit)
In my case i'll take the 32bit version: jdk-7u7-windows-i586.exe 



Tip: To find out if your PC is a 32 or 64Bit maschine, do that on windows vista for example: go to: system configuration>system>show. Take a look at this picture bellow:


Attention: As soon as you double click the installer, make sure you define an installation path that do not contain empty spaces. Usually windows will propose you to isnstall the JDK in C:\Program Files. This leads to some issues when you are referencing the core libraries. A better installation path would be C:\Software\Java or even simplier and better C:\Java.

Updating the settings of you PC after the installation of the JDK

The most important setting is the JAVA_HOME environment variable. JBoss is referenced to it. So lets configure this path. I am using windows vista. So i looks like this:(Tip: You must be logged as admin to change the environment variable)


Ok, now we need to add the JAVA_HOME to the systems PATH. The system path PATH is already in your list. Select it and click on edit. At the end of the file write that to it: %JAVA_HOME%\bin
You PC knows yet where the JDK is located and we are ready to go to the next step.

Downloading and installing JBoss AS7

go to: JBoss AS 7 and download JBoss for free. I will take the version jboss-as-7.1.1.Final.zip.

 
Note that Jboss does not have an installer. You simply unzip it in the directory you want. You may unzip it like this: C:\Software\JBoss. After that locate the folder called bin and start the command-console (cmd.exe) from here. We wanna test if the installed JBoss server works properly with our new installed JDK first, before we go on. Tip: To start the cmd.exe directly on you bin folder do that simple trick: Locate the bin folder of your JBoss installation, press and hold Shift, then perform with your mouse a right mouse click on the bin folder and select start command prompt from here. It could looks like this:


How to start JBoss?

Then type the new command standalone.bat and press enter in the cmd prompt.


This is the equivalent run.bat command in the older versions of JBoss. Per default JBoss will start with the default configurations like 64MB of heap as a minimum and 512MB as a maximum. Don't worry about it now. We will see how to change this later on this example. Open a browser of your choice now and type: http://localhost:8080 in it and hit enter. (that's the address of your installed JBoss server) you should see now the welcome page of JBoss AS7. Note: I don't know why, but if you type the server's address (http://localhost:8080) in Firefox for example and if you get an error like: This address is not valid or any other error. Close the tab and open a new tab and try it again first, before searching for installation errors. Try it on another browser as well. In my case, typing the server's address in firefox leads to an error. In Chrome it works just fine. After closing and opening a new tab in firebox it just works fine as well.

So we are done with the installation. Lets explore the new features from JBoss AS 7 from the command line before installing our IDE.

New Command Line Interface (CLI) with autocomplete function

locate the bin folder in your JBOSS_HOME (in my case it is C:\JBoss\jboss-as-7.1.1.Final\bin) and doble click the command jboss-cli.bat. you'll get a cmd-prompt like that bellow. type the command connect to connect to you running Jboss-Server.


This shell (command-prompt) is very smart and is able to autocomplete commands by hiting the key Tab when typing the first letters of a command. If you type for example the letter "s" and hit tab the shell will propose the command shutdown. That's very nice and confortable.

How can i stop JBoss?

To stop a running jboss server you can either type Ctrl+C or you can type the command :shutdown to issue an immediate stop.

How to stop Jboss over a script file?

If you wanna stop the server from a script file without the smart shell you can pass an option to the jboss-cli.bat command like this: jboss-cli.bat --connect command=:shutdown

How to stop a remote JBoss?

If you wanna stop a remote Jboss server to that on your Command Line Interface (CLI)
connect with the remote server typing its address. for example: connect 192.168.1.10
then execute the shutdown command like this: :shutdown

Installing Eclipse as an IDE (Integrated Development Environment)

Eclipse is currently an IDE that supports the most features for JBoss. It has a lot of useful plugins and extentions, it is also Java based and full compatible. go to: Eclipse here we will download the latest enterprise editon available.

Unzip the donwload eclipse file like Jboss in a directory of your choice. I recommend something like this: C:\eclipse. Locate in your ECLIPSE_HOME the folder eclipse (in my case it is: C:\eclipse\eclipse-jee-juno-SR1 because i've renamed the second eclipse folder to the downloaded file name) and double click the command eclipse.exe to start eclipse.


Eclipse will as you for a working place. This is nothing else then a folder of your choice in which your projects will be saved in. Attention: I recommend to place your workspace in your USER_HOME directory to avoid problems with your anti-virus program. In my case it is (C:\Users\Ricardo\ws_jboss)


How to install the Jboss tools on Eclipse

go to: Help > Install new software then hit the button add and type http://download.jboss.org/jbosstools/updates/development/juno/ in it. After that follow the screen sequences:


Making Jboss ready for Eclipse

Now you should be able to choose a new server by doing this: Ctrl+N and follow the screen sequences (Note: you may must specify your JBOSS_HOME directory in picture JBoss Runtime. In my case it was: C:\JBoss\jboss-as-7.1.1.Final):


Next post series coming soon... 

😱👇 PROMOTIONAL DISCOUNT: BOOKS AND IPODS PRO ðŸ˜±ðŸ‘‡

Be sure to read, it will change your life!
Show your work by Austin Kleonhttps://amzn.to/34NVmwx

This book is a must read - it will put you in another level! (Expert)
Agile Software Development, Principles, Patterns, and Practiceshttps://amzn.to/30WQSm2

Write cleaner code and stand out!
Clean Code - A Handbook of Agile Software Craftsmanship: https://amzn.to/33RvaSv

This book is very practical, straightforward and to the point! Worth every penny!
Kotlin for Android App Development (Developer's Library): https://amzn.to/33VZ6gp

Needless to say, these are top right?
Apple AirPods Pro: https://amzn.to/2GOICxy

😱👆 PROMOTIONAL DISCOUNT: BOOKS AND IPODS PRO ðŸ˜±ðŸ‘†