EJB 3.0-lookup in Weblogic 10.3.0

1: Unsere Anwendung läuft auf Weblogic Application Server,version 10.3.0

2: In unserem system,wir müssen zum bereitstellen eines EJB-konforme EJB-3.0-Spezifikation.

Finden Sie die Beispiel-code für unsere UAT-Umgebung wie folgt :

/*The remote interface*/

package com.serverside.ejb.session;
import javax.ejb.Remote;

@Remote
public interface ASimpleSessionBeanRemote { 

 public void printThis(String print);

}


/*The bean class*/

package com.serverside.ejb.session;

import javax.ejb.Remote;
import javax.ejb.Stateless;

/**
 * Session Bean implementation class ASimpleSessionBean
 */
@Stateless(name="ASimpleSessionBean", **mappedName = "ASimpleSessionEJB"**)
@Remote(ASimpleSessionBeanRemote.class)
public class ASimpleSessionBean implements ASimpleSessionBeanRemote {

    /**
     * Default constructor. 
     */
    public ASimpleSessionBean() {
        //TODO Auto-generated constructor stub
    }

 @Override
 public void printThis(String print) {
  //TODO Auto-generated method stub
  System.out.println("ASimpleSessionBean : "+print); 
 }

}

3: Die oben genannten Dateien beim Verpacken in Glas kommt auf dem server bereitgestellt erfolgreich.

4: Wie pro EJB 3.0-Spezifikation,der Einsatz Deskriptoren sind nicht zwingend erforderlich.Damit das Glas nicht enthalten ejb-jar.xml und weblogic-ejb-jar.xml

5: Bitte finden Sie unten die EJB3.0 Anmerkungen Verweis als gemäß der Weblogic Application Server-Dokumentation :

Annotation : @Stateless

Package: javax.ejb.Stateless

Attribute : mappedName

Description : 

Specifies the product-specific name to which the stateless session bean should be mapped.
You can also use this attribute to specify the JNDI name of this stateless session bean. WebLogic Server uses the value of the mappedName attribute when creating the beans global JNDI name. In particular, the JNDI name will be:
mappedName#name_of_businessInterface
where name_of_businessInterface is the fully qualified name of the business interface of this session bean.
For example, if you specify mappedName="bank" and the fully qualified name of the business interface is com.CheckingAccount, then the JNDI of the business interface is bank#com.CheckingAccount.

6: übereinstimmung mit den oben genannten Spezifikation, die Probe EJB bereitgestellt auf unserer Anwendungs-server hat die binding-name(wie Sie sich in der jndi-Struktur) wie folgt :

ASimpleSessionEJB#com.serverside.ejb.Sitzung.ASimpleSessionBeanRemote

Einen jndi-lookup-mit diesem Namen ist erfolgreich :

InitialContext.doLookup("ASimpleSessionEJB#com.serverside.ejb.session.ASimpleSesionBeanRemote");

7: Jetzt wollen wir die verbindliche Namen, um eine einfache Zeichenfolge ich.e die Suche muss etwas sein wie :

InitialContext.doLookup("ASimpleSessionEJB");

8: Implementierung von point-7,haben wir versucht, mit der ejb-jar.xml und weblogic-ejb-jar.xml wie folgt(Sorry,konnte nicht herausfinden, wie zu befestigen/Rendern von xml-Dateien):

9: Trotz der Punkt-8 wird der binding name bleibt wie folgt :

ASimpleSessionEJB#com.serverside.ejb.session.ASimpleSessionBeanRemote

10: Bitte leiten Sie uns über die Lösung und Umsetzung zu besuchen, point-7.

Dank !

Bitte siehe meine Antwort im folgenden thread: stackoverflow.com/questions/8909573/...

InformationsquelleAutor Procrastinator | 2011-01-17

Schreibe einen Kommentar