Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to maintain JBOSS

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Xiaobian to share with you how to maintain JBOSS, I hope you have something to gain after reading this article, let's discuss it together!

I. Set console login window

After installing jboss and starting jboss, type http://localhost:8080/jm-console[@more@]http://localhost:8080/jmx-console in the address bar of the browser window to browse some information about jboss deployment management. By default, you can enter this page without typing any username and password. Convenience is convenient, but it is still a bit of a security risk to use, because no matter who knows the IP of the server, you can access it. Below we configure jboss for this problem, so that access to jmx-console must also know the username and password to access.

Steps:

1. Go to jmx-console.war, which is usually in the {jboss_home}serverdefaultdeploy directory.

2. Edit WEB-INFweb.xml under this directory and put

Remove some comments

3. Edit roles.properties and users.properties of WEB-INFclasses in this directory; where

1)The users.properties file defines the username and password in the format username=password. Of course, multiple users can be added in this format.

2)Roles.Propertie defines the username and role in the format username=role. The role here must correspond to the one in the web.xml file.

4. Edit the WEB-INFjboss-web.xml file and open some comments; the security-domain corresponding to the content here corresponds to an application-policy in the jaas configuration file {jboss_home} serverdefaultconflogin-config.xml.

For example:

java:/jaas/jmx-console

In login-config.xml there are:

5.Ok! It's done! Restart jboss and you will see the window for entering username and password you want.

Second, start and close the JBOSS application server:

1. Start the JBOSS application server:

l Double-click the desktop shortcut.

Open a command line window, go to %JBOSS_HOME%bin, type run , enter.

2. Close JBOSS application server:

l Directly shut down the JBOSS application server;

Open another command line window, go to %JBOSS_HOME%bin, and type shutdown ? username= username-password= password, Enter.

Third, modify the database and port connected to the JBOSS application server:

1. In JBoss? jboss-3.x---server-default---deploy, mssql-service.xml file:

jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind

sa

1

of which:

①jdbc:microsoft:sqlserver://localhost:1433: SQL2000 port is 1433, if the database and WEB server are distributed on different machines, localhost should be changed to the IP address of the database server;

DatabaseName=Northwind: The database is Northwind and can be modified to another database;

③sa

Use the database username sa

④1

Password corresponding to username sa:1

Note: When our database, username or password is modified, you can modify the corresponding entry in mssql-service.xml.

2. When using JBOSS middleware, the default access port is 8080. How to modify it?

Open the jboss-service.xml file under JBOSS directory-->jboss-3.0.8-->server-->default--& gtdeploy-->jbossweb.sar-->meta-inf, search for 8080, change 8080 to a new port number, save the file, restart the application server. Access using the new port number.

10

100

30000

5000

IV. Other settings

1. Deployment of WAR files

JBoss supports hot deployment, which means that war files are deployed to the server without the need to restart JBoss (Tomcat does not support this feature). The deployment of war file is very simple, directly copy the war file to the JBossserverdefaultdeploy directory.

2. JBoss Directory Structure

bin: The directory contains various script files and related files. The run.bat and shutdown.bat batch files have been used before.

client: Stores configuration information and jar files that may be used by Java client applications or external Web containers.

docs: Save XML files and DTDs referenced in JBoss (examples of how to write configuration files in JBoss are also provided here). This directory contains JCA configuration files that configure data sources for disparate databases such as MySql, Oracle, SQL Server, Postgres, and so on.

lib: This is where the jar files needed to run the JBoss microkernel are stored. Do not store any jar files of your own in this directory.

server: Each subdirectory here corresponds to a server configuration. This configuration is determined by the parameter "-c " when running the script file. There are three configuration examples in the server directory, all, default, and minimal, each of which installs a different service. Default is the default configuration.

Minimal: Loads only the minimal services required to start JBoss, such as logging services, JNDI, and URL deployment scanners (discover new deployments), excluding Web containers, EJB, and JMS.

all: Start all services, including RMI/IIOP, Cluster Services, and Web Services Deployer (default configuration will not be loaded).

When starting JBoss, if run.bat does not take any parameters, the configuration used is the configuration in the server/default directory. If you want to start JBoss with a configuration from another directory, you can use the following parameters:

run -c all

The above command will launch JBoss with configuration information in the all directory. You can also create a new directory under the server directory and write configuration files according to your own needs.

The following describes the directory structure for server configuration, using the default directory as an example.

conf: This directory contains the jboss-service.xml file for the specified core service, and can also be used for other service configuration files.

data: This directory is where the JBoss built-in database Hyponic stores data and where JBossMQ (the JBoss implementation of JMS) stores related information.

deploy: This is where you deploy your J2EE applications (jar, war, and ear files), simply copy the files into this directory. This directory is also used for hot deployment services and JCA resource adapters. There are already some services deployed to this directory, such as jmx-console, which you can access after launching JBoss. JBoss scans the deploy directory periodically and redeploys the application when any component changes.

lib: Hold jar files required for server configuration, for example, you can place JDBC drivers in this directory.

Log: Store log information. JBoss uses Jakarta log4j package to store logs, and you can also use this information directly in the program.

tmp: Stores temporary files generated during decompression during deployment.

work: Tomcat's working directory when compiling JSP files.

The directories data, log, tmp, and work do not exist after JBoss is installed, but are created automatically when JBoss is run.

In addition, the JDBC driver used to connect to the database should be copied to the JBoss_HOMEserverdefaultlib directory.

3. Deployment in JBoss

The deployment process in JBoss is simple, straightforward, and supports hot deployment. In each configuration, JBoss constantly scans a particular directory for changes: $JBOSS_HOME/server/config-name/deploy.

You can copy the following files to this directory:

* Any jar library (whose classes are automatically added to JBoss's classpath)

* EJB JAR

* WAR (Web Application aRrchive) Note that context is war name by default.

* EAR (Enterprise Application aRchive)

* XML file containing JBoss MBean definitions

* A directory containing the extracted contents of an EJB JAR, WAR, or EAR and ending with.jar,.war, or.ear.

If you want to define your own server directory configuration, follow these steps:

According to the JBOSS documentation, we know that in fact, configuring a Server only requires copying all files under the Default directory to a new directory and renaming them. At the same time, we can modify the parameters in some corresponding files. Make the following agreement:

1. Re-specify a run.bat shortcut runJwfm.bat

Copy a copy of run.bat in/BIN directory and modify it

"%JAVA%" %JAVA_OPTS% -classpath "%JBOSS_CLASSPATH%" org.jboss.Main %* is

"%JAVA%" %JAVA_OPTS% -classpath "%JBOSS_CLASSPATH%" org.jboss.Main ? c jwfm %*

2. Modify the corresponding parameter file

The file jboss-service.xml under/Server/jwfm/conf modifies the dynamic deployment time:

5000 will adjust 5000 to 800, especially stable after returning to 5000 read this article, I believe you have a certain understanding of "how to maintain JBOSS", if you want to know more relevant knowledge, welcome to pay attention to the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report