Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

in linea

Domestico Codici sorgente E-Libri Trasferimenti dal sistema centrale verso i satelliti Metterseli in contatto con Circa noi

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
AJAX Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PHP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
.NET (dotnet)
Microsoft.Net
XML Web Services
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills


EJB Example

Previous Next





La struttura dell'indice

Generare la seguente struttura dell'indice sotto un certo indice logico del genitore, quale il _example di c:\ejb. Questa struttura dell'indice è per gli scopi di sviluppo soltanto; le lime di schieramento saranno chiuse con chiusura a lampo in una lima del vaso in un momento e saranno assegnate ai jboss.

src/
|__client/
| |___com/
| |___examples/
| |___client java files
|__server/
| |__com/
| |___examples/
| |___server (bean) java files
|__shared
| |__com/
| |___examples/
| |___remote and home java files
|
assemble/
|___client and server jars
|
target/
|___client/
| |___com/
| | |___examples/
| | |___client, remote and home java classes
| |___jndi.properties
|___server/
|__com/
| |___examples/
| |___server (bean), remote and home java classes
|___META-INF/
|___ejb-jar.xml
 





Il codice categoria del fagiolo

generare il codice categoria del fagiolo come src \ assistente \ COM \ esempi \ HelloBean.java. Questo codice categoria è un fagiolo apolide di sessione e contiene la nostra logica di affari. In questo caso stampa eccitare e sempre utile “ciao! Mondo„.


package com.examples;

import javax.ejb.*;

public class HelloBean implements SessionBean
{
public void ejbCreate() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbRemove() {}
public void setSessionContext(SessionContext sc){}

public String sayHello ()
{
System.out.println ("Someone called sayHello()");
return “Hello! World”;
}
}
 





L'interfaccia a distanza

Generare l'interfaccia a distanza come src \ si ripartita \ COM \ esempi \ Hello.java. Ciò è l'interfaccia che i clienti a distanza comunicano con invece di comunicazione direttamente con codice categoria del fagiolo, HelloBean. Notare che il relativo soltanto metodo è sayHello (), che è il metodo di affari in HelloBean.


package com.examples;

import javax.ejb.*;
import java.rmi.*;

public interface Hello extends EJBObject
{
public String sayHello() throws RemoteException;
}
 




L'interfaccia domestica

Generare l'interfaccia domestica come src \ si ripartita \ COM \ esempi \ HelloHome.java. Questa interfaccia sarà usata per generare un caso ciao dell'interfaccia quando desideriamo eseguire la logica di affari di sayHello ().


package com.examples;

import javax.ejb.*;
import java.rmi.*;

public interface Hello extends EJBObject
{
public String sayHello() throws RemoteException;
}
 




Il cliente

generare il cliente come src \ cliente \ COM \ esempi \ HelloClient.java. Ciò è il cliente “a distanza„ che userà il nostro fagiolo di sessione. In primo luogo, usa il InitialContext per ottenere una maniglia a HelloHome. Allora usa l'interfaccia di HelloHome per generare ciao. ciao è un'interfaccia a distanza che rappresenta il nostro codice categoria del fagiolo. Dopo che ciao sia usato eseguire la logica di affari (sayHello), il fagiolo è liberato via il metodo di rimozione.


package com.examples;

import javax.ejb.*;
import java.rmi.*;
import javax.rmi.*;
import javax.naming.*;

public class HelloClient
{
public static void main (String[] args) throws Exception
{
Context c = new InitialContext();
Object o = c.lookup ("Hello");

HelloHome home =
(HelloHome)PortableRemoteObject.narrow (o,HelloHome.class);
Hello hello = home.create();
System.out.println (hello.sayHello());
hello.remove();
}
}
 




ejb-jar.xml

Generare la lima di ejb-jar.xml in obiettivo \ assistente \ META-INF. Questo descrittore di schieramento contiene le informazioni di che il contenitore dei jboss EJB ha bisogno per schierare e fare funzionare il nostro EJB.


<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>com.examples.HelloHome</home>
<remote>com.examples.Hello</remote>
<ejb-class>com.examples.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
 




jndi.properties

Generare la lima di jndi.properties nell'obiettivo \ cliente. Questa lima definisce le proprietà che sono richieste per usare JNDI per trovare EJBs sulla rete.


java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099




Previous Next

Keywords: EJB Example,jboss ejb example,ejb client example,jboss example,ejb sample,j2ee example,xdoclet example,weblogic example,cmp example,jboss examples,ejb sample code,ejb examples,jboss sample,j2ee sample,sample j2ee application,j2ee examples,web services example,ejb jar xml example,ejb web services,sample weblogic xml,sample ejb jar xml


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
AJAX Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PHP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
XML Web Services Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz

Privacy Policy
Copyright © 2003-2008 Vyom Technosoft Pvt. Ltd., All Rights Reserved.