JBoss Getting Started and Basic Applications

xiaoxiao2021-03-18  212

For work, JBoss is required to do web application servers. It used to have an application experience in Apache, Tomcat, Resin. From entry to development applications, some knowledge is organized, posted here, I hope that I have to see me to apply. It can get your hand faster.

1. The status quo and prospects of the JBoss application server

Author: JBoss company, Ben Wang (Wang Wenbin) Translator: Luo Shifei In recent years, the field of J2EE application server, JBoss is the fastest growing application server. Because JBoss follows business-friendly LGPL authorization distribution, it is developed by open source community, which makes JBOSS popular. In addition, JBoss application servers also have many excellent qualities. First, it will have revolutionary JMX micronuclei services as its bus structure; two, it is itself a service-oriented architecture, SOA); its three, it also has a unified class loader, thus The thermal deployment and heat transfer capacity of the application can be implemented. Therefore, it is a highly modular and loose coupling. Positive feedback from JBoss users tells us that JBoss application servers are robust, high quality, and have good performance. In order to meet the growing needs of the enterprise market, JBoss has launched 24 * 7, professional-grade product support services since 2003. At the same time, in order to expand JBoss enterprise market, JBoss has also signed many channel partners. For example, JBoss has partners with HP, Novell, Computer Associates, Unisys, etc. In June 2004, JBoss announced that the JBoss application server passed Sun's J2EE certification. This is the most important milestone in the history of JBoss application servers. At the same time, JBoss has been following the latest J2EE specification and leads the development of J2EE specifications in some technical fields. Therefore, whether in the business sector, JBoss has become the first mainstream application server through J2EE 1.4 authentication. Now, the JBoss application server has truly developed a application server with a business intensity (ie, support for critical level tasks). JBoss 4.0 is one of the important results of J2EE certification, which has been successfully released in September 2004. At the same time, JBoss 4.0 also provides JBoss AOP (Aspect-Oriented Programming, aspect-oriented) components. Recently, AOP attracted a lot of developers' concerns. It provides new programming modes that allow users to separate aspects (such as transactions) from underlying business logics, thereby shortening software development cycles. Users can use JBoss AOP separately to use it outside the JBOSS application server. Alternatively, users can use it in the application server environment. JBoss AOP 1.0 has been released in October 2004. Looking forward to the next generation of JBoss application servers, its focus is EJB 3.0. Currently, J2EE 1.4 specification uses EJB 2.1. Among them, the main goal of EJB 3.0 is to simplify the EJB model, that is, the user can easily develop EJB components, and can test EJB components outside the EJB container. The draft EJB 3.0 has been launched in June 2004. JBoss has been actively participating in the development of EJB 3.0 specification and contributes its own strength in the development of EJB specification. Among them, GAVIN KING (Hibernate's founder) and Bill Burke (Chief Architect from JBoss) have contributed a lot for the draft of EJB 3.0. JBoss issued an EJB 3.0 preview based on JBoss application servers in early October 2004. Although the ejb 3.0 specification is still in the initial development and review phase, this tests EJB 3.0 for J2EE communities, and provides feedback to provide a good opportunity.

This also confirmed that JBoss is an innovative company. JBoss has been leading the development of technical specifications. In recent years, Hibernate has become a factual persistence engine. JBoss is committed to developing itself into a community of open source projects, such as recruiting Gavin King and many Hibernate developers. Among them, the latest version of the JBoss application server has set the Hibernate set as JMX MBean services. This allows users to use Hibernate directly in the application server environment, regardless of whether it is in the J2EE context. Since 2003, JBOSS launched a JBosscache project. JBossCache is a memory-based, replicable, transactional cache system, and has persistent status storage management capabilities. Recently, it is greatly concerned. Users can use JBossCache in the JBoss application server or other application server. At the same time, it provides JBoss AOP-based AOP modules to implement fine-grained, domain grade replication in a replicable environment, and can transparently manage complex objects. In the latest version of the JBoss Application Server, users can access JBossCache's services through JMX MBean services. The next generation of JBoss application servers (tentative names, JBoss 5.0) will provide a large number of new features. In addition to supporting the latest EJB 3.0 specification, the new version of JBoss AOP will be officially released. At the same time, the JBoss development team also plans to develop new micron nucleations, which is independent of JMX, making it independently. In addition, the architecture and development of the JBoss application server can be referred to the book from the "JBoss Administration and Development 3.2.x Third Edition" of SCOTT Stark (this book has been introduced and translated by the Electronic Industry Press, Chinese version. The title is "JBoss Management and Development Core Technology (Third Edition)"). Dr. Scott Stark is one of the founders of JBoss, he has been leading the development of JBoss products. The book covers all aspects of the JBoss application server, such as the JMX micro-kernel, client, and server interceptors, and implementation of J2EE platform services. If the developer is interested in JBoss kernel and development based on JBoss / J2EE, it is best to read this authority. 2.Jboss's acquisition

JBoss's official website is www.jboss.com, at http://www.jboss.com/downloads/index can download a variety of jboss, and plugins for IDEs such as Eclipse, JBUILDER. I downloaded the ZIP version of JBoss-3.2.7.tar.gz.

Of course, JBoss runs requires JDK support, and the version is not loose, the corresponding JDK requirements are different, the JDK download address is http://java.sun.com/

3. Pricing and management of Jboss

JBoss-3.2.7.tar.gz After the compression, the (Windows XP) System-Properties-Advanced-Environment Variable, add JBoss_home, point to the unzipped directory. Add JBoss_home's bin directory to the system PATH environment variable, so that you can start JBoss in the start menu running, you can start JBoss.

You can also start JBOSS in the bin directory in the bin directory in the JBoss directory. If you don't see anything, the startup information is as follows:

============================================================================================================================================================================================================= =====================================. Jboss bootstrap environment. Jboss_home: d: /javatool/jboss-3.2.7/bin//// ... Java: D: /javatool/jdk1.5.0_06/bin/java. Java_opts: -dprogram.name = run.bat. ClassPath: D: /JAVATOOL/JDK1.5.0_06/lib/tools.jar; D: /javatool/jboss-3.2.7/bin//run.jar.==================================== =====================================================. 16:47: 58,953 Info [Server] Starting JBoss (MX Microkernel) ... 16: 47: 58,953 Info [Server] Release ID: JBoss [Wonderland] 3.2.7 (Build: cvstag = jboss_3_2_7 date =

16: 47: 58,968 Info [Server] Home Dir: D: /JAVATOOL/JBOSS-3.2.716: 47: 58,968 Info [Server] Home Url: file: / d: /javatool/jboss-3.2.7/16 : 47: 58,968 Info [Server] Library URL: File: / D: /javatool/jboss-3.2.7/lib/16: 47: 58,968 Info [Server] Patch URL: Null16: 47: 58,968 Info [Server] Server Name : Default16: 47: 58,968 Info [Server] Server Home Dir: D: /javatool/jboss-3.2.7/server/default16: 47: 58,968 Info [Server] Server Home URL: File: / D: / javatool / jboss 3.2.7 / Server / Default / 16: 47: 58,968 Info [Server] Server Data DIR: D: /JAVATOL/Jboss-3.2.7/server/default/data16: 47: 58,968 info [server] Server Temp Dir: D : /javatool/jboss-3.2.7/server/default/TMP16: 47: 58,968 Info [Server] Server config URL: file: / d: /javatool/jboss-3.2.7/server/default/conf/16: 47 : 58,968 Info [Server] Server Library URL: File: / D: /javatool/jboss-3.2.7/server/default/lib/16: 47: 58,968 info [server] root deployment filename: jboss-service.xml16: 47 : 58,968 Info [Server] Starting General Purpose Architecture (GPA) ... 16:47 : 59,312 INFO [ServerInfo] Java Version: 1.5.0_06, Sun Microsystems Inc.16: 47: 59,312 Info [ServerInfo] Java VM: Java Hotspot (TM) Client VM 1.5.0_06-B05, Sun Microsystems Inc.16: 47: 59,312 INFO [ServerInfo] OS-System: Windows XP 5.1, x8616: 47: 59,625 INFO [Server] Core system initialized16: 48: 04,281 INFO [Log4jService $ URLWatchTimerTask] Configuring from URL: resource: log4j.xml16: 48: 04,890 INFO [ WebService] Using RMI server codebase: http: // YXB: 8083/16: 48: 06,203 INFO [NamingService] Started jndi bootstrap jnpPort = 1099, rmiPort = 1098, backlog = 50, bindAddress = / 0.0.0.0, Client SocketFactory = null , Server socketFactory = org.jboss.net.sockets.defaultsocketFactory @

ad09307616: 48: 10,828 INFO [Embedded] Catalina naming disabled16: 48: 11,890 INFO [Http11Protocol] Initializing Coyote HTTP / 1.1 on http-0.0.0.0-808016: 48: 11,937 INFO [Catalina] Initialization processed in 1016 ms16: 48: 11,937 INFO [StandardService] Starting service jboss.web16: 48: 11,937 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat / 5.0.3016: 48: 11,968 INFO [StandardHost] XML validation disabled16: 48: 12,000 INFO [Catalina] Server startup in 63 MS16: 48: 12,187 info [TomcatDeployer] deploy, ctxpath = / invoker, war = file: / d: /javatool/jboss-3.2.7/server/default/deploy/http-invoker.sar/invoker.war/16: 48: 14,562 Info [TomcatDeployer] Deploy, CTXPath = /, WarURL = file: / d: /javatool/jboss-3.2.7/server/default/deploy/jbossweb-tomcat50.sar/root.war/16: 48: 14,968 Info [TomcatDeployer] deploy, ctxpath = / jbossmq-httpil, warurl = file: / d: /javatool/jboss-3.2.7/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/16 : 48: 16,921 Info [Rarmetadata] Loading Jboss Resource Adapter for J DBC 2 XA drivers16: 48: 16,937 INFO [RARMetaData] Required license terms present See deploymentdescriptor.16:. 48: 23,031 INFO [MailService] Mail Service bound to java: / Mail16: 48: 23,796 INFO [DefaultDS] Bound connection factory for resource Adapter for connectionManager 'jboss.jca: service = localtxcm, name = defaultds to jndi name' java: / defaultds'

16: 48: 24,781 Info [A] Bound to JNDI Name: Queue / A16: 48: 24,781 Info [B] Bound to JNDI Name: Queue / B16: 48: 24,781 Info [C] Bound to JNDI Name: Queue / C16: 48: 24,796 Info [D] Bound to JNDi Name: Queue / D16: 48: 24,796 Info [EX] Bound to JNDI Name: Queue / Ex16: 48: 24,828 info [testtopic] bound to jndi name: Topic / Testtopic16: 48: 24,828 info [securedtopic] bound to jndi name: Topic / SecuredTopic16: 48: 24, 828 info [testdurabletopic] bound to jndi name: Topic / TestDurabletopic

16: 48: 24,843 INFO [testQueue] Bound to JNDI name: queue / testQueue16: 48: 24,937 INFO [UILServerILService] JBossMQ UIL service available at: /0.0.0.0:809316:48:25,312 INFO [DLQ] Bound to JNDI name: queue / DLQ16: 48: 25,500 INFO [JmsXA] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca: service = TxCM, name = JmsXA to JNDI name' java: / JmsXA'16: 48: 25,500 INFO [socialDs] Bound connection factory for resource adapter forConnectionManager 'jboss.jca: service = LocalTxCM, name = socialDs to JNDI name' java: / socialDs'16: 48: 27,625 INFO [TomcatDeployer] deploy, ctxPath = / jmx-console, warUrl = file: / D: /javatool/jboss-3.2.7/server/default/deploy/jmx-console.war/16: 48: 27,906 info [TomcatDeployer] Deploy, CTXPath = / Web-Console, WarURL = File: / D: / Javatool /jboss-3.2.7/server/default/deploy/management/web-console.war/16:48:28,968 info [TomcatDeployer] Deploy, CTXPath = / Oracle-Test, WarURL = file: / d: / javatool / jboss -3.2.7 / Server / Default / Depoy / Oracle-Test.war / 16: 48: 32, 2013 Info [TomcatDeploye r] Deploy, CTXPath = / WAPWeb, WarURL = file: / d: /javatool/jboss-3.2.7/server/default/tmp/Deploy/tmp38022wapweb.war/16: 48: 33,031 Info [http11protocol] Starting Coyote HTTP / 1.1 on http-0.0.0.0-808016: 48: 33,359 info [channelsocket] JK2: ajp13 listening on / 0.0.0.0:800916:48:0.0:800916:48:0.0:800916:48:0.0:800916:48:0.0:800916:48:0.0:800916:48:33,531 info [jkmain] jk running id = 0 Time = 0/375 config = NULL16: 48: 33,578 Info [Server] JBoss (MX Microkernel) [3.2.7 (build: cvstag = jboss_3_2_7 date = 200501280217)] Started in 34s: 16ms This means that JBoss has started successfully, the default port is 8080. You can enter http: // localhost: 8080 / if you can see the JBoss's welcome screen, so JBOSS is successfully installed.

JBoss Online Resources

Getting Started with Jboss 3.2 [PDF] JBoss Wiki Jboss Forums

JBoss ManagementTomcat Status (FULL) (XML) JMX Console JBoss Web Console

Welcome screen As above, you can choose a link to enter and manage the JBoss-related configuration. It is worth noting that JBOSS integrates Tomcat.

4. Simple application of Jboss

An example of connecting Oracle in JBoss in JBoss.

First enter the JBoss installation directory, d: /javatool/jboss-3.2.7/server/default/dePloy; file HSQLDB-DS.XML is the properties file for configuring the database link, you can copy HSQLDB-DS.XML and then renamed Oracle -ds.xml, the file content is modified as follows:

SocialDS jdbc: Oracle: Thin: @ 192.168.1.230: 1521: Ora9 - -> JDBC: Oracle: Thin: @ 202.103.67.175: 5012: Newwapdb

Here Are A Couple of The Possible OCI Configuration, See http://otn.racle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm

JDBC: Oracle: OCI: @ Youroracle-TNS-Name or jdbc: Oracle: OCI: @ (description = (address = (Host = YouroShost) (protocol = TCP) (port = 1521))) (service_name = yourviceName))

Clearly, ITS Better to Have TNS Set Up Properly. -> Oracle.jdbc.driver.racledriver WAPWORK WapManager org.jboss.Resource.Adapter.jdbc .ventedor.OraclevalidConnectionchecker Org.jboss.Resource. Adapter.jdbc.vendor.racleExceptionsORTER Some Arbitrary SQL -> < ! - sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered some arbitrary sql ->

Of course, you have to modify some configurations that adapt to your database, such as username, database address.

Then create an Oracle-Test.war directory in this directory, and pay attention to the name of the directory is ended with .war, which is automatically loaded when it is released.

As a site directory, a web-inflicity is required in this directory. The content inside is empty, or you can copy the things in the example. Build an index.jsp file in this directory, the content is as follows:

<% @ page language = "java" ContentType = "text / html; charset = GB2312" PageEncoding = "GBK"%> <% @ page import = "java.sql. *, javax.sql.datasource, javax.naming. InitialContext "%>

Test Oracle DB

<%

InitialContext CTX = New InitialContext (); Datasource DS = (DataSource) CTX.lookup ("Java: / SocialDS"); // Note Here and Front Oracle-DS.xml CONNECTION CONN = DS.GetConnection (); StMT Stmt = Conn.createStatement (); ResultSet RS = Stmt.executeQuery ("SELECT COUNT (*) from book");

While (rs.next ()) {

Out.println (Rs.Getint (1) "
");

Out.println ("My Name Is Ahpo
);

}

CONN.CLOSE ();

%>

Start JBoss Enter http: // localhost: 8080 / Oracle-test in the browser to display the results of the database connection.

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

New Post(0)