JBoss: free Java EE server
JBoss is more suitable for small to medium business applications than expensive WebLogic and WebSphere commercial Java EE servers, and Java has moved from the noble halls to the homes of ordinary people. JBoss + MySQL is the perfect business operation platform of the Java EE, its great superiority is unparalleled cost-effective, is the small and medium-sized enterprise implementation of the golden combination of Java EE! JBoss use is very convenient, after decompression, execute the batch command under the Bin directory (Windows is. bat, Linux is. sh) You can start JBoss, deploy the Java EE application (files ending in. ear or. War) to server/default/ Deploy (usually choose to use the default directory for the deployment of the application). When an application is packaged as an. Ear or. War deployment into a container, if your application contains dynamic loading mechanisms such as frames, then if you have spent hours debugging such as ClassNotFoundException, Noclassdeffounderror Or classcastexception some of these anomalies, so be sure you're not the only one to do so, JBoss as open source code, is more complex and sometimes elusive in the class loading mechanism.
Let's talk about the deployment process:
Preparatory work
System environment: Windows XP SP2
Before you begin, you need to install the Java JDK (JDK is essential), locally installed JDK7, along with the environment variable configuration instructions
1. Name: Java_home, Value: JDK installation path
2. Name: Class_path, Value:%java_home%\lib, if it is new start remember to attach.;
3. Add the following in the system variable path:%java_home%\bin;
When these are done, run java-version in the command window to have output.
JBoss Installation:
At that time because it is an XP system, so the installation is the old version of JBoss (JBOSS-4.0.5.GA), because the version of the older official online has been difficult to find the download, so attach the download link, the new version please visit the official website to download.
Installing JBoss is simple, it does not need to be installed and can be extracted directly into a directory.
Deploying Apps
Like Apache, JBoss also has a deployment directory, which is the Jboss/server directory, which has three directories: All,default,minimal, which represents the three deployment methods JBoss provides, all of which means that all jboss services are open, Default means that the defaults are the JBoss service, and minimal indicates that only the most basic is open. This can increase your own deployment, we only use default.
After entering the default directory, there are several directories:
Conf: some configuration files.
Data: Saved, such as a stateful session bean.
Deploy: Deployment directory, all applications are deployed here, the equivalent of Apache Htdocs.
LIB: The other libraries (jars) that the deployed application needs to use.
Log:jboss's log.
TMP: The deployment app is the resulting temporary file.
Work: Working directory, deployed applications (some jar compressed files) will be unzipped here.
The following steps are required:
Copy the Jboss/docs/examples/jca/mysql-ds.xml to the Jboss/server/default/deploy directory and make the following changes:
- < connection-url >jdbc:mysql://the ip:3306/database name of the database you want to connect to? zerodatetimebehavior=converttonull< /connection-url>
- < driver-class>com.mysql.jdbc.driver< span class= "tag" >< /driver-class>
- < user-name> user name < / User-name>
- < password> password < /password >
Start JBoss
Since there are 3 directories under $jboss-home/server/, All/default/minimal, which represent 3 configurations, all configurations, default configurations, and minimal configuration, when we start the JBOSS service, we can specify
Run–c all means to start the all configuration (all services will be loaded);
Run indicates that it is started with the default configuration;
Run–c Mimimal indicates that the Mimimal configuration is started.
The three are loaded with different number of services, specific differences can be consulted on the JBoss related documents, you can also define a configuration, such as test, is a master to the performance of the consideration, then this document will not be too much help you.
JBoss-Local Installation article