Appendix 1: Basic Concepts and Development Prospects of ejb3
Enterprise JavaBeans is a standard Server Component Model for distributed business applications. Applications written in the Enterprise JavaBeans architecture are scalable, transactional, and secure for multiple users. Applications written using ejbs can be deployed on any server platform that supports Enterprise JavaBeans specifications, such as JBoss and weblogic.
EJB is actually used to write business-layer code.
EJB provides many services that need to be used in enterprise development, such as transaction management, security, persistence, and distribution. Because these services are provided by containers, we do not need to develop them on our own, this greatly reduces our development workload.
Appendix 2: ejb3.0 recommended tutorial
Ejb3.0 entry classic, buy address: http://www.china-pub.com/41146
Ejb3.0 instance tutorials, free electronic http://www.foshanshop.net
Appendix 3: running environment of ejb3
The ejb3.0 application must run in JDK or later versions.
The ejb3.0 application needs to run in the EJB container. Below are some javaee application servers. javaee application servers include web containers and EJB containers. Note: currently, Tomcat is only a Web Container and cannot run EJB applications.
Lesson 1, ejb3.0 _ download and install and run JBoss
A. Download ejb3.0, address: http://www.jboss.org/jbosses/downloads/
B. Unzip the package to install it. It is best not to include Chinese characters in the path.
C. Run. Bat startup, background http: // localhost: 8080/, default configuration in server
D. troubleshooting errors. 1) check whether the port is occupied; 2) Check whether java_home and classpath are set.
3) findstr error. append % SystemRoot %/system32; %/system32; % systemroot; % in path.
E. jboss_home = JBoss installation path
Lesson 2, ejb3.0 _ develop the first stateless Session Bean
A. Three beans in EJB
1) Session Bean-business
2) Entity Bean-persistence
3) Message-driven Bean (Message-driven bean) -- message settings
B. Import the corresponding jar files. We recommend that you import them all.
C. Session beans are classified into stateless session beans and stateful session beans-High Performance of stateless session beans
D. Develop a stateless bean, simple Java project.
Annotation @ stateless @ remote (helloworld. Class)
E. Release. Package the development project first. Then copy to server/default/deploy
Lesson 3 ejb3.0 _ develop an EJB Client
A. The client can be j2se, j2-and J2EE
B. In this case, common Java classes are used.
Public static void main (string [] ARGs)
{
Properties props = new properties ();
Props. setproperty ("Java. Naming. Factory", "org. JMP. Interfaces. namingcontextfactory ");
Props. setproperty ("Java. Naming. provider. url", "localhost: 1099 ");
Try {
Initialcontext CTX = new initialcontext (props );
Helloworld = (helloworld) CTX. Lookup ("helloworldbean/remote ")
System. Out. println (helloworld. sayhello ("Foshan "));
} Catch (namingexception e ){
System. Out. println (E. getmessage ());
}
}
C. Configure the access settings for JNDI. If the access server is different, set the driver class and URL for the context to be different.
Props. setproperty ("Java. Naming. Factory", "com. Sun. Enterprise. Naming. serialnitcontextfactory ");
Props. setproperty ("Java. Naming. provider. url", "localhost: 3700 ");
D. Find the bean in helloworldbean/remote
Helloworld = (helloworld) CTX. Lookup ("helloworldbean/remote ")
E. If you package EJB into a module File suffixed with *. jar, the default global JNDI name is
Local interface EJB-class-name/local
Remote interface EJB-class-name/remote
Example: helloworldbean/remote
If EJB is used as the jaaee enterprise application file with the suffix *. Ear, the default global JNDI name is
Local interface ear-file-base-name/EJB-CLASS-NAME/local
Remote interface ear-file-base-name/EJB-CLASS-NAME/remote
Example: helloworld/helloworldbean/remote
F. Environment properties can be set through the property file. The name is the JNDI. properties file,
Initialcontext CTX = new initialcontext (); EJB will automatically find
The property file content is =
Java. Naming. Factory = org. JMP. Interfaces. namingcontextfactory
Java. Naming. provider. url = localhost: 1099
G. View ejb in the JBoss background .... /JMX-Console
Lesson 4, ejb3.0 _ integrate JBoss into eclipse
A. Close JBoss and press Ctrl + C.
B. Integrate JBoss into eclipse
Click window -- show View -- Other -- server -- servers
Right-click a servers Attempt
New server -- Select Server -- select JDK/JBoss installation path -- the interface is basically unchanged
C. Start and click the green button to stop the red button
Lesson 5 ejb3.0 _ improve the efficiency of EJB application development through ant
A. if you use the previous method to test EJB, You need to continuously package --- deploy --- run. Greatly reduces enterprise development efficiency.
B. Use ant to improve the efficiency of EJB development. The steps are as follows:
Create a bulid. xml file under the project
C. Explanation of properties in the configuration file
(Unfinished)