Monday, 22 September 2014

Installing and Runnig Application Server For EJB(For Windows)

There are many free application servers like Sun’s J2EE Reference Application Server, which is available free at http://www.javasoft.com or JBoss, which may be downloaded JBoss from JBoss website: www.jboss.org download the application server from their web site. Once you have download it, unzip the JBoss zip file into some directory e.g. C:/JBoss. The directory structure should be something like the following:

c:\jboss
        admin
        bin
        client
        conf
        db
        deploy
        lib
        log
        tmp

Now, to start JBoss with default configuration go to JBoss/bin directory and run the following command at the DOS prompt:


C:\JBoss\bin > run

Run the .bat file which starts the JBoss server. Once JBoss server starts, you should see huge lines of text appearing on your cmd screen. These lines show that JBoss server is starting. Once JBoss startup is complete you should see a message like following one on your screen:


[Default] JBoss 2.4.3 Started in 0m:11s

Now, we have successfully installed and run JBoss on your system. To stop JBoss, simply press Ctrl + C on the cmd and JBoss will stop, after displaying huge lines of text.
The client for our EJB will be a JSP page/ Servlet running in a separate Tomcat server, we have already learnt in an earlier, how to create and install tomcat server for running JSP or servlet.

Configure and Running Tomcat:

Create a new folder under the main C:\ drive and name it “projects”.  now, create a new sub-folder in the C:\projects folder and name it “tomcatjboss”. The directory strcture look like the following:

C:\projects
        tomcatjboss

Now, open conf/server.xml file from within tomcat directory where you have installed it. By default this location will be:

C:\tomcat\conf\server.xml

Somewhere in the middle where you can see multiple <context> tags, add following lines between other <context> tag.

<!-- Tomcat JBoss Context -->
<context path="/jboss" docBase="C\projects\tomcatjboss\" debug="0" reloadable="true"/>

Now, Save server.xml file. Go to Start -> All Programs -> Tomcat -> Start Tomcat, to start tomcat server. If everything has been setup correctly, Tomcat will start without any problem: