FAQs about Jboss startup, shutdown, and port configuration in Linux

Source: Internet
Author: User
Tags jboss jboss server
FAQs about Jboss startup, shutdown, and port configuration in Linux FAQ about Jboss startup, shutdown, and port configuration in Linux (11:49:47)


Windows:

Run. bat-c xy-B 0.0.0.0)


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;
In general, we can use-Djboss. server. home to set different directories for the current instance to load during Jboss startup;
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;
Second, enable jboss in the jboss-service.xml. system: service = ServiceBindingManager: mbean service. set the ServerName and StoreURL attributes. configure all the corresponding ports of each application in the same file. this solution is recommended. for details, refer: view plaincopy to clipboardprint?
<Mbean code = "org. jboss. services. binding. ServiceBindingManager"
>
Ports-01
$ {Jboss. home. url}/docs/examples/binding-manager/sample-bindings.xml

Org. jboss. services. binding. XMLServicesStoreFactory
</Attribute>
</Mbean>
<Mbean code = "org. jboss. services. binding. ServiceBindingManager"
>
Ports-01
$ {Jboss. home. url}/docs/examples/binding-manager/sample-bindings.xml

Org. jboss. services. binding. XMLServicesStoreFactory

</Mbean>
Jboss cannot be started normally. javax. management. MBeanRegistrationException: preRegister () failed?
Generally, the above exception occurs in versions 4.2 and later. the detailed exception is as follows: view plaincopy to clipboardprint?
Javax. management. MBeanRegistrationException: preRegister () failed: [ObjectName = 'jboss. remoting: service = NetworkRegistry ', Class = org. jboss. remoting. network. networkRegistry (org. jboss. remoting. network. networkRegistry @ 16b6c55)]
At org. jboss. mx. server. registry. BasicMBeanRegistry. invokePreRegister (BasicMBeanRegistry. java: 713)
At org. jboss. mx. server. registry. BasicMBeanRegistry. registerMBean (BasicMBeanRegistry. java: 211)
At sun. reflect. GeneratedMethodAccessor1.invoke (Unknown Source)
At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 25)
At java. lang. reflect. Method. invoke (Method. java: 585)
At org. jboss. mx. interceptor. ReflectedDispatcher. invoke (ReflectedDispatcher. java: 155)
... 51 more
Caused by: java. lang. RuntimeException: Exception creating identity: mall_dev4: mall_dev4
At org. jboss.remoting. ident. Identity. get (Identity. java: 211)
At org. jboss. remoting. network. NetworkRegistry. preRegister (NetworkRegistry. java: 268)
At org. jboss. mx. server. AbstractMBeanInvoker. invokePreRegister (AbstractMBeanInvoker. java: 966)
At org. jboss. mx. modelmbean. ModelMBeanInvoker. invokePreRegister (ModelMBeanInvoker. java: 489)
At org. jboss. mx. server. AbstractMBeanInvoker. preRegister (AbstractMBeanInvoker. java: 654)
At org. jboss. mx. server. registry. BasicMBeanRegistry. invokePreRegister (BasicMBeanRegistry. java: 697)
... 56 more
Javax. management. MBeanRegistrationException: preRegister () failed: [ObjectName = 'jboss. remoting: service = NetworkRegistry ', Class = org. jboss. remoting. network. networkRegistry (org. jboss. remoting. network. networkRegistry @ 16b6c55)]
At org. jboss. mx. server. registry. BasicMBeanRegistry. invokePreRegister (BasicMBeanRegistry. java: 713)
At org. jboss. mx. server. registry. BasicMBeanRegistry. registerMBean (BasicMBeanRegistry. java: 211)
At sun. reflect. GeneratedMethodAccessor1.invoke (Unknown Source)
At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 25)
At java. lang. reflect. Method. invoke (Method. java: 585)
At org. jboss. mx. interceptor. ReflectedDispatcher. invoke (ReflectedDispatcher. java: 155)
... 51 more
Caused by: java. lang. RuntimeException: Exception creating identity: mall_dev4: mall_dev4
At org. jboss.remoting. ident. Identity. get (Identity. java: 211)
At org. jboss. remoting. network. NetworkRegistry. preRegister (NetworkRegistry. java: 268)
At org. jboss. mx. server. AbstractMBeanInvoker. invokePreRegister (AbstractMBeanInvoker. java: 966)
At org. jboss. mx. modelmbean. ModelMBeanInvoker. invokePreRegister (ModelMBeanInvoker. java: 489)
At org. jboss. mx. server. AbstractMBeanInvoker. preRegister (AbstractMBeanInvoker. java: 654)
At org. jboss. mx. server. registry. BasicMBeanRegistry. invokePreRegister (BasicMBeanRegistry. java: 697)
... 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. view plaincopy to clipboardprint?
11:32:12, 427 WARN [ServiceController] Problem starting service jboss: service = invoker, type = http
Java.net. UnknownHostException: mall_dev4: mall_dev4
At java.net. InetAddress. getLocalHost (InetAddress. java: 1308)
At org. jboss. invocation. http. server. HttpInvoker. checkInvokerURL (HttpInvoker. java: 204)
At org. jboss. invocation. http. server. HttpInvoker. startService (HttpInvoker. java: 101)
At org. jboss. system. ServiceMBeanSupport. jbossInternalStart (ServiceMBeanSupport. java: 289)
At org. jboss. system. ServiceMBeanSupport. jbossInternalLifecycle (ServiceMBeanSupport. java: 245)
At sun. reflect. GeneratedMethodAccessor2.invoke (Unknown Source)
At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 25)
At java. lang. reflect. Method. invoke (Method. java: 585)
At org. jboss. mx. interceptor. ReflectedDispatcher. invoke (ReflectedDispatcher. java: 155)
At org. jboss. mx. server. Invocation. dispatch (Invocation. java: 94)
At org. jboss. mx. server. Invocation. invoke (Invocation. java: 86)
At org. jboss. mx. server. AbstractMBeanInvoker. invoke (AbstractMBeanInvoker. java: 264)
At org. jboss. mx. server. MBeanServerImpl. invoke (MBeanServerImpl. java: 659)
At org. jboss. system. ServiceController $ ServiceProxy. invoke (ServiceController. java: 978)
At $ Proxy0.start (Unknown Source)
At org. jboss. system. ServiceController. start (ServiceController. java: 417)
11:32:12, 427 WARN [ServiceController] Problem starting service jboss: service = invoker, type = http
Java.net. UnknownHostException: mall_dev4: mall_dev4
At java.net. InetAddress. getLocalHost (InetAddress. java: 1308)
At org. jboss. invocation. http. server. HttpInvoker. checkInvokerURL (HttpInvoker. java: 204)
At org. jboss. invocation. http. server. HttpInvoker. startService (HttpInvoker. java: 101)
At org. jboss. system. ServiceMBeanSupport. jbossInternalStart (ServiceMBeanSupport. java: 289)
At org. jboss. system. ServiceMBeanSupport. jbossInternalLifecycle (ServiceMBeanSupport. java: 245)
At sun. reflect. GeneratedMethodAccessor2.invoke (Unknown Source)
At sun. reflect. DelegatingMethodAccessorImpl. invoke (DelegatingMethodAccessorImpl. java: 25)
At java. lang. reflect. Method. invoke (Method. java: 585)
At org. jboss. mx. interceptor. ReflectedDispatcher. invoke (ReflectedDispatcher. java: 155)
At org. jboss. mx. server. Invocation. dispatch (Invocation. java: 94)
At org. jboss. mx. server. Invocation. invoke (Invocation. java: 86)
At org. jboss. mx. server. AbstractMBeanInvoker. invoke (AbstractMBeanInvoker. java: 264)
At org. jboss. mx. server. MBeanServerImpl. invoke (MBeanServerImpl. java: 659)
At org. jboss. system. ServiceController $ ServiceProxy. invoke (ServiceController. java: 978)
At $ Proxy0.start (Unknown Source)
At org. jboss. system. ServiceController. start (ServiceController. java: 417)
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 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; while the latter is only bound to 127.0.0.1 without binding the local IP address, access to the application through the 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: run the-B, -- host = Specify the address. for example,-B 0.0.0.0 indicates binding all addresses;
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;
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. For more information, see view plaincopy to clipboardprint?
Usage: shutdown [options] <operation>
Options:
-H, -- help Show this help message (default)
-D [= ] Set a system property
-- Stop processing options
-S, -- server = Specify the jndi url of the remote server
-N, -- serverName = Specify the JMX name of the ServerImpl
-A, -- adapter = Specify JNDI name of the MBeanServerConnection to use
-U, -- user = Specify the username for authentication
-P, -- password = Specify the password for authentication
Operations:
-S, -- shutdown Shutdown the server
-E, -- exit = Force the VM to exit with a status code
-H, -- halt =Force the VM to halt with a status code
Usage: shutdown [options] <operation>
Options:
-H, -- help Show this help message (default)
-D [= ] Set a system property
-- Stop processing options
-S, -- server = Specify the jndi url of the remote server
-N, -- serverName = Specify the JMX name of the ServerImpl
-A, -- adapter = Specify JNDI name of the MBeanServerConnection to use
-U, -- user = Specify the username for authentication
-P, -- password = Specify the password for authentication
Operations:
-S, -- shutdown Shutdown the server
-E, -- exit = Force the VM to exit with a status code
-H, -- halt =Force the VM to halt with a status code in general, we use the-s parameter to close, 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 current running jboss, for example, the current jboss version is 4.0.5, the default value specified during startup is cp from jboss 4.2.1. this often occurs when the environment is set up, because scp is usually directly from another linux server, however, the jboss versions installed on the two servers are different;
Second, the JNDI Port specified in the shutdown command is inconsistent with the JNDI Port started by the actual application;
3. the IP address bound to the current host name in/etc/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 to the host name 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:
View plaincopy to clipboardprint?
Exception in thread "main" javax. naming. CommunicationException [Root exception is java. rmi. ConnectException: Connection refused to host: 10.0.0.1; nested exception is:
Java.net. ConnectException: Connection timed out]
At org. jnp. interfaces. NamingContext. lookup (NamingContext. java: 707)
At org. jnp. interfaces. NamingContext. lookup (NamingContext. java: 572)
At javax. naming. InitialContext. lookup (InitialContext. java: 351)
At org. jboss.shutdown. main (Shutdown. java: 202)
Caused by: java. rmi. ConnectException: Connection refused to host: 10.0.0.1; nested exception is:
Java.net. ConnectException: Connection timed out
At sun. rmi. transport. tcp. TCPEndpoint. newSocket (TCPEndpoint. java: 574)
At sun. rmi. transport. tcp. TCPChannel. createConnection (TCPChannel. java: 185)
At sun. rmi. transport. tcp. TCPChannel. newConnection (TCPChannel. java: 171)
At sun. rmi. server. UnicastRef. invoke (UnicastRef. java: 94)
At org. jnp. server. NamingServer_Stub.lookup (Unknown Source)
At org. jnp. interfaces. NamingContext. lookup (NamingContext. java: 610)
... 3 more
Exception in thread "main" javax. naming. CommunicationException [Root exception is java. rmi. ConnectException: Connection refused to host: 10.0.0.1; nested exception is:
Java.net. ConnectException: Connection timed out]
At org. jnp. interfaces. NamingContext. lookup (NamingContext. java: 707)
At org. jnp. interfaces. NamingContext. lookup (NamingContext. java: 572)
At javax. naming. InitialContext. lookup (InitialContext. java: 351)
At org. jboss.shutdown. main (Shutdown. java: 202)
Caused by: java. rmi. ConnectException: Connection refused to host: 10.0.0.1; nested exception is:
Java.net. ConnectException: Connection timed out
At sun. rmi. transport. tcp. TCPEndpoint. newSocket (TCPEndpoint. java: 574)
At sun. rmi. transport. tcp. TCPChannel. createConnection (TCPChannel. java: 185)
At sun. rmi. transport. tcp. TCPChannel. newConnection (TCPChannel. java: 171)
At sun. rmi. server. UnicastRef. invoke (UnicastRef. java: 94)
At org. jnp. server. NamingServer_Stub.lookup (Unknown Source)
At org. jnp. interfaces. NamingContext. lookup (NamingContext. java: 610)
... 3 more
How to debug the Jboss application in Linux?
In fact, this problem is not directly related to whether Jboss is deployed in Linux. you can specify the remote debug port when jboss is started, for example:
View plaincopy to clipboardprint?
-Xrunjdwp: transport = dt_socket, address = 8787, server = y, suspend = n
-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.