Αλλαγή τωμ Ports του Server για το LAMS


Added by Spyros Papadakis, last edited by Spyros Papadakis on Sep 16, 2008

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
Unknown macro: {snipedit}

When you install LAMS, you may have another server running on the same ports that LAMS uses.

Skype can sometimes conflict with LAMS but it won't be consistent. Skype will select a port from whatever appears to be free so when you install LAMS on a computer running Skype, you should shutdown Skype before installingLAMS. After that, make sure LAMS starts up before Skype does, and then LAMS and Skype should never conflict.

LAMS defaults to port 8080, so normally it won't conflict with Apachewhich usually runs on port 80. But occasionally Apache is set up to use port 8080, in which case LAMS and Apache will conflict. If Apache, or some other server, is using 8080, then the instructions on this page should help you move LAMS to a different port.

If you wish to run multiple instances of LAMS on the one server, see Configuring Multiple LAMS Instances on One Machine.

If you are having trouble working out which ports are in use on Windows, you could try Active Ports. We don't recommend, test, give any guarantees about the safety of, etc this program, but we do use it ourselves.

Setting Another Port

But there are other servers that also using port 8080. If your port 8080 is already used then you will need to assign it to another port. There are two ways to do this. Method 1 is simpler, so do that if you can. There is no hard and fast rule about when is it best to do Method 1 or Method 2 - you do whichever sounds more like your situation.

1. If the other server uses just one port, such as a web caching program, then you can just set LAMS to port 8180 (or some other free port). At install time, you can set the port to 8180 using the installer.

If LAMS was already installed before you discovered the problem, the port can be changed by <LAMS JBoss Server Directory>\server\default\deploy\jbossweb-tomcat55.sar\server.xml (e.g. C:\lams\jboss-4.0.2\server\default\deploy\jbossweb-tomcat55.sar\server.xml) in Wordpad or another text editor, change the following entry to port 8180. You need to change the bit that says 'port="8080"'.<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector port="8180" address="$

Unknown macro: {jboss.bind.address}

"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>

2. If the other server may use many ports, e.g. an application server like Weblogic or Websphere, then install LAMS using port 8180. In this case, we want to use a JBoss feature that shifts all the ports JBoss uses to another port and it will automatically set it to 8180 so you don't get any choice about which port number it chooese.

This will reduce the chance of other ports used by JBoss conflicting with the other application server.

  • Install LAMS, setting the port to 8180.
  • Once installed, open <LAMS JBoss Server Directory>\server\default\conf\jboss-service.xml (e.g. C:\lams\jboss-4.0.2\server\default\conf\jboss-service.xml) in Wordpad or another text editor, and uncomment the following block (it's commented out by default):@import url(/download/resources/confluence.ext.code:code/shStyles.css);| <mbean code="org.jboss.services.binding.ServiceBindingManager" |
    name="jboss.system:service=ServiceBindingManager">
    <attribute name="ServerName">ports-01</attribute>
    <attribute name="StoreURL">$
    Unknown macro: {jboss.home.url}
    /docs/examples/binding-manager/sample-bindings.xml</attribute>
    <attribute name="StoreFactoryClassName">
    org.jboss.services.binding.XMLServicesStoreFactory
    </attribute>
    </mbean> <mbean code="org.jboss.services.binding.ServiceBindingManager"
    name="jboss.system:service=ServiceBindingManager">
    <attribute name="ServerName">ports-01</attribute>
    <attribute name="StoreURL">$

    /docs/examples/binding-manager/sample-bindings.xml</attribute>
    <attribute name="StoreFactoryClassName">
    org.jboss.services.binding.XMLServicesStoreFactory
    </attribute>
    </mbean>if(!window.newcodemacro_initialised)

    { window.newcodemacro_initialised = true; window.oldonloadmethod = window.onload; window.onload = function()
    Unknown macro: { dp.SyntaxHighlighter.HighlightAll('newcodemacro'); if(window.oldonloadmethod)
    Unknown macro: { window.oldonloadmethod(); }
    }
    }

    After changing the jboss-service.xml file, restart LAMS.

If both port 8080 and Port 8180 are already used on the server, then there is further configuration that you can do t try 8280, 8380, etc. For the full details, see http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfiguringMultipleJBossInstancesOnOneMachine.

Changing the ServerURL

When you run the installer, it creates an entry in the database for the ServerURL. This url is http://<servername>:<port number>/lams/.

If you change the port number, you need to make sure that the entry in the database matches, otherwise LAMS won't display properly. If you are unsure if it is set right after you have changed the port configuration then it only takes a few minutes to check it.

If you can log into LAMS, log in as sysadmin and go to the System Administration screen. Select "Edit Configuration Settings" and find the entry for ServerURL. It should be the first entry on the list. Check the port, and if it is wrong then change the port number. Log out and log in again - once you log in you will have the correct port number. You don't need to restart the server.

If you can't log into LAMS then change the value in the database directly. Go into a MySQL client, go to the LAMS database, find the lams_configuration table and look at the entry for ServerURL.  If you don't have a nice GUI program to access MySQL such as the MySQL GUI tools, you can do it from the command line:C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -u lams -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 73 to server version: 5.0.24a-community-nt-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use lams2
Database changed
mysql> select * from lams_configuration where config_key = "ServerURL";
----------------------------------------------+

config_key config_value

----------------------------------------------+

ServerURL http://<yourservername>:8180/lams/

----------------------------------------------+
1 row in set (0.00 sec)

If this value is http://<yourservername>:8180/lams/ then you are okay and you don't need to do anything.

If this value is http://<yourservername>:8180/lams/ then you need to change it. Use the following statement in your MySQL client, replacing <yourservername> with the name of your server.update lams_configuration set config_value="http://<yourservername>:8180/lams" where config_key = "ServerURL";