Soumettre la recherche
Mettre en ligne
EJB Part-1
•
0 j'aime
•
391 vues
S
Som Prakash Rai
Suivre
EJB by Som Sir (Java Training Center)
Lire moins
Lire la suite
Ingénierie
Signaler
Partager
Signaler
Partager
1 sur 16
Recommandé
Core java introduction
Core java introduction
Som Prakash Rai
Java script Examples by Som
Java script Examples by Som
Som Prakash Rai
Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)
Som Prakash Rai
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
Pankaj Singh
Jdbc
Jdbc
BindhuBhargaviTalasi
Java interview questions
Java interview questions
Soba Arjun
Java j2ee interview_questions
Java j2ee interview_questions
ppratik86
Java 9 Features
Java 9 Features
NexThoughts Technologies
Recommandé
Core java introduction
Core java introduction
Som Prakash Rai
Java script Examples by Som
Java script Examples by Som
Som Prakash Rai
Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)
Som Prakash Rai
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
Pankaj Singh
Jdbc
Jdbc
BindhuBhargaviTalasi
Java interview questions
Java interview questions
Soba Arjun
Java j2ee interview_questions
Java j2ee interview_questions
ppratik86
Java 9 Features
Java 9 Features
NexThoughts Technologies
Core java interview questions
Core java interview questions
Rohit Singh
Hibernate Advance Interview Questions
Hibernate Advance Interview Questions
Rudra Garnaik, PMI-ACP®
Java interview-questions-and-answers
Java interview-questions-and-answers
bestonlinetrainers
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Edureka!
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdet
devlabsalliance
JDBC
JDBC
Hardik Sondagar
Java 10 New Features
Java 10 New Features
Ali BAKAN
Hibernate notes
Hibernate notes
Rajeev Uppala
50+ java interview questions
50+ java interview questions
SynergisticMedia
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
Hazem Saleh
Corejava ratan
Corejava ratan
Satya Johnny
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
Hazem Saleh
Hibernate3 q&a
Hibernate3 q&a
Faruk Molla
Technical Interview
Technical Interview
prashant patel
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)
Hendrik Ebbers
Best interview questions
Best interview questions
Thesis Scientist Private Limited
Certified Core Java Developer
Certified Core Java Developer
Narender Rana
Core java
Core java
Mallikarjuna G D
Apache Cordova In Action
Apache Cordova In Action
Hazem Saleh
Spring andspringboot training
Spring andspringboot training
Mallikarjuna G D
Distributed Programming using RMI
Distributed Programming using RMI
backdoor
Distributed Programming using RMI
Distributed Programming using RMI
backdoor
Contenu connexe
Tendances
Core java interview questions
Core java interview questions
Rohit Singh
Hibernate Advance Interview Questions
Hibernate Advance Interview Questions
Rudra Garnaik, PMI-ACP®
Java interview-questions-and-answers
Java interview-questions-and-answers
bestonlinetrainers
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Edureka!
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdet
devlabsalliance
JDBC
JDBC
Hardik Sondagar
Java 10 New Features
Java 10 New Features
Ali BAKAN
Hibernate notes
Hibernate notes
Rajeev Uppala
50+ java interview questions
50+ java interview questions
SynergisticMedia
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
Hazem Saleh
Corejava ratan
Corejava ratan
Satya Johnny
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
Hazem Saleh
Hibernate3 q&a
Hibernate3 q&a
Faruk Molla
Technical Interview
Technical Interview
prashant patel
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)
Hendrik Ebbers
Best interview questions
Best interview questions
Thesis Scientist Private Limited
Certified Core Java Developer
Certified Core Java Developer
Narender Rana
Core java
Core java
Mallikarjuna G D
Apache Cordova In Action
Apache Cordova In Action
Hazem Saleh
Spring andspringboot training
Spring andspringboot training
Mallikarjuna G D
Tendances
(20)
Core java interview questions
Core java interview questions
Hibernate Advance Interview Questions
Hibernate Advance Interview Questions
Java interview-questions-and-answers
Java interview-questions-and-answers
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Java Interview Questions and Answers | Spring and Hibernate Interview Questio...
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdet
JDBC
JDBC
Java 10 New Features
Java 10 New Features
Hibernate notes
Hibernate notes
50+ java interview questions
50+ java interview questions
[AnDevCon 2016] Mutation Testing for Android
[AnDevCon 2016] Mutation Testing for Android
Corejava ratan
Corejava ratan
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, JavaOne China 2013
Hibernate3 q&a
Hibernate3 q&a
Technical Interview
Technical Interview
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)
Best interview questions
Best interview questions
Certified Core Java Developer
Certified Core Java Developer
Core java
Core java
Apache Cordova In Action
Apache Cordova In Action
Spring andspringboot training
Spring andspringboot training
Similaire à EJB Part-1
Distributed Programming using RMI
Distributed Programming using RMI
backdoor
Distributed Programming using RMI
Distributed Programming using RMI
backdoor
EJB.docx
EJB.docx
VeningstonK1
Session 1 Tp1
Session 1 Tp1
phanleson
Rmi
Rmi
leminhvuong
Rmi
Rmi
phanleson
Remote method invocatiom
Remote method invocatiom
sakthibalabalamuruga
Project report for final year project
Project report for final year project
suneel singh
Java performance tuning
Java performance tuning
Jerry Kurian
Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)
Sonali Parab
Travelling Light for the Long Haul - Ian Robinson
Travelling Light for the Long Haul - Ian Robinson
mfrancis
Travelling light for the long haul
Travelling light for the long haul
Ian Robinson
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggets
Virtual Nuggets
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
rani marri
JEE Course - EJB
JEE Course - EJB
odedns
Remote method invocation
Remote method invocation
Dew Shishir
Part 3 web development
Part 3 web development
techbed
Java interview questions for freshers
Java interview questions for freshers
SkillPracticalEdTech
J2ee
J2ee
Shaharyar khan
Remote Method Invocation
Remote Method Invocation
Sonali Parab
Similaire à EJB Part-1
(20)
Distributed Programming using RMI
Distributed Programming using RMI
Distributed Programming using RMI
Distributed Programming using RMI
EJB.docx
EJB.docx
Session 1 Tp1
Session 1 Tp1
Rmi
Rmi
Rmi
Rmi
Remote method invocatiom
Remote method invocatiom
Project report for final year project
Project report for final year project
Java performance tuning
Java performance tuning
Remote Method Invocation (Java RMI)
Remote Method Invocation (Java RMI)
Travelling Light for the Long Haul - Ian Robinson
Travelling Light for the Long Haul - Ian Robinson
Travelling light for the long haul
Travelling light for the long haul
Free EJB Tutorial | VirtualNuggets
Free EJB Tutorial | VirtualNuggets
ADVANCED JAVA MODULE I & II.ppt
ADVANCED JAVA MODULE I & II.ppt
JEE Course - EJB
JEE Course - EJB
Remote method invocation
Remote method invocation
Part 3 web development
Part 3 web development
Java interview questions for freshers
Java interview questions for freshers
J2ee
J2ee
Remote Method Invocation
Remote Method Invocation
Dernier
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Call Girls in Nagpur High Profile
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
RajkumarAkumalla
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls in Nagpur High Profile
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
simmis5
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
roncy bisnoi
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
ranjana rawat
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur High Profile
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
M Maged Hegazy, LLM, MBA, CCP, P3O
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
Tsuyoshi Horigome
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
ssuser5c9d4b1
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
SIVASHANKAR N
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
ranjana rawat
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Dr.Costas Sachpazis
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
Suhani Kapoor
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
upamatechverse
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
rakeshbaidya232001
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
ranjana rawat
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
Suhani Kapoor
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
Dernier
(20)
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
EJB Part-1
1.
Java Training Center (No
1 in Training & Placement) 1 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC RMI (Remote Method Invocation) 1. RMI is distributed technology, which is first attempt of SUN to provide a solution to distributed programming. RMI use socket. A socket is a transport mechanism. 2. No extra software is required for developing a distributed application using RMI other than JDK. RMI provides a way for a java program on one machine to communicate with object residing in different JVM. The important part of RMI architecture are the Stubclass object serialization and Skelton class. RMI uses a layered architecture where each of layers can be enhanced without affected the other layers. =:-Developing First RMI application-:= Server Side Steps:- 1. Define a Business Service Interface (B.S.I.). a. Your Business Service interface has to extends java.rmi.Remote interface. b. Each Method inside the Business interface has to throw java.rmi.RemoteException. 2. Provide the implementation class for Business Service Interface. a. Business Services implements class has to extends “UnicastRemoteObject” if not extend then implement class is responsible for correct implementation of hashCode(), equals(), toString(). b. B.S.I. class has to implement Business Interface. 3. Create the Business Service Implement Service Implementation class object. 4. Bind the B.S.I. class object inside RMI registry or JNDI registry.
2.
Java Training Center (No
1 in Training & Placement) 2 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC -: Steps in Eclipse :- 1. Create a java Project with the name RMIServer. 2. Create package com.jtcindia.rmi 3. Write the following three files in your package. a. AccountService.java (interface) b. AccountServiceImpl.java c. Server.java (for binding object) If you have more than one Business class for other purpose than that class object will create in server.java also. Client Side Steps :- 1. Locate and get the registry reference. 2. Look Up the registry and get the required remote interface stub. 3. Invoke any required business operation on remote Business stub. 1. Create a java Project called RMI. 2. Create a package java.jtcindia.rmi; 3. Write the following in the Package. a. Client.java b. AccountServices.java(copy from the server) Way to create jar file :- D:/test> Jar cvf jtc.jar com (Here AccountServices.class file change to jar file)
3.
Java Training Center (No
1 in Training & Placement) 3 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC File Required:- 1. Package com.jtcindia.rmi; Import java.rmi.Remote; Import java.rmi.RemoteException; Public interface AccountService extends Remote{ Public double getBal(int accno) throws RemoteException; } 2. AccountServiceImpl.java packagecom.jtcindia.rmi; importjava.rmi.*; importjava.rmi.server.UnicastRemoteObject; publicclassAccountServiceImplextendsUnicastRemoteObject implementsAccountService { publicAccountServiceImpl() throwsRemoteException { super(); } publicdouble getBal(int accno) throws RemoteException{ System.out.println("getBal() with accno : "+accno); return 9999.99; }} RemoteException :-This is declare as an interface because in this there are so many private data available. You have interact with their subclass method also to avoid data duplication
4.
Java Training Center (No
1 in Training & Placement) 4 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC 3. Server.java :- packagecom.jtcindia.rmi; importjava.rmi.registry.LocateRegistry; importjava.rmi.registry.Registry; public class Server { public static void main(String[] args) { try { Registry reg = LocateRegistry.createRegistry(6789); AccountServiceasi = new AccountServiceImpl(); reg.bind("ASI", asi); System.out.println("Server is Running"); } catch (Exception e) { e.printStackTrace(); } } } 4. Client.java :- packagecom.jtcindia.rmi; importjava.rmi.registry.LocateRegistry; importjava.rmi.registry.Registry; 1. Here we need to write a default constructor which throws RemoteException because in super class UnicastRemoteObject there is a default constructor without throws ServerException. 2. A remote object is one whose method can be invoke from another JVM.
5.
Java Training Center (No
1 in Training & Placement) 5 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC public class Client { public static void main(String[] args) { try { Registry reg = LocateRegistry.getRegistry("localhost", 6789); AccountService as = (AccountService) reg.lookup("ASI"); doublebal = as.getBal(1); System.out.println(bal); bal = as.getBal(2); System.out.println(bal); } catch (Exception e) { e.printStackTrace(); } } } Binding the instance of the remote object to the RMI registry.
6.
Java Training Center (No
1 in Training & Placement) 6 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC =: EJB2/EJB := For Developing any Enterprise Edition you need mainly three types of services. EJB is a remote, distributed multi-tier system. An EJB application server provide mainly services like transaction management, Security Management, Object Package which simplifies the programming effect. For any Enterprise Edition development you need these Low Level Services Commonly which you can get freely from EJB. High level Service is nothing but your application code business logic which will change from Enterprise edition to enterprise edition. IMP -: To run RMI application you need “JDK” where to run EJB application you need “application server”. Java Training Center (No 1 in Training & Placement) 6 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC =: EJB2/EJB := For Developing any Enterprise Edition you need mainly three types of services. EJB is a remote, distributed multi-tier system. An EJB application server provide mainly services like transaction management, Security Management, Object Package which simplifies the programming effect. For any Enterprise Edition development you need these Low Level Services Commonly which you can get freely from EJB. High level Service is nothing but your application code business logic which will change from Enterprise edition to enterprise edition. IMP -: To run RMI application you need “JDK” where to run EJB application you need “application server”. Java Training Center (No 1 in Training & Placement) 6 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC =: EJB2/EJB := For Developing any Enterprise Edition you need mainly three types of services. EJB is a remote, distributed multi-tier system. An EJB application server provide mainly services like transaction management, Security Management, Object Package which simplifies the programming effect. For any Enterprise Edition development you need these Low Level Services Commonly which you can get freely from EJB. High level Service is nothing but your application code business logic which will change from Enterprise edition to enterprise edition. IMP -: To run RMI application you need “JDK” where to run EJB application you need “application server”.
7.
Java Training Center (No
1 in Training & Placement) 7 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC Following are various Application servers available 1. JBOSS(“Red Hat” Linux) 2. Web Logic(“BEA”, Oracle Company) 3. Web sphere(IBM) Steps to develop and run EJB 2.0 application with JBOSS 4.0 Java Training Center (No 1 in Training & Placement) 7 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC Following are various Application servers available 1. JBOSS(“Red Hat” Linux) 2. Web Logic(“BEA”, Oracle Company) 3. Web sphere(IBM) Steps to develop and run EJB 2.0 application with JBOSS 4.0 Java Training Center (No 1 in Training & Placement) 7 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC Following are various Application servers available 1. JBOSS(“Red Hat” Linux) 2. Web Logic(“BEA”, Oracle Company) 3. Web sphere(IBM) Steps to develop and run EJB 2.0 application with JBOSS 4.0
8.
Java Training Center (No
1 in Training & Placement) 8 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC Steps to install JBOSS 4.0 :- 1. Click on installer called jems-installer-1.2.0 CRI.jar which is available in JBOSS-4.0. 2. Select English and OK. 3. Click on next. 4. Click on next. 5. Accept license agreement and next. 6. Provide the location of installation E:/Jboss 4.0.5 7. Click OK on popup. 8. Select the profile all and click on next. 9. Click on next. 10.Provide the server name jtcindia and next. 11. Configure the default and click next. 12. Click next. 13. Provide admin username and password only and click on next. 14. Click on next. 15. Click on done. After installing successfully you can see the directory :-
9.
Java Training Center (No
1 in Training & Placement) 9 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC -: Steps to integrate JBOSS 4.0 with MyEclipse :- 1. Click on window Preferences 2. My Eclipse workbench Servers JBOSS JBOSS 4.x Integrate means only enable the Plugin. In “Eclipse” you have to download all the plugin and then enable if. 3. Select Enable jBoss home directory: E:/jboss-4.0.5 Server name: jtcindia Optional program argu: Optional shutdown arg: -shutdown 4. Expend the JBOSS 4.x Java Training Center (No 1 in Training & Placement) 9 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC -: Steps to integrate JBOSS 4.0 with MyEclipse :- 1. Click on window Preferences 2. My Eclipse workbench Servers JBOSS JBOSS 4.x Integrate means only enable the Plugin. In “Eclipse” you have to download all the plugin and then enable if. 3. Select Enable jBoss home directory: E:/jboss-4.0.5 Server name: jtcindia Optional program argu: Optional shutdown arg: -shutdown 4. Expend the JBOSS 4.x Java Training Center (No 1 in Training & Placement) 9 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC -: Steps to integrate JBOSS 4.0 with MyEclipse :- 1. Click on window Preferences 2. My Eclipse workbench Servers JBOSS JBOSS 4.x Integrate means only enable the Plugin. In “Eclipse” you have to download all the plugin and then enable if. 3. Select Enable jBoss home directory: E:/jboss-4.0.5 Server name: jtcindia Optional program argu: Optional shutdown arg: -shutdown 4. Expend the JBOSS 4.x
10.
Java Training Center (No
1 in Training & Placement) 10 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC JDK Launch Paths and select the JDK option. And do the following to add the JDK. a. Click on add button. b. Click on Apply. 5. Select the “Launch” under JBOSS 4.x… Run mode and click Apply. 6. Click on OK of Preference window. a. By default Port no: 8080 because it take default of tomcat which is running on 8080. b. Change that Port no:- if get any error like JVM_8080 i.e. lifecycleException. -: Stating JBOSS :- Change the Port number: 5555. Start the JBOSS from myEclipse. Open the browser and type http://localhost:5555/imx-console/ Enter username & password on popup window. -: Creating EJB Project in myEclipse :- 1. File new “EJB Project” Project name: - E2Hello4JB and select J2EE1.4-EJB2.1 and finish. 2. You can see the following directory structure.
11.
Java Training Center (No
1 in Training & Placement) 11 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC New otherXMLXML(Basic Tem)ejb-jar.xmlnextcreate xml file from DTD select category. To deployselect the Project name and gotodeploy(8th ) Icon. Select Project E2Hello4JB add to your application server jBoss. -//sun microsystem, Inc.//DTD Enterprise JavaBeans 3.0 --: Create client Project for EJB :- 1. Create a “Java Project” E2client4JB. Java Training Center (No 1 in Training & Placement) 11 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC New otherXMLXML(Basic Tem)ejb-jar.xmlnextcreate xml file from DTD select category. To deployselect the Project name and gotodeploy(8th ) Icon. Select Project E2Hello4JB add to your application server jBoss. -//sun microsystem, Inc.//DTD Enterprise JavaBeans 3.0 --: Create client Project for EJB :- 1. Create a “Java Project” E2client4JB. Java Training Center (No 1 in Training & Placement) 11 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC New otherXMLXML(Basic Tem)ejb-jar.xmlnextcreate xml file from DTD select category. To deployselect the Project name and gotodeploy(8th ) Icon. Select Project E2Hello4JB add to your application server jBoss. -//sun microsystem, Inc.//DTD Enterprise JavaBeans 3.0 --: Create client Project for EJB :- 1. Create a “Java Project” E2client4JB.
12.
Java Training Center (No
1 in Training & Placement) 12 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC Example:- File required:- 1. HelloRemote.java 2. HelloBean.java 3. HelloHome.java 4. Ejb-jar.xml 5. Jboss.xml 6. HelloClient.java Java Training Center (No 1 in Training & Placement) 12 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC Example:- File required:- 1. HelloRemote.java 2. HelloBean.java 3. HelloHome.java 4. Ejb-jar.xml 5. Jboss.xml 6. HelloClient.java Java Training Center (No 1 in Training & Placement) 12 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC Example:- File required:- 1. HelloRemote.java 2. HelloBean.java 3. HelloHome.java 4. Ejb-jar.xml 5. Jboss.xml 6. HelloClient.java
13.
Java Training Center (No
1 in Training & Placement) 13 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC 1. HelloHome.java package com.jtcindia.ejb2; importjava.rmi.*; importjavax.ejb.*; publicinterfaceHelloHomeextendsEJBHome{ publicHelloRemote create() throws createException, RemoteException; } 2. HelloRemote.java package com.jtcindia.ejb2; importjava.rmi.*; importjavax.ejb.EJBObject; publicinterfaceHelloRemoteextendsEJBObject{ public String getMessage(String name) throwsRemoteException; } 3. HelloBean.java package com.jtcindia.ejb2; importjavax.ejb.*; publicclassHelloBeanextendsSessionBean{ SessionContentsc=null; Public void setSessionContent(SessionContentsc){ System.out.println("setSesssionContent"); this.sc=sc;
14.
Java Training Center (No
1 in Training & Placement) 14 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC } Public void ejbActivate(){ System.out.println("ejbActivate"); } publicvoidejbPassivate(){ System.out.println("ejbPassivate()"); } publicvoidejbRemove(){ System.out.println("ejbReamove"); } publicvoidejbCreate(){ System.out.println("ejbCreate()"); } publicStringgetMessage(String name){ String msg="Hi"+name+"welcome to JTC EJB with JBOSS"; System.out.println(msg); returnmsg; } } 4. HelloClient.java package com.jtcindia.ejb2; importjava.util.*; importjavax.naming.*; public classHelloClient { publicstaticvoid main(String[] args) { try{ Properties p=newProperties();
15.
Java Training Center (No
1 in Training & Placement) 15 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC p.put("java.naming.factory.initial","org.jnp.interf aces.NamingContentFactory"); p.put("java.naming.provider.url","localhost:1099"); p.put("java.naming.factory.url.package","org.jboss. naming"); Contentctx=newInitialContext(p); Object o=ctx.lookup("JTCHelloHomeJNDI"); HelloHomehh=(HelloHome)o; HelloRemotehr=hh.create(); String msg=hr.getMessage("Som"); System.out.println(msg); msg=hr.getMessage("Som"); System.out.println(msg); }catch(Exception e){ e.printStackTrace(); } } } 5. ejb-jar.xml <?xmlversion="1.0"encoding="UTF-8"?> <!DOCTYPEejb-jarPUBLIC"-//Sun MicroSystem,INC.//DTD Enterprise JavaBean 2.0//EN","http://Java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <enterprise-beans> <session> <ejb-name>HelloEJB</ejb-name> <home>com.jtcindia.ejb2.HelloHome</home> <remote>com.jtcindia.ejb2.HelloRemote</remote>
16.
Java Training Center (No
1 in Training & Placement) 16 RMI Part 1 Author: SomPrakashRai www.jtcindia.org Copyright©JTC <ejb-class>com.jtcindia.ejb2.HelloBean</ejb-class> <session-type>Stateless</session-type> <trasaction-type>Container</trasaction-type> </session> </enterprise-beans> </ejb-jar> 6. jboss.xml <jboss> <enterprise-beans> <session> <ejb-name>HelloEJB</ejb-name> <jndi-name>JTCHelloHomeJNDI</jndi-name> </session> </enterprise-beans> </jboss>