How to deploy an application over the internet with JBoss AS 7

后端 未结 3 1221
暗喜
暗喜 2021-01-06 19:09

I am using JBoss 7 AS. I am deploying the projects via the linux box by the cmd like so

bin/standalone.sh -b [ipaddress]

This wo

相关标签:
3条回答
  • 2021-01-06 19:34

    The binding -b 0.0.0.0 does not work in JBoss AS7. Instead you have to configure the interfaces in standalone/configuration/standalone.xml.

    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:<your-public-ip>}"/>
        </interface>
    </interfaces>
    
    0 讨论(0)
  • 2021-01-06 19:34

    As I cannot comment to drri's answer, I'm adding a note as an answer.

    When you configure more port bindings, you have also to add a connector to it inside

    <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
    

    in following way: when you add binding named some-binding on port 10000, you specify it like:

            <socket-binding name="some-binding" port="10000"/>
    

    and then you add a connector accordingly:

    <connector name="some-binding" protocol="HTTP/1.1" scheme="http" socket-binding="some-binding"/>
    
    0 讨论(0)
  • 2021-01-06 19:48

    Your first step is to understand and configure your interface and port bindings. Before we get to that, it should be clarified that the -b runtime switch has been active since JBoss AS7.0.2, but wasn't present in previous releases of AS 7. Refer to the following link for more information via the JBoss Application Server 7 community forums.

    https://community.jboss.org/thread/168789

    For your question, you will need to consider both the interface and the port attribute of the socket binding group. Assuming that you're using the standalone instance, you can find the socket binding groups declared in the standalone.xml configuration file as follows.

    Socket Groups and Port Bindings

    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
        <socket-binding name="ajp" port="8009"/>
        <socket-binding name="http" port="8080"/>
        <socket-binding name="https" port="8443"/>
        <socket-binding name="osgi-http" interface="management" port="8090"/>
        <socket-binding name="remoting" port="4447"/>
        <socket-binding name="txn-recovery-environment" port="4712"/>
        <socket-binding name="txn-status-manager" port="4713"/>
        <outbound-socket-binding name="mail-smtp">
            <remote-destination host="localhost" port="25"/>
        </outbound-socket-binding>
    </socket-binding-group>
    

    You can see that the http connector is bound to port 8080, and you can also see that the management API port bindings are bound to java tokens. These are values that you can override (hence the "${thing:value}" syntax), but you lose the power to override them if you hardcode them. This is relevant because the default interface is a java token, allowing you to use the -b switch to override it.

    Interfaces

    Here's the default public interface in the standalone.xml file. The word "public" is just a relative handle. You can "call" it anything that you want, just as long as it means something to you and you can associate server groups and socket bindings to it later. This is a great feature of AS 7, allowing you to declare a set of attributes in one element, and inherit their attributes elsewhere by referencing that element name.

    The following example allows you to reference the public interface elsewhere without needing to know what the actual Inet Address value is.

    <interfaces>
        <interface name="public">
            <inet-address value="${jboss.bind.address:127.0.0.1}"/>
        </interface>
    </interfaces>
    

    Getting Gooey

    You can change these values either via the Management CLI or the Management Console (keeping with the workflow guidance that it's better to use the Management APIs and leave the XML alone). Like most GUIs, Management Console is the easiest to jump into first. Here's the socket binding screen. Notice that there's only really one "socket binding group" in the standalone instance, in this case the standard-sockets group.

    Socket binding groups in the Management Console

    You can edit the http binding if you need, but you should also think about the interface that you are using to connect to the internet. I'm going to assume that you have set up your webserver to suit your needs (which is probably more a question for apache than JBoss). Here's the console view for interface settings.

    Interface settings in the Management Console

    This shows the public interface that the standard-sockets binding group is relating itself to in the config file. Advanced configurations can use the Advanced section to create ordered conditions for partitioning traffic. You can even enable the <any-address/> element that is described in the first link I posted above.

    From these two screens, you should be able to configure the required interface and port bindings to expose your application to the internet.

    0 讨论(0)
提交回复
热议问题