JBOSS4 installation configuration

xiaoxiao2021-03-06  109

This article records the installation configuration JBoss4 and data sources, and test the process. 1. Install 1.1, install J2SDK1.41.2, download JBoss-4.0.0.zip. The installation method is to extract the file to the C: / JBoss4 of the hard disk. 2, run into the bin directory to enter JBoss4, execute run.bat. Seeing Info [Server] JBoss (MX Microkernel) [4.0.0dr4 (build: cvstag = head date = 200405190212)] Started In 55s: 851ms

Such prompt information illustrates the start-up success, the test method is as follows http: // localhost: 8080 / jmx-console you will see JMX Agent View ZZ2ZCWB

The default web directory of JBoss is in JBoss4 / Server / Default / Deploy

4, configure the database mysql4.1, copy JBoss4 / DOCS / EXAMPLES / JCA / MYSQL-DS.XML to JBoss4 / Server / Default / Deploy, and make appropriate modifications to JNDI, USER, PASSWORD, with current local MySQL Installation. (MYSQL installation configuration can refer to other articles)

mysqlds jdbc: mysql: // localhost: 3306 / story < / connection-url> com.mysql.jdbc.driver test Test

mysql

4.2, download MySQL driver, and extract. 4.3, copy the mysql driver file mysql-connector-java-3.0.15-ga-bin.jar to the JBoss4 / Server / Default / lib directory, restart JBoss4.

5, test 5.1, html, JSP test first build a Test.war folder under deploy, then put HTML, JSP files, for example, establish a TestDate.jsp, as follows: <% @ page language = "JAVA "%> <% @ Page contenttype =" text / html; charset = GB2312 "%> <% @ page import =" java.util. * "%> <% = New date (). ToString ()%> via HTTP : // localhost: 8080 / test / test.jsp Call can get the current date time. 5.2, in the JSP middle-run adjustment operation database <% @ page language = "java"%> <% @ page import = "javax.naming. *"%> <% @ Page import = "javax.sql. *"%> <% @ page import = "java.sql. *"%> <%! javax.sql.datasource DS;%> <% try {context ctx = new initialContext (); DS = (javax.sql.datasource) CTX. LOOKUP ("java: / mysqlds");} catch (exception e) {Out.println ("Erro When Connect To Java Naming API);} Connection Conn = DS.GetConnection (); Statement St = Conn.createment () String sqlstr = "select * from cat"; resultset = st.executeQuery (sqlstr); while (rs.next ()) {Out.println (rs.getstring ("categoryName" "
"); } Rs.close (); st.close (); Conn.close ();%> 5.3, Servlet configuration test 5.3.1 Written and compile the following simple servlet import java.io. *; import javax.servlet. * Import javax.servlet.http. *;

public class HelloWorld extends HttpServlet {public void doGet (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {response.setContentType ( "text / html"); PrintWriter out = response.getWriter (); out.println ( ""); out .println ("Hello World");}} 5.3.2 Create a web-inflicide under the Test.war folder, build a class content and the web.xml file directory structure is as follows: [Test.war] [Web -Inf] Web.xml WEB.XML will be placed in the class of successfully. Web.xml content is as follows: HelloWorld HelloWorld HelloWorld / helloworld

By calling http: // localhost: 8080 / test / helloworld, you can see the output of Hello World.

转载请注明原文地址:https://www.9cbs.com/read-105188.html

New Post(0)