Learning EJB

Hi, All
I want to learn EJB, but got a question.
Should I learn EJB first and then JSP or get JSP under the belt first ????
Thx for help.

It probably doesn't matter and depends upon what you want to do. JSP will be easier to learn, EJB is pretty complicated. JSP is more involved with the web user interface while EJB is more on the "back end" directly interfacing with the database.

Similar Messages

  • I want to learn EJB

    I know how to use servlets and jsp as well as java beans... I want to now learn EJB ... I tried reading the sun tutorial .. it seems long and difficult.... I also have the book which I will take days to read... Is there a short easy tutorial anywhere on the web where I can learn EJB in a 4-5 days ? I was just about to get a job but they didnt consider me because I didnt know EJB.. I really need to quick way to learn it.. Does anyone know any websites or anything ?

    Like the others have said, learning EJBs is difficult. After going through numerous sources, I think the best free online source is the book at http://www.theserverside.com/books/masteringEJB/index.jsp. Its not short or easy, but I think it reads easier than many of other EJB tutorials. You don't have to read all of it to get a basic understanding of EJBs but you will still have to read alot.

  • Just learning EJB - having problems compiling

    I'm trying to learn EJB by going through the Sun J2EE tutorial. When trying to compile the converter example I get the following error messages:
    E:\MostlyJava\j2eetutorial\examples>ant converter
    Buildfile: build.xml
    init:
    converter:
    [javac] Compiling 4 source files to E:\MostlyJava\j2eetutorial\examples\buil
    d\ejb\converter
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\Converter.java
    :10: cannot resolve symbol
    [javac] symbol : class EJBObject
    [javac] location: package ejb
    [javac] import javax.ejb.EJBObject;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\Converter.java
    :14: cannot resolve symbol
    [javac] symbol : class EJBObject
    [javac] location: interface Converter
    [javac] public interface Converter extends EJBObject {
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:11: cannot resolve symbol
    [javac] symbol : class SessionBean
    [javac] location: package ejb
    [javac] import javax.ejb.SessionBean;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:12: cannot resolve symbol
    [javac] symbol : class SessionContext
    [javac] location: package ejb
    [javac] import javax.ejb.SessionContext;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:15: cannot resolve symbol
    [javac] symbol : class SessionBean
    [javac] location: class ConverterBean
    [javac] public class ConverterBean implements SessionBean {
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterBean.
    java:37: cannot resolve symbol
    [javac] symbol : class SessionContext
    [javac] location: class ConverterBean
    [javac] public void setSessionContext(SessionContext sc) {}
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:12: cannot resolve symbol
    [javac] symbol : class CreateException
    [javac] location: package ejb
    [javac] import javax.ejb.CreateException;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:13: cannot resolve symbol
    [javac] symbol : class EJBHome
    [javac] location: package ejb
    [javac] import javax.ejb.EJBHome;
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:15: cannot resolve symbol
    [javac] symbol : class EJBHome
    [javac] location: interface ConverterHome
    [javac] public interface ConverterHome extends EJBHome {
    [javac] ^
    [javac] E:\MostlyJava\j2eetutorial\examples\src\ejb\converter\ConverterHome.
    java:17: cannot resolve symbol
    [javac] symbol : class CreateException
    [javac] location: interface ConverterHome
    [javac] Converter create() throws RemoteException, CreateException;
    [javac] ^
    [javac] 10 errors
    BUILD FAILED
    E:\MostlyJava\j2eetutorial\examples\build.xml:89: Compile failed, messages shoul
    d have been provided.
    Total time: 2 seconds

    Thanks, for your reply the problem was with the classpath, even though it appears that the ant script points to it I had to set it in the environment.

  • Website for learning EJB

    Hi all
    I want to learn EJB from the beginnging. Suggest me the best site
    thank you

    The Java EE 5 tutorial is a good place to start. Start with Chapter 20 :
    http://java.sun.com/javaee/5/docs/tutorial/doc/
    --ken                                                                                                                                                                                                                                                                       

  • To Learn EJB

    Hi All,
    Quickly I want learn EJB.
    Can anybody suggest me some methods/ways to learn EJB ?
    Can i get some reference sites also ?

    Go through the EJB chapters in the Sun J2EE tutorial .

  • How to learn EJB?

    Hello,
    I am in a very strange position.
    We had given training on EJB for 3 days. It was 2 months back. I have never gone thru EJB than after as had to achieve deadline of the current project which developed using JSP.
    Now I want to learn EJB, and I have gone thru couple of books, but all are more theoretical.
    Is there any book or online tutorial which has maximum example of EJB?
    Which is the best way to learn EJB?
    I have to learn EJB in 2 weeks as new project will be in EJB. I can spend daily 2 hours behind EJB.
    Reg,
    Chetan

    learning ejb is toooo easy....
    first go to j2ee tutorial of sun.
    then try j2ee complete reference
    and then also if u dont understand then heres the link :)
    http://theserverside.com/cartoons/TalesFromTheServerSide.tss

  • Help me out in learning EJB

    hai ..
    i'm new to this forum.
    i started learning EJB. please help me out

    Get the book by Ed Roman named Mastering EJB.
    It is available as a free download on www.theserverside.com

  • How to learn EJBs?

    Hi, I am a new user of EJBs. I have used JSPs, and Servlets on Tomcat. I want to learn EJBs, how should I begin? What will be the best book for me on EJB Tech? And to excite my curiosity please give a small EJB program and how should I compile, deply and run it.
    Thanks alot in advance.
    Badar

    Please visit
    http://java.sun.com/docs/books/tutorial/javabeans/
    or
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/Session.html
    or
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/J2eeTutorialTOC.html

  • Relationship field in EJB 2.0

    Going thru few books on EJB 2.0, I couldn't get a clear understanding on how the container identifies the fields which are involved in relationship between two entities (in CMP).
    Say for example :
    STUDENT Table (Entity) contains the following fields :
    STUDENT_ID INT PRIMARY KEY
    NAME CHAR(20)
    ADDRESS_ID INT <----------------
    |
    ADDRESS Table : |
    |
    ID INT PRIMARY KEY -----
    ADDRESS CHAR(30)
    CITY CHAR(20)
    STATE CHAR(20)
    If we write CMP EJB for STUDENT entity and maintaine a 'cmr' field for ADDRESS how does the container know ADDRESS_ID is the field where it needs to populate with Address ID. The book says container will automatically take care of that !!!!
    I couldn't find this information explicitly mentioned in the deployment discriptor in many of the examples.
    Does the container looks at FOREIGN KEY relation of RDBMS and identify it that way ? or ?.
    Can someone help me out to clear this doubt.
    Thanks.

    I am also learning EJB now, according to what I knew,
    ADDRESS_ID INT actually stores the value of primary key for the Address Bean, and if you set the XML deployment discriptor correctly(<cmr> field), the container will manage it automatically.
    We can discuss this through email: [email protected]
    William.

  • Problem with EJB

    hi,
    i am using sun application since i am learning EJB.
    i am getting this error while running a sample EJB code...
    i have deployed ejb successfully and trying to run a client code.
    D:\Users\j2ee\headfirst>java headfirst.AdviceClient
    Nov 21, 2006 3:00:29 PM com.sun.corba.ee.spi.logging.LogWrapperBase doLog
    INFO: "IOP00710299: (INTERNAL) Successfully created IIOP listener on the specifi
    ed host/port: all interfaces/3683"
    WHAT IS THIS
    javax.naming.NameNotFoundException: AdviceBean not found
    at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.
    java:185)
    at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.ja
    va:157)
    at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.ja
    va:161)
    at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialCont
    extProviderImpl.java:101)
    at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(Reflecti
    veTie.java:123)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
    tchToServant(CorbaServerRequestDispatcherImpl.java:648)
    at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispa
    tch(CorbaServerRequestDispatcherImpl.java:192)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    Request(CorbaMessageMediatorImpl.java:1709)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    (CorbaMessageMediatorImpl.java:1569)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(C
    orbaMessageMediatorImpl.java:951)
    at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.call
    back(RequestMessage_1_2.java:181)
    at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest
    (CorbaMessageMediatorImpl.java:721)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatc
    h(SocketOrChannelConnectionImpl.java:469)
    at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(
    SocketOrChannelConnectionImpl.java:1258)
    at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.
    run(ThreadPoolImpl.java:409)
    D:\Users\j2ee\headfirst>
    REMOTE INTERFACE :
    package headfirst;
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public interface Advice extends EJBObject
    public String getAdvice() throws RemoteException;
    HOME INTERFACE :
    package headfirst;
    import javax.ejb.*;
    import java.rmi.RemoteException;
    public interface AdviceHome extends EJBHome
    public Advice create()throws CreateException,RemoteException;
    BEAN :
    package headfirst;
    import javax.ejb.*;
    public class AdviceBean implements SessionBean
    private SessionContext ctx;
    private String[] adviceStrings={"Visualise yourself", "Work Hard", "Early to bed Early to rise makes a man healthy wealthy and wise",
    "Rest Dont work today", "Take a cup of tea"};
    public void ejbActivate()
    System.out.println("ejb activate");
    public void ejbPassivate()
    System.out.println("ejb passivate");
    public void ejbRemove()
    System.out.println("ejb remove");
    public void setSessionContext(SessionContext ctx)
    this.ctx=ctx;
    System.out.println("Session Context");
    //This is the business method
    public String getAdvice()
    System.out.println("Inside get Advice");
    int random=(int)(Math.random()*adviceStrings.length);
    return adviceStrings[random];
    //You must have ejbCreate() method It is a EJB rule. It does not come from SessionBean Interface.
    public void ejbCreate()
    System.out.println("ejb create");
    CLIENT CODE :
    package headfirst;
    import javax.naming.*;
    import javax.rmi.*;
    import java.rmi.*;
    import java.util.Properties;
    public class AdviceClient
    public static void main(String[] args)
    new AdviceClient().go();
    public void go()
    try{
    AdviceHome home=null;
    Advice advisor=null;
    Properties props=System.getProperties();
    Context ic=new InitialContext(props);
    Object o=ic.lookup("ejb/AdviceBean");
    home=(AdviceHome)PortableRemoteObject.narrow(o,AdviceHome.class);
    advisor=home.create();
    System.out.println(advisor.getAdvice()+"displayed");
    catch(Exception e)
    System.out.println(" WHAT IS THIS ");
    e.printStackTrace();
    could you help me out ...please....

    Looks like you are running a standalone java client, as opposed to JavaEE application client. You may find helpful info in Glassfish EJB FAQ:
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    -cheng

  • EJB 3.0 Stateful - Limiting number of bean instances

    Hello EJB Experts,
    I have just started to learn EJB 3.0 and have some basic queries. The application server that I am using is Glassfish. Please find my queries below:
    1. To remove an bean instance from the container, we can use the annotation '@Remove'. I basically had 2 methods and annotated the 2nd method with '@Remove'. Whenever the 2nd method is called, the container is removing this instance also in my program. My problem is that, i might get some invalid parameter values in the 2nd method, so in that case I have to just log the error message and whenever the input parameters are correct, then only the instance should be removed. But lets say, if someone calls my 2nd method with invalid parameters, I log the message and the container removes it, but after some time if the 2nd method is called with correct parameters, then the instance will not be available. Can we programatically tell the container when to remove a bean instance?
    2. From the docs, I am clear that pooling works only for 'Stateless' beans. I however (I am using 'Statuful' bean), wanted to limit the max number of instance to 2. I did below mentioned configuration in the 'sun-ejb-jar.xml' file:
    <bean-cache>
                        <is-cache-overflow-allowed>false</is-cache-overflow-allowed>
                        <cache-idle-timeout-in-seconds>1</cache-idle-timeout-in-seconds>
                        <max-cache-size>2</max-cache-size>
                        <resize-quantity>0</resize-quantity>
                        <removal-timeout-in-seconds>2</removal-timeout-in-seconds>
                        <victim-selection-policy>LRU</victim-selection-policy>
              </bean-cache>
    But i think, it is still creating more that 2 instances of this bean.
    Please help me in getting answers to these questions. I will be very thankful for your replies.
    Regards,
    San
    Edited by: SolarisUser1 on Jun 27, 2010 11:00 PM

    @Remove is used for stateful EJBs and you call it when your client has finished using that instance of the stateful EJB.
    If you are passing in parameters to the method and letting it do some work with your parameters then perhaps it should not be a remove method at all. Make it a normal method and only put cleanup related logic in the remove method. You can also throw some application exception and rollback if the parameters are not correct.

  • Problem while generating stub and skeleton in ejb

    Hi All,
    I am learning Ejb,i developed a simple hello world application .And i am trying to generate stub and skeleton for that using weblogic.ejbc.I am getting the following error
    C:\nkmb\ejb\HelloEjb>java weblogic.ejbc slb.jar
    <Jun 22, 2006 9:55:35 AM EDT> <Warning> <EJB> <BEA-010212> <The EJB 'HelloBean(J
    ar: slb.jar)' contains at least one method without an explicit transaction attri
    bute setting. The default transaction attribute of Supports will be used for the
    following methods: remote[hello()] >
    C:\nkmb\ejb\HelloEjb\ejbcgen\examples\HelloBean_gbyfgg_Impl.java:11: cannot a
    ccess java.io.Serializable
    bad class file: C:\Program Files\Java\jre1.5.0_06\lib\rt.jar(java/io/Serializabl
    e.class)
    class file has wrong version 49.0, should be 48.0
    Please remove or make sure it appears in the correct subdirectory of the classpa
    th.
    public final class HelloBean_gbyfgg_Impl
    ^
    1 error
    Exec failed .. exiting
    can anybody help me to getting out of this problem.
    thanks inadvance,
    nkmb

    Try the following forum (about EJB technology)
    http://forum.java.sun.com/forum.jspa?forumID=13

  • New To Advanced Java EJB Problen

    I m a adv java fresher
    I 've worked in JSP, Servlets, JRUN, Tomcat, JDBC But i don't want to learn EJB. This is so hard to learn.
    Is there any good alternates that industry accepts.
    Also please tell me resources available to learn & practice EJBs
    Are Java Web Services not an excellent alternate to EJB

    Are Java Web Services not an excellent alternate to EJB.Although they are similar ...I wouldn't say one is a substitute for the other. One nice example of a web service I have seen is one used by several of the library automation programs leading the market these days. Each 'title' you inquire about can have a book jacket in gif form ...an important visual cue for young library patrons.
    Now, suppose you forced each organization that purchased your automation system to create, format, and house their own .gis for this purpose? No way, users scanning ...keeping current ...storing ...their own gifs? Push that responsibility on to them? No way. Before long your nice handywork would start to look like garbage with half missing jacket visuals ...like a patchwork mosaic!
    Instead ...one single (and that is the key to our discussion here ...single) company has set up a web service so that all users from all vendors can hook in (paid subscription) and download (realtime) .gif's for whatever titles they (the users) may have in their active system at each moment. Remember I said 'all the application vendors' ...meaning that a separate company got smart, saw a need ...and developed a web service to supply the entire market with book jacket pictures on demand. The automation vendors simply build their applications to take advantage of an offered service. That is the concept of a web service. It's not really an 'enterprise solution' ...its a unique and focused 'piece' of a larger picture. Hey ...another very cool area of study ...but not really an 'alternative' to an EJB solution.
    With an EJB solution, remember I said it was for DBA guys. It is a way of modelling your enterprise data in RAM, making it more scaleable than hitting the db and disk with thousands of hits per hour. It uses the traditional db for (permanent) persistent, but keeps multiple 'instances' of certain views of your data in the memory of the server, like a repository of your data held ready to go out the shute, even to multiple callers concurrently. CMP makes it easy to switch db vendors without having to rewrite large sections of your application in order to do so. These are some of what EJB solutions offer, and although similar ...it isn't exactly the same as what a singular web service is really trying to offer.
    Now hey, having said that ...there are a lot of similarities for sure. I almost got the idea that MS was trying to tell me (at some recent .NET training ...barf) to make a bunch of web services collected together ...and that somehow that was supposed to rival an EJB application server solution. Hmmm, maybe there is actually varying definitions and visions for what a web service will be. Maybe you could 'copy' the EJB methodology and implement it as a collection of web services ...but somehow that seems like it might be going off in the bush. To me, they are similar solutions for different problems.
    Maybe someone else can shed more light ...I hope you can gleen something meaningful from my brief comparisons. My point was just to imply that they aren't really a 'substitute' for one another, which is what I think you mean when you say "Are Java Web Services not an excellent alternate to EJB ".
    GumB.

  • Required jars to execute ejb

    when i try to compile some entity beans i am getting javax.ejb.* package not found error.And i am learning EJB so these are the first ones i am compiling.
    I have J2SE 1.4.2_03 installed on my machine.Now i don't want to download the J2EE again.Is there any way i can download the required jar files for ejb.
    I am not even sure whether i need any other jar or not.

    javax.ejb.* is part of the J2EE jar.
    Many J2EE vendors include this in their own jar files.
    J2SE 1.4.2_03 does not contain these jar files.
    So what J2EE container are you using. They will have the required files. You might just have to look for it.
    Post the J2EE container you are using.
    Vijay

  • A newbie of EJB: ask for the design

    I am now learning EJB. Now, I have the basic concept of EJB, e.g. Session
    Bean, Message-Driven Bean, Entity Bean. However, I am now trying to learn
    the design of the bean. I find it is quite difficult to design which type of
    bean should be created.
    Now, I want to create a web application which allows the user to
    add/edit/delete/view people information in a system. There is a table of
    People in the DB. So that there should be an entity bean of People. However,
    how should I design for the action of add, edit, delete and view?
    Thanks!
    Stephen

    read up at the www.theserverside.com. They also have a free EJB book.
    "Stephen Lee" <[email protected]> wrote in message
    news:3cb6dc05$[email protected]..
    I am now learning EJB. Now, I have the basic concept of EJB, e.g. Session
    Bean, Message-Driven Bean, Entity Bean. However, I am now trying to learn
    the design of the bean. I find it is quite difficult to design which typeof
    bean should be created.
    Now, I want to create a web application which allows the user to
    add/edit/delete/view people information in a system. There is a table of
    People in the DB. So that there should be an entity bean of People.However,
    how should I design for the action of add, edit, delete and view?
    Thanks!
    Stephen

Maybe you are looking for

  • 5th Gen iPod - Accidently Cut and Pasted in My Computer... Now Buggered

    So, I was at school, listening to my music as per normal, when class ended and I had to leave. I closed iTunes before ejecting the iPod and didn't want to log off Windows without taking the iPod out first (being as its new and I love it so). I went t

  • Forcing a Mac with 2 connected ethernet ports to use one over the other

    I have a G5 Quad and a Mac Pro that are connected to a large network (including internet) on ETHERNET 1, and they are also directly connected over ETHERNET 2 (using Jumbo Frames). I need to ensure the G5 uses ETHERNET 2, and not ETHERNET 1, to connec

  • Windows XP Mode (Virtual PC) only uses half a CPU core/thread.

    Not only does windows xp mode not support multiple cores, to me it looks like it only uses half a core/thread. I noticed this because I just setup windows xp mode (virtual pc) on my computer.  I updated it, joined it to our domain and then installed

  • PRRW - Displaying separate line items for separate Wage Type / tax Code

    Hi , In the Travel trip PR05 after the trip is setteled, the trip no. need to run with the Posting run through Tcode: PRFI. Then we need to Run the Created Document using the Tcode: PRRW. My Requirement is that for some WAGE TYPE which are assigned w

  • Performance Issues - Screen Redraw etc.?

    I have a new MacBook Pro 15" (8GbRAM, 2 GHz i7) Using 30" Cinema Display, OS 10.7.2. I'm using Photoshop CS 5.1 (12.1 x64) Extended. After working for awhile I get performance lag -mostly drawing, cloning etc. Then the cursor starts behaving unpredic