Jboss4 installation testing
Abstract: jboss4 installation testing
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> 1, download and install
<1> to download http://www.jboss.org/ can download, I was under the jboss-4.0.0DR4.
<2> installation method is to extract the files to a hard drive directory (for example: My solution to the c: \ jboss4).
2, installed j2sdk1.4.
Jboss without java standards development kits. I installed the 1.4 install directory is C: \ j2sdk1.4
3, run
Jboss4 entered the bin directory, we can implement run.bat. See the emergence of
INFO [Server] JBoss (MX MicroKernel) [4.0.0DR4 (build: CVSTag = HEAD
Date = 200405190212)] Started in 55s: 851ms
Such messages on the success of the launch, the following test methods
Http://localhost:8080/jmx-console you will see jmx agent view zz2zcwb
4, the use of
<1> html, jsp test
Jboss web directory is the default in jboss4 \ server \ default \ deploy below. Below introduced on the test jsp, servlet approach:
The first test in the establishment of a test.war deploy folder, and then html, jsp files can be put to test here
Such as the establishment of a test.jsp as follows:
<% @ Page language = "java"%>
<% @ Page contentType = "text / html; gb2312 charset ="%>
<% @ Page import = "java.util .*"%>
<% = New Date (). ToString ()%>
Http://localhost:8080/test/test.jsp can be called by the current date and time.
<2> set sql server2000 data sources in the parade and then call jsp Database
<<1>> to download and install sql server2000 the jdbc drive (Microsoft)
<<2>> will mssqlserver, msbase, msutil three jar files copied to jboss4 \ server \ default \ lib directory
<<3>> will jboss4 \ docs \ examples \ jca \ mssql-ds.xml a copy to jboss4 \ server \ default \ deploy Below
Part amended to read as follows:
The above configuration is used as a data source ds name with a non-password users connect sa sql server database model northwind. You can make the appropriate changes.
<<4>> configuration completed, the document by the following test database operations testSql.jsp
<table Width="670" height="27" border="0"> <tr> <td width="383"> <% @ 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: / ds");
) Catch (Exception e) (
Out.println ( "erro when connect to java naming api");
) </ Td> <td width="277"> </ td> </ tr> </ table>
Connection conn = ds.getConnection ();
Statement st = conn.createStatement ();
String sqlStr = "select * from categories";
ResultSet rs = st.executeQuery (sqlStr);
While (rs.next ()) (
Out.println (rs.getString ( "categoryName") + "
");
)
Rs.close ();
St.close ();
Conn.close ();
%>
Table output categories for each record categoryName, it is noteworthy that in the mssql-ds.xml set jndi-name is ds, and the bonding is real
Java: / ds.
<3> servlet test configuration
<<1>> prepared and compiled 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");
)
)
<<2>> test.war folder in the establishment of a WEB-INF directory, again inside the establishment of a directory of classes and web.xml file directory structure is as follows:
[Test.war]
[WEB-INF]
[Classes]
Web.xml
Compiler will be available to the success of HelloWorld.class classes directory, web.xml as follows:
<? Xml version = "1.0">
Web-app PUBLIC
"- / / Sun Microsystems, Inc / / DTD Web Application 2.3 / / EN"
"Http://java.sun.com/dtd/web-app_2_3.dtd">
By calling http://localhost:8080/test/HelloWorld hello world can see the output
</ Td> </ tr> <tr>
↑ Back






