Online Shop version reborn series: FAQs about JBoss startup, shutdown, port configuration, and other common problems in Linux

Source: Internet
Author: User
  1. On a Linux server, how does one deploy multiple independent applications? That is, multiple applications cannot run in a JBoss instance?
    In other words, this problem can also be described as follows: How does one enable multiple JBoss instances in a single Linux server?
    By default, the configuration under the server/default/directory is loaded when JBoss is started. To Start Multiple instances, the port conflict is solved, because one port can only be occupied by one application;
    Generally, when JBoss is startedUse-djboss. server. Home to set the current instance to startLoad different directories;
    For example, if the JBoss main program is installed in/usr/XX/JBoss/and the application is stored in/home/admin/APP/, You Can cp a default directory to the app directory of the current application, through-djboss. server. home =/home/admin/APP/default to start the instance;
    If you copy the default directory directly under/usr/XX/JBoss/Server/and change it to YY, you can start it with the simpler parameter-C yy;
    For multiple applications, we still need to solve the port conflict problem in two ways:
    First, directly modify all the configuration ports under the default directory corresponding to each application, mainly involves the configuration file CONF/jboss-service.xml, Tomcat server. XML; this method is relatively earthy and prone to errors. Because of the large number of ports, JBoss cannot be started as long as one port is not changed. If there are few applications, for example, there are only two, this method is barely usable;
    2. In jboss-service.xmlEnable the mbean service JBoss. System: service = servicebindingmanager., Set the servername and storeurl attributes. configure all the corresponding ports of each application in the same file. This solution is recommended. For details, see:<Mbean code = "org. JBoss. services. binding. servicebindingmanager "<br/> name =" JBoss. system: service = servicebindingmanager "> <br/> <attribute name =" servername "> ports-01 </attribute> <br/> <attribute name =" storeurl ">$ {JBoss. home. URL}/docs/examples/binding-Manager/sample-bindings.xml </attribute> <br/> <attribute name = "storefactoryclassname"> <br/> Org. JBoss. services. binding. xmlservicesstorefactory <br/> </attribute> <br/> </mbean>
  2. JBoss cannot be started normally. javax. Management. mbeanregistrationexception: preregister () failed?
    In general, the above exceptions occur in versions 4.2 and later. The detailed exceptions are as follows:Javax. management. mbeanregistrationexception: preregister () failed: [objectname = 'jboss. remoting: service = networkregistry ', class = org. JBoss. remoting. network. networkregistry (Org. JBoss. remoting. network. networkregistry @ 16b6c55)] <br/> at Org. JBoss. MX. server. registry. basicmbeanregistry. invokepreregister (basicmbeanregistry. java: 713) <br/> at Org. JBoss. MX. server. registry. basicmbeanregistry. registermbean (basicmbeanregistry. java: 211) <br/> at Sun. reflect. generatedmethodaccessor1.invoke (unknown source) <br/> at Sun. reflect. delegatingmethodaccessorimpl. invoke (delegatingmethodaccessorimpl. java: 25) <br/> at java. lang. reflect. method. invoke (method. java: 585) <br/> at Org. JBoss. MX. interceptor. reflecteddispatcher. invoke (reflecteddispatcher. java: 155) <br/>... 51 more <br/> caused by: Java. lang. runtimeexception: exception creating identity: mall_dev4: mall_dev4 <br/> at Org. JBoss. remoting. ident. identity. get (identity. java: 211) <br/> at Org. JBoss. remoting. network. networkregistry. preregister (networkregistry. java: 268) <br/> at Org. JBoss. MX. server. abstractmbeaninvoker. invokepreregister (abstractmbeaninvoker. java: 966) <br/> at Org. JBoss. MX. modelmbean. modelmbeaninvoker. invokepreregister (modelmbeaninvoker. java: 489) <br/> at Org. JBoss. MX. server. abstractmbeaninvoker. preregister (abstractmbeaninvoker. java: 654) <br/> at Org. JBoss. MX. server. registry. basicmbeanregistry. invokepreregister (basicmbeanregistry. java: 697) <br/>... 56 more
    This is mainly because JBoss started a JBoss. remoting: service = networkregistry mbean service, but the IP address cannot be found according to the current hostname at startup!
    Solution:Bind the Host Name and IP address of the current server to/etc/hosts.For example, 10.2.224.214 mall_dev4;
    For versions earlier than 4.2, if the host name and IP address are not bound, the following exceptions may occur, but the normal startup of the application may not be affected;11:32:12, 427 warn [servicecontroller] problem starting service JBoss: service = invoker, type = http <br/> java.net. unknownhostexception: mall_dev4: mall_dev4 <br/> at java.net. inetaddress. getlocalhost (inetaddress. java: 1308) <br/> at Org. JBoss. invocation. HTTP. server. httpinvoker. checkinvokerurl (httpinvoker. java: 204) <br/> at Org. JBoss. invocation. HTTP. server. httpinvoker. startservice (httpinvoker. java: 101) <br/> at Org. JBoss. system. servicembeansupport. jbossinternalstart (servicembeansupport. java: 289) <br/> at Org. JBoss. system. servicembeansupport. jbossinternallifecycle (servicembeansupport. java: 245) <br/> at Sun. reflect. generatedmethodaccessor2.invoke (unknown source) <br/> at Sun. reflect. delegatingmethodaccessorimpl. invoke (delegatingmethodaccessorimpl. java: 25) <br/> at java. lang. reflect. method. invoke (method. java: 585) <br/> at Org. JBoss. MX. interceptor. reflecteddispatcher. invoke (reflecteddispatcher. java: 155) <br/> at Org. JBoss. MX. server. invocation. dispatch (invocation. java: 94) <br/> at Org. JBoss. MX. server. invocation. invoke (invocation. java: 86) <br/> at Org. JBoss. MX. server. abstractmbeaninvoker. invoke (abstractmbeaninvoker. java: 264) <br/> at Org. JBoss. MX. server. mbeanserverimpl. invoke (mbeanserverimpl. java: 659) <br/> at Org. JBoss. system. servicecontroller $ serviceproxy. invoke (servicecontroller. java: 978) <br/> at $ proxy0.start (unknown source) <br/> at Org. JBoss. system. servicecontroller. start (servicecontroller. java: 417)
  3. JBoss has been started normally, but cannot access the application by using an IP address or binding an IP address?
    All the boots familiar with Linux know that a port is bound to a specific address, which can be one or multiple, A port cannot be occupied by two applications at the same address;
    This problem occurs generally because you are using the 4.2 series and later versions, because starting from this series,The default port bound to JBoss is changed from 0.0.0.0 to 127.0.0.1.The former indicates binding all the addresses under the current server, including their own IP addresses and 127.0.0.1; the latter is binding only 127.0.0.1, but not the local IP address, accessing an application through an IP address will naturally fail, because the access IP address does not open the corresponding port;
    In this case, by default, JBoss should be used together with Apache. Apache exposes the application's external access port and then Apache listens to the local port (127.0.0.1;
    Of course, this default configuration can also be modified in many ways, such:
    Method 1: In the startup script, specify the address through the parameter-B, -- Host = Method 2: Specify the address through the parameter-djboss. Bind. Address in the startup script, for example-djboss. Bind. Address = 0.0.0.0;
    Method 3: directly modify the port binding address to be exposed, for example, the http port binding address information in Tomcat/server. xml;
  4. Can JBoss be started normally, but the application cannot be closed using the shutdown script?
    The shutdown command allows you to close JBoss in several ways. Refer to the help of this command:Usage: shutdown [Options] <operation> <br/> options: <br/>-h, -- help show this help message (default) <br/>-D <Name> [= <value>] set a system property <br/> -- stop processing options <br/>-s, -- Server = <URL> specify the jndi url of the remote server <br/>-N, -- servername = <URL> specify the JMX name of the serverimpl <br/>-, -- adapter = <Name> specify JNDI name of the mbeanserverconnection to use <br/>-u, -- user = <Name> specify the username for authentication <br/>-P, -- Password = <Name> specify the password for authentication <br/> operations: <br/>-S, -- shutdown the server <br/>-E, -- exit = <code> force the VM to exit with a status code <br/>-h, -- Halt = <code> force the VM to halt with A status codeIn general, we use the-S parameter to disable it, that is, through the jndi url;
    There are three possible causes for this situation based on the jndi url:
    First,The content in the default directory used by the current application is inconsistent with the default content of the JBoss.For example, the current JBoss version is 4.0.5, but the default value specified during startup is from CP in JBoss 4.2.1. This situation often occurs when the environment is set up, because SCP is generally directly from another Linux server, the JBoss versions installed on the two servers are different;
    Second, in the shutdown commandThe specified JNDI port is inconsistent with the JNDI port started by the actual application.;
    Third,/etc/The IP address bound to the current host name in hosts is incorrect.For example, the actual IP address of the current server is 10.2.224.214, but 10.0.0.1 is bound in hosts;
    In short, this is because JBoss itself cannot correctly receive the correct command to close. Generally, the following exception information is thrown in JBoss server. log:
    Exception in thread "Main" javax. naming. communicationexception [root exception is Java. RMI. connectexception: Connection refused to host: 10.0.0.1; Nested exception is: <br/> java.net. connectexception: Connection timed out] <br/> at Org. jnp. interfaces. namingcontext. lookup (namingcontext. java: 707) <br/> at Org. jnp. interfaces. namingcontext. lookup (namingcontext. java: 572) <br/> at javax. naming. initialcontext. lookup (initialcontext. java: 351) <br/> at Org. JBoss. shutdown. main (shutdown. (Java: 202) <br/> caused by: Java. RMI. connectexception: Connection refused to host: 10.0.0.1; Nested exception is: <br/> java.net. connectexception: Connection timed out <br/> at Sun. RMI. transport. TCP. tcpendpoint. newsocket (tcpendpoint. java: 574) <br/> at Sun. RMI. transport. TCP. tcpchannel. createconnection (tcpchannel. java: 185) <br/> at Sun. RMI. transport. TCP. tcpchannel. newconnection (tcpchannel. java: 171) <br/> at Sun. RMI. server. unicastref. invoke (unicastref. java: 94) <br/> at Org. jnp. server. namingserver_stub.lookup (unknown source) <br/> at Org. jnp. interfaces. namingcontext. lookup (namingcontext. java: 610) <br/>... 3 more
  5. How to debug the JBoss application in Linux?
    In fact, this problem has no direct relationship with whether JBoss is deployed in Linux. It can be used when JBoss is started.Remote debug portYou can, for example:
    -Xrunjdwp: Transport = dt_socket, address = 8787, Server = Y, suspend = N
    Then, you can specify the corresponding port when creating remote debug in eclipse;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.