문제

I have Netbeans IDE version 6.8, and Glassfish version 3. My glassfish listener is set to port 81, but when I try to run the simplest web application via the Netbenas IDE it tries to run it on port 8080. where can I change it ? Using port 8080 for my web application is out of the question for me.

도움이 되었습니까?

해결책

A bit late, but this should work...

I don't have 6.8 anymore, but the following is true for 6.9 and 6.10m1 - in the directory <home dir>/.netbeans/<version>/config, there is a file called .nbattrs - edit it, and look for something like:

<attr name="GlassFishEE6\Instances\glassfish_autoregistered_instance\httpportnumber" stringvalue="8082"/>

Change the value to whatever you've set in the appropriate Glassfish domain. If, like me, you have more than one version of Glassfish installed, or perhaps multiple domains, just look out for the ....displayName keys and follow your nose - it should be obvious which one you're altering.

HTH,

John

NB: you can, of course, delete the server and add it in again using the wizard to select the right ports - but I think editing .nbattrs is far easier

NB2: there is another .nbattrs file further down the directory chain that also contains glassfish config (can't remember the exact location - sorry!) and this looks like the right place to change the port - but editing this file appears to have no effect as, for me, it gets overridden with whatever is in config/.nbattrs file whenever I start up Netbeans

다른 팁

Locate config folder which may be as follows:

C:\Program Files\glassfish-3.0.1\glassfish\domains\domain1\config

Open domain.xml using any text editor.

Look for 8080 and change it to some other port number that doesn’t conflict with other port numbers.

source: http://ohmjavaclasses.blogspot.com/2012/01/how-to-change-port-number-for-glassfish.html

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

     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.**
    
  8. Restart GlassFish, if it was already running.

I'm a bit late, too, but I'll add my comments just-the-same in case anyone runs across this issue in the future. I'm running Windows 7 with NetBeans 6.9.1 and GlassFish 3 locally on a different port (2118) as not to conflict with my Tomcat server on default (8080). If you navigate to <home_dir>/.netbeans/<version>/config/GlassFishEE6/Instances, you'll find your .nbattrs file.

Edit <attr name="httpportnumber" stringvalue="8080"/> to reflect the desired port. Save the file. Restart your server and you should be able to deploy/test your web apps, as desired, using NetBeans.

Incidentally, poking around under <home_dir>/.netbeans/<version>/config/J2EE/InstalledServers, you'll see another .nbattrs file and because I have two app servers installed locally, I see <fileobject name="instance"> for Tomcat and <fileobject name="instance_1"> for GlassFish. XML entries <attr name="port" stringvalue="8080"/> and <attr name="port" stringvalue="2118"/> reflect the respective assigned ports for each server and the change made in the previous .nbattrs file.

Hope this helps.

if you are using Glassfish 3.1.1 it may in /home/user/.netbeans/7.1.2/config/GF3_1/domain1/config/domain.xml,Find the 8080 port and replace it with alternate port number.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top