Re: Visualize EJB in JSF / J2EE

You usually access the database and retrieve data in the data-tier. Map the results to -for examle- List<DTO> where each DTO represents one row of the database table and pass it to the backing beans in the business-tier. Let them pass it -unchanged or wrapped in a DataModel- to a h:dataTable in a JSF page in the web-tier.

Does this mean, that I have to write database specifiy code? What if I want to be database vendor independant? Cant I access a database not the same way as I access database tables with my entity classes?

Similar Messages

  • EJB migration using j2ee migration plugin ??

    Hi,
    I have a bean which need to be migrated to WAS from weblogic.
    I have kept the bean,home, and remote source in a directory com.test. My deployement descriptors are in Meta-inf directory. i imported the ejb module import-->j2ee migration using migration pluggin.My bean gets compiled. But option "Build EJB Archive" in the context menu is disabled.Any help??
    regards,
    Sujesh

    Hi,
    This might be because in one of the java files, certain methods which is to be implemented because of the interface it extends are not implemented or overridden.
    Try to override/implement the methods as follows:
    right click on the java file->source->Overide/Implement methods and then choose the relevant methods.
    Regards,
    Prasita

  • Calling EJB from other EJB on other J2EE Server

    Can I call EJB from other EJB on other J2EE Server
    Servers - Websphere 5.0
    Do i require home & remote interface of that ejb on client side also
    Help me, please

    the problem is actually i require that is specific to websphere
    for example i want to call a method ion that ejb
    say my ejb name is myejb
    so the normal way i should call is
    InitialContext initialContext = new InitialContext();     
    Object homeObject = initialContext.lookup("ejb/MyEjbHome");
    MyEJBHome myEJBHome =(MYEjbHome )javax.rmi.PortableRemoteObject.narrow(homeObjectMYEjbHome.class);
              myEJB = lSHome.create();
    myEJB.someMethod();
    but here i am having class for home and remote available
    now if other app server i am not having this classes then what to do

  • Calling EJBs from other EJBs in other J2EE Server?

    How can I call one EJB on one J2EE Server from other
    EJB on other J2EE Server?
    Help me, please.
    Dmitry Tumanov

    Basically call the beans as if you were calling them in the same server through their remote interfaces. Get a InitialContext into the other appserver and then get the home object, narrow it and create a remote reference. You can follow the standard implementation just make sure that the InitialContext you create has the right properties, ie. context factory, urls, etc to the OTHER appserver.

  • EJB Deployment in J2EE Apps Server

    Hi,
    Can any one please help me in deploying EJB in J2EE Apps server?I have installed J2EE Apps Server 9 in my machine.Can any one please suggest me a document regarding EJB deployment in J2EE apps server or help me regarding this?
    Thanks in advance,
    Aravindhan.C

    Go to https://j2ee-sdk.dev.java.net/ and checkout "Methods of deploying applications" under the recent articles section; The tutorial link present in this page (under the references section) will also be useful. The samples bundle has reference samples which will also be useful

  • How to access an EJB in another J2ee server?

    Dear experts:
    I have a jsp file that is a client of a J2ee server A, and I am going to access an EJB that is situated in J2ee server B from this jsp file.
    It will be very appreciate if you can tell me how to do that. My current program is:
    try
    Properties props = new Properties();
    props.setProperty(Context.PROVIDER_URL, "rmi://ip:port");
    Context initial = new InitialContext(props);
    Object objref = initial.lookup("MyUserEJB");
    UserHome home = (UserHome) PortableRemoteObject.narrow(objref, UserHome.class);
    Collection users = home.findByName("alin");               
    for(Iterator i=users.iterator(); i.hasNext();)
    User user = (User)i.next();
    System.out.println("User " + user.getFirstName() + " details:\n");
    System.out.println("     email     : " + user.getEmail() + "\n");
    catch (Exception e)
    System.err.println("Caught an exception.");
    e.printStackTrace();
    In which, the MyUserEJB is an EJB in ip:port J2ee server (server B). The server A is localhost:1050. This program does not work.
    Best regards,
    Alan

    Hi,
    Have a look at
    http://forum.java.sun.com/thread.jsp?thread=365927&forum=136&message=1543094

  • How to run ejb application OC4J J2EE Container

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

    Hi all,
    I unable run ejb applications in OC4J J2EE Container.
    I have configure following files.
    in config directory
    Server.xml
    I have .ear file if configured in server.xml. this .ear copied into home/application directory
    I have create following deployment discriptor file.
    in META-INF for ejb.
    ejb-jar.xml
    application.xml
    I have specify all ejb classes details in ejb-jar.xml
    Please help me .How to run ejbs with jsp and application client.Which files shall i configure.
    Thnaks,

  • Error when executing EJB example in J2EE Tutorial

    Hi,
    I am trying Converter example in J2EE tutorial.
    I have created ConverterJAR and ConverterWAR
    ConverterJAR is verified sucessfully when using verifier option
    When verifying ConverterWAR i am getting the following error
    Error: Class [ converter.ConverterHome ] not found in WEB-INF/classes or WEB-INF/lib.
    For [ /ConverterWAR ]
    Error: class [ converter.ConverterHome ] cannot be found within this jar [ war-ic.war ].
    Error: Class [ converter.Converter ] not found in WEB-INF/classes or WEB-INF/lib.
    For [ /ConverterWAR ]
    Error: class [ converter.Converter ] cannot be found within this jar [ war-ic.war ].
    Please let me know if anybody aware of this problem

    I have created ConverterJAR and ConverterWAR
    ConverterJAR is verified sucessfully when using
    verifier option
    When verifying ConverterWAR i am getting the
    following errorCreate an EJB-client JAR which will contain only the home and remote interfaces. Place it in WEB-INF/lib of your webapp and recreate your WAR. This should solve the problem. :)
    $

  • OC4J spitting out ejb's in j2ee/home

    Hi all,
    we recently noticed that during deployment of our application (ear file) when oc4j wants to compile the ejb's he spits them out in j2ee/home and compiles them there, then deletes the files.
    We probably wouldn't notice, but a couple of colleagues' deployment got stuck. The files are not deleted and oc4j's java proccess won't close, they have to restart the machine.
    Any idea what could be wrong? Maybe a misconfigured ejb-jar.xml or something?

    If your used the older deploytool then use the bottom two 'remote' boxes and leave the top two 'local' boxes empty.
    Basically Local means within the container
    and
    remote means outside the container.
    If you want to change yours to be local I think you need to subclass differently. I have not done it yet!
    EricLemle

  • Problems with ADF when running sample EJB, JPA, JSF Tutorial

    Hi,
    I'm new to jDeveloper.
    I've downloaded the version 11.1.1.2.0 and tried to do my first tutorials with the product.
    I started with the sample 'Build Applications with EJB, JPA and JSF' and run to following problems:
    - Part1: Step 10 expose the EJb as a Data Control
    Here right-click FODFacadeBean.java and choose Create Data Control.
    this option 'Create Data Control' does not come up at all. There is not such option
    - Part 2: Step 1 Add Tag Libraries to a project
    The option to select ' ADF Faces Components 11 '
    does not come up either. I can not see any ADF related options...
    Is there something missing from my installation, as I can not access these ADF components ?
    Should I include the ADF components at some stage during the installation to be able to access these
    or is this some licencing option ?
    I downloaded the product yesterday from the public download site, filename jdevstudio11112install.exe
    Jan-Erik

    Hi,
    I'm new to jDeveloper.Welcome to OTN :)
    I've downloaded the version 11.1.1.2.0 and tried to do my first tutorials with the product.
    I started with the sample 'Build Applications with EJB, JPA and JSF' and run to following problems:
    - Part1: Step 10 expose the EJb as a Data Control
    Here right-click FODFacadeBean.java and choose Create Data Control.
    this option 'Create Data Control' does not come up at all. There is not such optionI just tried and able to see the option (and able to generate the DC from the facade as well). Could you please share the tutorial link to see if you are missing something?
    >
    - Part 2: Step 1 Add Tag Libraries to a project
    The option to select ' ADF Faces Components 11 '
    does not come up either. I can not see any ADF related options...Did you select Fusion Web Application (ADF) Template for creating your application? If yes, the ADF Faces Components 11 tag library would've been added by default (Check out in the list of tag libraries that are already added - before clicking on the Add button).
    -Arun

  • Unable to deploy simple EJB example with J2EE Ref. Impl.

    Hi there,
    I'm new to EJB development so please bare with me. I've written a simple EJB, taken from Enterprise JavaBeans by Richard Monson-Haefel (O'Reilly). I can compile the code without problems, load it into the J2EE deployment tool (I'm using version 1.3.1 of the J2EE Reference Implementation), and have succesfully set up the data source and SQL commands for each persistent field.
    When it comes to deployment, I'm stumped with the following error:
    java.rmi.RemoteException: Error processing ejb jar: Compilation failed.
    Here's the stacktrace in the error logs:
    Compilation failed.
         at com.sun.ejb.codegen.GeneratorDriver.compileClasses(GeneratorDriver.java:232)
         at com.sun.ejb.codegen.GeneratorDriver.preDeploy(GeneratorDriver.java:610)
         at com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployEjbs(JarInstallerImpl.java:707)
         at com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployApplication(JarInstallerImpl.java:221)
         at org.omg.stub.com.sun.enterprise.tools.deployment.backend._JarInstallerImpl_Tie._invoke(Unknown Source)
         at com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:350)
         at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:250)
         at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:79)
         at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:104)Here's the source:
    ==============================CabinHome.java=========================
    package com.titan.cabin;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    public interface CabinHome extends javax.ejb.EJBHome {
      public Cabin create (int d) throws CreateException, RemoteException;
      public Cabin findByPrimaryKey (CabinPK pk) throws FinderException;
    }================================CabinBean.java========================
    package com.titan.cabin;
    import javax.ejb.EntityContext;
    public class CabinBean implements javax.ejb.EntityBean {
      public int id;
      public String name;
      public int deckLevel;
      public int ship;
      public int bedCount;
      public CabinPK ejbCreate (int id) {
        this.id = id;
        return null;
      public void ejbPostCreate (int id) {
      public String getName () {
        return name;
      public int getShip () {
        return ship;
      public int getDeckLevel () {
        return deckLevel;
      public int getBedCount () {
        return bedCount;
      public void setName (String str) {
        this.name = str;
      public void setShip (int s) {
        this.ship = s; 
      public void setDeckLevel (int d) {
        this.deckLevel = d;
      public void setBedCount (int c) {
        this.bedCount = c;
      public void setEntityContext (EntityContext ctx) {}
      public void unsetEntityContext () {}
      public void ejbActivate() {}
      public void ejbPassivate () {}
      public void ejbLoad () {}
      public void ejbStore () {}
      public void ejbRemove () {}
    }===============================Cabin.java============================
    package com.titan.cabin;
    import java.rmi.RemoteException;
    public interface Cabin extends javax.ejb.EJBObject {
      public String getName() throws RemoteException;
      public void setName(String str) throws RemoteException;
      public int getDeckLevel() throws RemoteException;
      public void setDeckLevel (int level) throws RemoteException;
      public int getShip() throws RemoteException;
      public void setShip (int sp) throws RemoteException;
      public int getBedCount() throws RemoteException;
      public void setBedCount() throws RemoteException;
    }============================CabinPK.java=============================
    package com.titan.cabin;
    public class CabinPK implements java.io.Serializable {
      public int id;
      public int hashCode() {
        return id;
      public boolean equals (Object obj) {
        if (obj instanceof CabinPK) {
          return (id == ((CabinPK) obj).id);
        return false;
    }Has anyone else experienced anything similar, or is there something I'm obviously doing wrong?
    Thanks for your help.
    Matt

    Here's the ejb-jar.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- Created by matt on 10 September 2002, 14:32 -->
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
        "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
    <ejb-jar>
        <enterprise-beans>
            <entity>
                <description>
                    This Cabin enterprise bean entity represents a cabin on a cruise ship.
                </description>
                <ejb-name>CabinBean</ejb-name>
                <home>com.titan.cabin.CabinHome</home>
                <remote>com.titan.cabin.Cabin</remote>
                <ejb-class>com.titan.cabin.CabinBean</ejb-class>
                <persistence-type>Container</persistence-type>
                <prim-key-class>com.titan.cabin.CabinPK</prim-key-class>
                <reentrant>False</reentrant>
                <cmp-field><field-name>id</field-name></cmp-field>
                <cmp-field><field-name>name</field-name></cmp-field>
                <cmp-field><field-name>deckLevel</field-name></cmp-field>
                <cmp-field><field-name>ship</field-name></cmp-field>
                <cmp-field><field-name>bedCount</field-name></cmp-field>
            </entity>
        </enterprise-beans>
        <assembly-descriptor>
            <security-role>
                <description>
                    This role represents everyone who is allowed
                    full access to the cabin bean.
                </description>
                <role-name>everyone</role-name>
            </security-role>
            <method-permission>
                <role-name>everyone</role-name>
                <method>
                    <ejb-name>CabinBean</ejb-name>
                    <method-name>*</method-name>
                </method>
            </method-permission>
            <container-transaction>
                <method>
                    <ejb-name>CabinBean</ejb-name>
                    <method-name>*</method-name>
                </method>
                <trans-attribute>Required</trans-attribute>
            </container-transaction>
        </assembly-descriptor>
    </ejb-jar>Thanks...

  • Packaging EJB's in J2EE Tutorial...

    There is a discrepancy between the docs in the J2EE tutorial and the DeployTool interface that is making it hard for me to figure out how to get the sample converter EJB successfully deployed.
    The docs in the new SDK v. 1.3.2 references single Home and Remote Interface combo boxes that need to populated for the bean but the dialogue box in the tool has two combo boxes for each interface, namely a "Local Interface" and a "Local Home Interface" and a "Remote Interface" and "Remote Home Interface".
    I have had trouble translating the instructions to figure out which of these boxes I need to populate to make this work. One combination resulted in a deploytime error on the bean and another gave me a runtime error on the servlet.
    Has anybody else run into this and if so, how did you get past it?
    Thanks
    John

    If your used the older deploytool then use the bottom two 'remote' boxes and leave the top two 'local' boxes empty.
    Basically Local means within the container
    and
    remote means outside the container.
    If you want to change yours to be local I think you need to subclass differently. I have not done it yet!
    EricLemle

  • Full EJBs status in J2EE server

    Is it possible to get all EJB(s) status in J2EE server.
    If could, what command or method can help me.
    TIA

    You havent really explained what you want. I believe
    what are expecting is a status of all beans in the
    container. The status means whether the bean has been
    activated or passivated, etc.
    Kindly explain and I may be able to help you out.
    Regards
    Rohit Parik
    [email protected]
    I am sorry that I didn't explain my question clearly.
    Suppose I write an EJB to do some Database query function, and my problem is
    1. EJB container can give me what information?
    2. May I get how many transactions have been process by EJB.
    Sorry for my poor English.
    BTW, thanks your reply.

  • Injecting EJB to JSF Converter

    Is it possible to inject EJB (or at least EntityManager) to JSF Converter or Validator?
    I don't know if i'm missing something or is it just impossible - it works when injecting EJB into Managed Bean.
    Thanks.
    S&#322;awek S.

    Slawek_Sobotka wrote:
    Thanks.
    So I'll redefine my question to be problem oriented:
    I have SelectItem that contains Address object.
    I have implemented AddressConverter so that it converts Adress to String simply by using it's id.
    How to convert back: from string (address's id) do Address object?Map it. Two general ways are mentioned here: [http://balusc.blogspot.com/2007/09/objects-in-hselectonemenu.html].
    I would like to load it form DB...That's a bit too expensive for less or more static data.
    Another solutions are:
    - SelectItem should contain address.id instead of address. Than no converter is need. My ManagedBean is reposnsible for translating ids do entities. Works but primitive.JSF can't help that HTTP/HTML only understands Strings (by the way, primitives are also already implicitly converted by EL, you only don't know that).
    - Converter is created by factory method of Managed Bean. MB sets address list to the converter while creating it. List shouldn't be huge if it is used in GUI.
    drawback: loading list in BB twice because converter is used while rendering and while decoding.
    - In converter try to possess MB that has EJB and call method that reutrns entities, sth like this: facesContext.getApplication().getELResolver()...Reloading static data on every request makes als no sense.
    Retoric question: what for are useful JSF Converters?To convert between Object and String, so that it can be passed through HTTP request/response and displayed/taken in HTML.

  • How to run the ejb project in j2ee server

    How to run the EJB project.
    I give like
    java conveterClient converterClient.jar
    here conveterClient is class file name and converterClient.jar is deployed file
    like wise i give some exception is come
    give some help pls friends

    Navigate to the "DBOrders" module in the catalog, right click on the "ORDERS" database below and click "Export Schema Stucture". That will produce a file containing the DML needed to create the database

Maybe you are looking for