Wednesday 3 April 2013

How To Change Port Number For GlassFish server


If GlassFish and Oracle Database are installed in the same system, it results in port conflict as both of them use port 8080.
Here is the procedure to change port number of GlassFish so that you can run GlassFish at a different port number from Oracle to avoid the port conflict.
  1. Find out the folder where GlassFish is installed. If you installed GlassFish along with NetBeans, you can find out the folder where GlassFish is installed by using the following procedure.
    • Select Services window by using Window -> Services in NetBeans IDE
    • Expand Servers node and select GlassFish Domain
    • Right click and select Properties option from popup menu.
    • On the right of Domains Folder you can see the folder where GlassFish is installed. For example : C:\netbeans6.8\glassfish-v3\glassfish\domains. You can also see the other details regarding Glassfish such as port number, in the same window.
  2. Go to the folder where Glassfish in installed.
  3. Go into config folder which is as follows: c:\netbeans6.8\glassfish-3\glassfish\domains\domain1\config
  4. Open domain.xml using any text editor.
  5. Look for 8080 and change it to some other port number that doesn’t conflict with other port numbers. I generally change it to 9999.
  6. Save domain.xml.
  7. Now you need to remove GlassFish from NetBeans and add it again so that NetBeans IDE understands the new port number. For this do the following
  8. :
    • In Servers window of NetBeans, remove GlassFish by using RemoveServer button after selecting GlassFish server.
    • Click on AddServer and select GlassFish V2 or GlassFish V3 and click on Next.
    • Select the Installation Location of GlassFish and click on Next.
    • Accept defaults and click on Finish.
  9. Restart GlassFish, if it was already running.

Tuesday 2 April 2013

Installing Tomcat and Configuring as Server in NetBeans

Installing Tomcat 6.0.36 is dead-easy and configuring Tomcat as Server in NetBeans to allow direct (re)deployment of web applications from within NetBeans is just as easy. Still, a brief blog article explaining the steps – for even easier lives for Java Web developers. And as testimonial to the ease of use the development teams behind Tomcat and NetBeans provide to the world of Java developers.

Installation of Tomcat starts with downloading Tomcat, from the Apache site: http://tomcat.apache.org/download-60.cgi 

   


 After downloading the zip-file, I extracted it to E:\ (the location is of your own choosing though).




Next I turn to NetBeans to configure Tomcat 6.0.36 as a new server.
Open the Tools menu and select the option Servers:

 
 The list of currently configured servers appears. In the left side panel select server>>Add Server.. option.
 
 

Select the type of Server to add and provide a name for it – just for reference within NetBeans.
-->

Press Next.

 
Provide the location where this server instance is installed – the target directory for the extraction of Tomcat 6.0.36. Also provide credentials for a Tomcat Administrator account ( in my case I used admin/admin).
Press Finish.
The newly configured Server is presented:

 
Press Close.
Now the Tomcat 6.0.36 Server can be started (and stopped, deployed to etc.) from within NetBeans. Open the Services Window (from the Window menu – option Services or using Ctrl-5).

 

The Tomcat output console appears in NetBeans:




After a few seconds, Tomcat is running. The home page can be accessed at http://server:port – in my case localhost and port 9988:

 

Tomcat is now ready to have applications deployed to it – for example from within NetBeans.
Note: in order for the admin user to also access the management console at http://localhost:9988/manager/html it is imperative that this user is granted the manager-gui role. This can be done by editing the tomcat-users.xml file in the conf directory of the Tomcat installation and adding this role. The entry for user admin would then become:
<user password=”admin” roles=”manager-script,admin,manager-gui” username=”admin”/>