Monday, 7 May 2012

From Tomcat to GlassFish (part I) - Getting Started


I've been using Apache Tomcat for some time now and it has done me well. I work for a small company that develop and deploy Java Web Applications and I was tasked with finding and deploying an enterprise grade server for our applications and so I've gone with Oracles GlassFish sever.

Tomcat is a Servlet/JSP container that you can configure and do allot with but GlassFish does so much more out of the box. GlassFish has allot more Administration tools and is supported by Oracle, it also has it's own HTTP front end called Grizzly.

To get Started download the latest version of GlassFish from here. You have the option of the Open Source edition or the Oracle server. For this purpose we are using the Open Source Edition.



Once Downloaded you should have a glassfish-.zip file. Extract this anywhere on your system that you like (/opt/glassfish is a sugestion) and open up a terminal and cd to that directory. In this expanded Directory you will see the following

  • Bin - binary files including asadmin
  • glassfish - includes further directories for the container(s)
  • javadb - Java Database (optional use not discussed here)u
  • mq - Message Queue (not discussed here)
  • pkg - package directory used for updating and extending GlassFish

Before we start make sure you have a JRE or JDK installed on your system. You can download the latest version from Oracle http://www.oracle.com/technetwork/java/javase/downloads/index.html
If like me you have multiple java versions on your system such as Oracle's JDK and OpenJDK you might want to specify exactly what one you want GlassFish to use. You can do this by adding this line to the file /glassfish/config/asenv.conf
AS_JAVA="/usr/PATH TO your JDK or JRE"
You can use any text editor to do this such as vi.

In the bin directory you will find asadmin, you use this to administrate GlassFish via the command line. Add asadmin to your path or cd to the bin directory and type ./asadmin help for more information on what you can do.

By default GlassFish comes with a domain already set up (domain1), you can see this in /glassfish/domains , you can also view domains by entering asadmin list-domians.
Lets remove this default domain and create a new one............
# asadmin delete-domain domain1
# asadmin create-domain example
You will then be asked to give an administrator name and password or you can press enter to accept default user admin with no password (for obvious reasons doing this will leave your GlassFish insucure).


As you will see GlassFish goes ahead and uses some default port numbers. Default port numbers are....

4848 Admin port
8080 HTTP Instance port
7676 JMS port
3700 IIOP port
8181 HTTP_SSL port
3820 IIOP_SSL port
3920 IIOP_MUTUALAUTH port
8686 JMX_ADMIN port

You can change these in the Admin Console (Will be covered later) or by editing the file /glassfish/domains//config/domain.xml , this file is the equivilant to Tomcats server.xml file. You can also change ports by issuing commands like so........

  1. To change the HTTP port to 10080:

    asadmin set server.http-service.http-listener.http-listener-1.port=10080
  2. To change the HTTPS port to 10443:

    asadmin set server.http-service.http-listener.http-listener-2.port=10443
  3. To change the administration server port to 14848:

    asadmin set server.http-service.http-listener.admin-listener.port=14848 
If you have a port range in mind you can change the port numbers on creating a new domain. This is also very handy if you are creating multiple domains. When creating a new domain you can pass the argument portbase with the portbase number of your choice and it will increment the portnumbers to that number like so.......
Admin port: portbase + 48
HTTP listener port: portbase + 80
IIOP listener port: portbase + 37
JMX port: portbase + 86

Lets say you have decided on a portbase of 2000 you would type......
# asadmin create-domain mydomain --portbase 2000
and GlassFish will give you a new domain "mydomian" with HTTP port 2048, SSL port of 2081 etc. this can save you time and instantly resolves port conflicts if you are creating multiple domains.

Now that you have done all the set up it's time to run it up and try it out. You can monitor the log as you start it up by tailing the /glassfish/domain//logs/server.log file. Issue the command asadmin start-domain so in this case asadmin start-domain example.


Now you can open up your web browser and enter localhost:8080 you should be presented with the following page. 


Congratulations you have successfully set up your GlassFish server. Next time we'll look at further configurations, using the admin console, security and web applications. Stay Tuned.


Monday, 23 November 2009

Another Linux convert

I was down in Dundee at the weekend visiting a friend and knowing my interest in Linux she asked me about it, her first question being "How much does it cost". When I told her it was free she was very impressed and asked if I could install it on her computer. She had a very dated looking Windows XP set-up (I'm not sure it even had SP2 installed) and her major gripe was the fact that she couldn't install the new live messenger and being stuck with an old MSN Messenger app.

Ever keen to get new people to try Linux I asked her if she was ok with me installing an OS and completely getting rid of windows. She never really plays games with it other than solitaire and mainly just uses it for the Internet "The perfect candidate for Linux" I thought to myself. With complete trust in me she agreed and when I asked if she was sure at getting rid of windows before I hit the return key she said "yep Kill it!" and with that the hard drive was formatted to ext4 and XP annihilated.

I had a bit of trouble at first as I didn't have an Ubuntu install disk on me (I chose Ubuntu over any other distro as I figured it'd be best for a new convert). So I used her Windows to download the ISO only to find out that I couldn't get any app in the OS to burn the image to disk. I managed to overcome this, luckily I had a copy of pupy 4.0 live cd. There was only one optical drive so I had to run puppy from ram, once booted I mounted the windows Drive and was able to burn the Ubuntu image to CD.

Once it was all installed and I set it up for her (installed restricted extras, libdvdcss, aMSN, compiz, VLC etc.) I showed her a few things to get going and let her play about with it. The overall result was good, She was impressed with it saying "It's like I've got a new computer". The one thing she spent the most time on was aMSN (I told her about empathy but didn't seem interested) I noticed in one of her IM's her saying "I've got the new MSN messenger now". I didn't bother trying to explain the difference but it goes to show that from an end user's point of view Windows / Apple / Linux / BSD it's all the same and the underlying technology doesn't matter as long as it does what they expect it to do.

Wednesday, 18 November 2009

Nothing Karmic about it.

I've had Ubuntu Karmic installed in both my Desktop and EEEPC since just after the release day, once installed I was quite impressed. Everything worked well, I was in awe over the X-splash effect and the cinematic shut down plus the improvement in boot up and shut down speed. I even like the extras such as Empathy, Evolution and the new Software Centre. A few weeks in though and some updates later every thing's going tits up. My FaceBook plugin for Empathy gave in the ghost, Gwibber has been very twitchy and Kaffeine pre 1.0 is pants.

I may look into trying to fix these annoyances or maybe stick it out in hope an update will fix them for me, I don't know if I want to spend my time tweeking till it works. A part of me wishes that I'd stayed with Jaunty but hope Karmic will improve seeing as we're heading into an LTS edition in April. Small annoyances they may-be but if they don't get fixed it'll just bug the hell out of me and I may make the switch to another Distro like Mint or something, Hell I might even give Slackware a go!

Saturday, 17 October 2009

Doctor Who Exhibition Glasgow 2009

Earlier this summer we went on a trip to Glasgow to see the Doctor Who Exhibition. If you're a bit of a Time Lord fan like myself you may appreciate these pictures.


Wednesday, 21 May 2008

More fun in Linux Land

After using PCLinuxOS for some time I grew a bit bored with it, I wanted to try something else. I pulled out my CD case full of various Linux Distros and started trying them to see if I could get something else installed. After much disc swapping and Internet searching I finally managed to get Mandriva 2008 one working (with Compiz effects in all). They way I managed to get it going after my first failed attempts was by typing the command "acpi=off" in the boot option. As far as I'm aware the acpi has something to do with power management but by turning it off the installation went flawlessly on my system. I've been playing around with it now for awhile and haven't gotten bored with it yet, I love the 3D desktop, wobbly windows and all the little animations that go with it.







Despite being chuffed with myself that I got a new OS running and having fun with all the bells and whistles I still wanted to get Ubuntu installed as it was my first choice and seems to be a very popular Distro within the Linux community. Aaron ordered some free discs from the Ubuntu website for the latest release 8.04 Hardy Heron. So I decided to try agian to get it installed and again the live CD wouldn't work and nothing was happening till I changed the boot option again this time adding the commands "acpi=off", "noapic" and "nolapic". After typing in these commands I finnaly managed to get it installed but it wasn't flawless. I had problems with the screen resolution I couldn't read anything being displayed. I managed to find some help online with the Ubuntu forums and typed a bit of extra code into the "/etc/X11/xorg.conf" file and this solved the problem.

When I say it solved the problem it did to an extent as I could now read what was on screen and the display was much better but now I'm stuck with a 800x600 resolution on a 1028x1024 monitor. I don't mind the low res though it means everything is allot bigger and easier to see (and it's not like I'm playing World of Warcraft or Medal of Honor on it or anything). Also I still can't get the Compiz to work through Ubuntu like on Mandriva but I'm still happy with it.

So now I have a system that dual boots Mandriva and Ubuntu (I'm WELL impressed). Now I'm going to reattach the hard drive containing Windows XP (not that I've used it since last year) and I'll have a Triple booting PC! ACE!!!

Monday, 7 January 2008

OS success


Great news I finally got Linux to work on the PC. Ok it's not the Ubuntu distro that I tried in vein to install but it's a Linux OS none the less. PCLinuxOS or PCLOS for short is the distro I successfully installed. This distro seems very user friendly and was easy to install. When booting from the CD the software basically does a check on your system then gives you the best options to install (the whole process is done for you) no messing about. The OS looks very cool and comes in lightning blue rather than Ubuntu classic brown. I'm probably going to spend hours on the computer now playing about with it and getting used to the environment (I'm very excited!!!).

So FINALLY I can start to enjoy the world of Linux properly and get more involved.

Visit the home page www.pclinuxos.com

Monday, 17 December 2007

Open Source on Windows

As I can't have a fully functional system with Linux at the moment (till I convince my partner to allow a second tower in the house or I get around to buying an EeePC) I've had to settle with a few Open Source apps that I can run on Windows. I've downloaded a couple so far these are Open Office (OOo as it's referred to) and Pidgin. Of course there are many more Open Source apps out there but I've only gotten around to these two so far.

Open Office is similar to Microsoft Office, it has all the usual apps such as word processing, Spreadsheets, Database, PowerPoint and Drawing. The great thing about OOo is it works in the same way as the Microsoft version so it's simple to use you don't have to relearn everything, also you can open Microsoft documents with it and vice versa, it's compatible with most systems so you don't have to worry about converting files if you use OOo at home and Microsoft at work. The best thing about OOo compared to Microsoft is that it's FREE!!

Pidgin is a chat client that allows you to send instant messages using many existing clients so if you have more than one account you can bring them altogether using this one app. Pidgin works with these IM clients..........

AIM
Bonjour
Gadu-Gadu
Google Talk
Groupwise
ICQ
IRC
MSN
MySpaceIM
QQ
SILC
SIMPLE
Sametime
XMPP
Yahoo!
Zephyr

Both Open Office and Pidgin come already preinstalled with Linux OS so although I can't have the full version at the moment at least I can still have a taste of Open Source on Windows.

Monday, 10 December 2007

Ubuntu Features

As I said before I have managed to have a go with Ubuntu on an older system and I'm very impressed. The amount of features available from the offset is a lot more than what you get with a cheap Windows OS. Some Apps include open office, Pigeon, FireFox virtually any open source application available and the list of games are also impressive even with a more expensive version of Windows I haven't seen as many games in one menu.


I had a go Playing Chess and the "GNU" (as it's referred to in Linux) keeps beating me, any time I play against the Windows "CPU" I always win. This just shows you how much more care has gone into developing even the smallest feature available in the Linux OS. Another thing I quite like, is when you click the shutdown option. In Linux once you've clicked on shutdown the computer just turns off in an instant, whereas in Windows once you've clicked shutdown it comes up with messages "application still running do you want to close", then it says "Logging Off" followed by "Windows is shutting down". Basically twenty minutes later and finally the computer turns off.


I've barely scratched the surface with what this OS can do but so far it has me hooked. Not much more has to be done now to convert me from an everyday Windows user to a dedicated Linux die hard.

Monday, 3 December 2007

VM WHERE???????

I've had to install Ubuntu onto an older system. I'm a bit disappointed in this as all my files etc are on the new system and my partner won't allow me to....

A. have both systems in the house and

B. completely get rid of Windows on the newer system.


I tried a different route. I found out that you can download a free bit of software from VMware called VM Player. This allows you to create a virtual machine on your computer and allows you to run a different OS within your current system. So I thought cool! I logged onto the site and downloaded the software, once I had installed it everything seemed to be going fine but then the computer crashed (a Windows fault not Linux). I tried using it afterwards but it wouldn't work so I thought I'd uninstall and reinstall it.


After uninstalling VM Player I click on the program to reinstall and guess what happened. NOTHING that's what happened NOTHING HAPPENED!!!!!!!!!!!!!!!!


I'm still determined to use Linux, after playing with it on my older system I'm very impressed with it. What I'd like to do now is either get a cheap second hand Laptop with no OS installed or even with no HDD. Or there is the option of buying the new eeePC.

Friday, 23 November 2007

Repetition Repartition!

I thought I nailed it. I thought I discovered the reason why I couldn't get Windows and Linux to dual boot, the drive only had one partition (dominated by Windows). So I decide to go about repartitioning the hard drive to allow both Linux and Windows on the same drive.

I use Gparted, burned it to disc and rebooted the computer. Gparted comes up. Now at this point what I should of done was read the documentation and instructions on how to use it, but eager to get started I jump straight in. The disk drive is displayed in a graphic showing the space and how many partitions it has. So first I click on the partition containing Windows and resize it, then add a new one for Linux. I resize the windows partition again then add a "Linux Swap" partition afterwards resizing the windows partition to make the drive look tidy with no unnecessary unused space. What I didn't realize was that each time I resized the windows partition I was giving Gparted a new command. I click OK. Instead of resizing the windows partition once like it should have, it resized it THREE times!

After clicking OK, Gparted shows a warning saying "depending on the nature and type of operation this may take a long time" I'm thinking it'll probably be a few hours. The estimated time till completion clock goes up and up and up. Basically I started the thing running Monday night at 5pm, it finished at 7am Wednesday! If it hadn't of resized the Windows partition three times it probably wouldn't of taken as long.

So Gparted finishes off and I'm like "well it may have taken a while but it's done now, at least I'll be able to install Ubuntu now". I load the Ubuntu installation disc into the tray and reboot the computer. The Ubuntu logo comes up with the options, I hit enter on the start and install and............................................NOTHING HAPPENS!!!!!!!!!!! AAAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRGHHHHHHHHHH!!!!!!!

My Linux experience isn't getting off to a good start but I'm determined to get into using it. I'm now looking into a different root and maybe give up on the dual booting idea. I'll keep you posted.

Monday, 19 November 2007

Dual Boot Ubuntu?

I have recently taken an interest in Linux. After reading more about it and looking it up over the Internet I decided I'd go ahead and give it a try. There was a lot of information on the Linux OS, Ubuntu. According to a few articles Ubuntu has become a popular operating system and it's easy to use. I also read up on the fact that you can use this (and other operating systems) alongside windows by "Dual Booting". So I thought "best of both worlds", I can start getting into using Linux and still keep Windows, but it didn't work out that easily!

I started by going to the official Linux site (http://www.linux.org/) and reading the tutorials there, then I went to the official Ubuntu site (http://www.ubuntu.com/). Here I could download a copy of the latest version 7.10 and read up some more on dual booting. After downloading, hash sum checking, burning to disc and hash sum checking again I rebooted the computer. The Ubuntu logo came up with some options, at this point I'm thinking "cool". I click on the start and install Ubuntu and.............................................nothing happens!

So I think to myself "I must have done something wrong". So I watch this video on line on how to do it step by step (google video) then I try again and nothing. The next day I'm getting shopping and I spot a Linux Format magazine with a DVD containing Ubuntu. I snap it up with the thought that the DVD might work better than the disc I burned from the computer. I rush home to try it out getting excited about the whole thing. I stick in the disc, reboot the computer, Ubuntu logo comes up with the options again and then NOTHING!

I'm starting to get frustrated at this point. I decide instead of dual booting, I'll just install it on an old hard drive I've got. After checking the drive and formatting it I rip out the drive containing Windows and popped in the blank drive. The installation from then went well and I finally got Ubuntu to work. With spending SO much time trying to get it going I still haven't had a good play around with Ubuntu, but I will. Have to say it does look good. I still want to get the computer to Dual Boot instead of swapping drives about so I'm going to look more into that.

Until I figure out how to successively do a Dual Boot I'll be getting to grips with the actual OS, so I'll let you know how I get on.