6 Replies Latest reply on Sep 17, 2008 4:44 AM by atijms

    Web connector configuration from within EAR?

    atijms

      I would like to configure a web module of an EAR to listen to port 8081 for incoming HTTP requests. Of course this can be easily done by editing deploy/jboss-web.deployer/server.xml. The thing is that I would like to configure this from within my ear. I tried putting a server.xml in the META-INF directory of both the EAR root and the web module, but this didn't work.

      Is something like this possible using Jboss AS (4.2)?

        • 1. Re: Web connector configuration from within EAR?
          jaikiran

          The HTTP port is a server level setting and not an application level setting. So you can't do it per EAR.

          • 2. Re: Web connector configuration from within EAR?
            atijms

            Ok, I already feared for this. If it's not possible to change the HTTP (or AJP) port via an EAR, would it be possible with a Jboss start up parameter?

            • 3. Re: Web connector configuration from within EAR?
              jaikiran

              Why do you want to do this dynamically, instead of doing it before starting JBoss?

              • 4. Re: Web connector configuration from within EAR?
                atijms

                Well the situation is that we have a 'set' of cooperating applications. For development, new developers need to check out several projects from our SVN repository and deploy these to local instances of Tomcat and Jboss.

                I'm trying to make this process as painless a possible. The goal is that they can just do the following:

                1. Download and unzip Tomcat
                2. Download and unzip Jboss
                3. Checkout project X and Y
                4. Deploy project X to Tomcat, deploy project Y to Jboss using MyEclipse.
                5. Start the servers and start testing

                Although seemingly a very small step, explaining to junior developers that they must change something in [jboss install dir]/.../server.xml proves to be quite hard in practice. They always do something wrong. Either they can't locate the file, or they change the wrong port (e.g. set the AJP connector to 8081 instead of the HTTP connector) or they change something in Tomcat instead of Jboss, etc.

                A workaround would be to provide a pre-configured Jboss (already set to port 8081), but in the past this provided to be problematic too. New developers start to download the latest version anyway and run into problems since it starts up at the default port.

                Providing instructions to add a setting to the MyEclipse server connector is a lot easier than explaining what they have to change in which file.

                • 5. Re: Web connector configuration from within EAR?
                  peterj

                  You can change the port number in server.xml to be a system property value. Example:

                  <Connector port="${my.port} address="${jboss.bind.address}"


                  Then set the property when starting the app server:

                  run -Dmy.port=8081

                  • 6. Re: Web connector configuration from within EAR?
                    atijms

                    Thanks a lot Peter. This will help a lot! :)