Configure EJB in Jboss

Source: Internet
Author: User

I. Preface

Jboss is an Open Source and completely free Appliaction Server. It has good support for J2EE and can be perfectly integrated with Tomcat.

Ii. Download and install

For Jboss official site: Beijing. Yes: http://www.jboss.org/jboss_tomcat.zip

After downloading, decompress the package to a directory. Here I use E: jboss_tomcat as an example. The following sub-directories are available:

E: jboss_tomcatjboss2

And

E: jboss_tomcatomcat32b7

Note that the directory here is slightly changed. If you do not add atat_home to CLASSPATH, the file E: jboss_tomcatjboss2inun_with_tomcat.bat must be modified to run properly.

3. Configure and run

Basically, no configuration is required. If JDK is installed, you 'd better add TOMCAT_HOME to CLASSPATH.

In this way, E: jboss_tomcatjboss2inun_with_tomcat.bat can be removed from the TOMCAT_HOME file.

Run the E: jboss_tomcatjboss2inun_with_tomcat.bat file. In this way, the Tomcat port is 8080 and the Jboss port is 8083,

Running http: // localhost: 8080/will display the tomcat homepage,

When http: // localhost: 8083/is run, a blank page with no error will appear,

Iv. Test EJB

(1) Start JBOSS:

For the method, see:

(2) download the Code:

Http://www.wodejia.net/softdownload/java/interestejb.zip

The following directory is displayed:

Interest/com

Interest/docs

...

Copy all to the examples directory under jboss2. If there is no examples directory, create one with the following structure:

E: jboss_tomcatjboss2examplesinterest...

Copy the file E: jboss_tomcatjboss2examplesinterestinterest.jar:

E: Under jboss_tomcatjboss2deploy:

Add the following file to CLASSPATH:

E: jboss_atoatomcat32b7libservlet.jar; E: jbossclientjboss-client.jar; E: jbossclientjnp-client.jar; E: jbosslibextejb. jar; E: jbossexamplesinterestinterest-client.jar

To test whether the Client calls EJB through servlet, you must copy EJB. class and EJB. java under E: jboss_tomcatjboss2examplesinterest:

E: Under the jboss_tomcatomcat32b7webappsROOTWEB-INFclasses directory

Restart JBOSS_TOMCAT


(3) test and run the client under command:

Command to enter the directory E: jboss_tomcatjboss2examplesinterest
Java InterestClient

:

Got context

Got reference

Interest on 1000 units, at 10% per period, compounded over 2 periods is: 210.00000000000023

The jboss window appears:

[Interest] Someone called 'calculatecompoundinterest!

(4) test and run the web client through Servlet:

Http: // cgreen: 8080/servlet/EJB

:

Interest on 1000 units, at 10% per period, compounded over 2 periods is: 210.00000000000023

The jboss window appears:

[Interest] Someone called 'calculatecompoundinterest!

This operation is successful.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.