********* WHY EJB? WHEN EJB?? WHICH EJB? ************

Hi
Can anyone tell me clearly when do we really think of using ejb in our project ?? why should we use ejb??
if there is a reason to use ejb's when should i think of session beans and entity beans.
I would be very thankful if anyone gives me a detail explanation.
i have gone thru the material but iam really confused.
tks in advance.

Following is a brief introduction to EJB that may clear some of your questions.
Enterprise JavaBeans
1.     Entity and Session Beans
Entity Beans represent the data items that are the core of applications.
     Eg Customer, Order, orderItem or product
Session Beans represent logical operations and usually operate on the entity beans.
     Eg OrderEntry, PaymentAuthorisation
A session bean is typically the main bean that an application uses although the application might manipulate the entity beans directly. For example an application might create an Order entity bean and an OrderItem entity bean and initialize its values. It would then use the OrderEntry session bean to store the order.
2.     Containers
An EJB server may support several virtual servers, and these are referred to as containers. The term container in this context essentially means server.
3.     Persistence
Saving and retrieving entity beans is extremely important in an EJB application. EJB persistence comes in two flavors.
Bean Managed persistence
With Bean Managed Persistence each entity bean is responsible for saving itself and retrieving itself from the database. It must have methods to insert itself, update itself, read itself and other housekeeping methods.
Container Managed Persistence
With Container Managed Persistence the EJB container itself handles the beans persistence. This means that entity and session beans can be written to do business logic and the container handles the database operations.
4.     Transactions
Operations in a session bean take place within the scope of a transaction that is managed by the EJB container. An EJB container can be instructed what kind of transaction scope is needed for each session bean method, for example it can be indicated that a particular method is always begins a new transaction or that a method can only be called after a transaction has been started. Transaction housekeeping is left to the EJB container again letting the entity and session beans concentrate on the business logic.
5.     Connection Pooling.
The EJB container handles database connection pooling. The container need to be configured so it knows how to create a database connection and it will grab a connection automatically. If a CMP bean is used then you may never have to use the database connection directly. Even with BMP you don�t need to worry about getting a connection and returning it when your done. The EJB container handles this for you.
6.     Object Pooling
An EJB server can pool Enterprise JavaBeans. EJB setup can take a lot of time depending on the bean. For beans that are used frequently you can tell the EJB server to keep a pool of the beans handy because you wil need them often.
7.     How it all fits together
Enterprise JavaBeans, servlets and Java Server Pages are the three technologies that represent the core of J2EE because they function as servers. The other API�s JDBC, JNDI, RMI, CORBA, JTS, JCA, JAAS and xml help support EJB, servlets and jsp servers.
With WEB application JSP and servlets interact with the browser and EJB concentrate on back end processing.

Similar Messages

  • ClassCastException when I access an EJB from a remote EJB in WL 8.1

    I am using WebLogic 8.1 and am trying to lookup the home interface for an EJB (_ejbRemote_)
    from another EJB (_ejbCurrent_). They are deployed in seperate EARs. When I bundle
    the home and remote interfaces for ejbRemote in the EAR file that ejbCurrent
    is deployed in, everything works fine. But I need to be able to configure ejbRemote
    at run time and my customers don't want to have to bundle their classes in my
    EAR. So I invoke a custom classloader (of type java.net.URLClassLoader) that will
    load the home and remote interface classes for ejbRemote from a configurable
    location at runtime. This finds the classes no problem, and the InitialContext.lookup()
    returns a stub, but I get a 'java.lang.ClassCastException: Cannot narrow remote
    object' error when I call PortableRemoteObject.narrow(home, homeClass);
    The code looks like:
    // Assume EJBHomeStr = "com.foo.TestHome" in this case
    // Load the home interface class. This works.
    Class homeClass = urlClassLoader.loadClass(EJBHomeStr);
    // Lookup the home interface. This works.
    Object lookedUpHomeObject = initialContext.lookup(JNDIName);
    // This fails.
    Object homeObject = PortableRemoteObject.narrow(lookedUpHomeObject, homeClass);
    And the weblogic error looks like
    ... ; nested exception is:
    java.lang.ClassCastException: Cannot narrow remote object to com.foo.TestHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteO
    bjectDelegateImpl.java:219)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at ...[the rest is just my application code stack...]
    When I log the ClassLoaders for the affected objects, using getClass().getClassLoader(),
    I get:
    <snippet from log follows>
    getClass().getClassLoader(): weblogic.utils.classloaders.GenericClassLoader@667da1
    finder:
    weblogic.utils.classloaders.MultiClassFinder@db9199 annotation: myEJBApp@
    homeClass.getName(): com.foo.TestHome classloader = java.net.URLClassLoader@4f1707
    lookedUpHomeObject.getClass().getName(): com.foo.Test_EJB_kx82zy_HomeImpl_810_WLStub
    classloader = weblogic.utils.classloaders.GenericClassLoader@667da1
    finder: weblogic.utils.classloaders.MultiClassFinder@db9199 annotation: myEJBApp@
    <end snippet from log>
    So it appears that since the looked up Stub was loaded by the WebLogic classloader
    and the actual Home class was loaded by my URLClassLoader, the narrow() can't
    reconcile the two. I have tried both rmic and the Weblogic appc command to pre-generate
    the stubs, which I put in the same JAR as my home and remote interface classes
    and load with my custom classloader. But the standard stub (generated by either
    rmic or appc) is named TestHomeStub.class and Weblogic is ignoring those and
    making a class with the name Test_EJB_kx82zy_HomeImpl_810_WLStub, as shown above.
    I have also tried to put the remote interface classes and stubs in the System
    classpath using the -classpath option when I start WebLogic, but same result.
    The question is, Is there a way in WebLogic to communicate with a remote EJB in
    a seperate EAR without bundling anything about that remote EAR in my EAR? Or is
    there something I've missed? I need to keep my application J2EE compliant, meaning
    I can't hardcode any AppServer-specific code in my application.
    Thanks.

    Hi Jon,
    Glad to hear that.
    Regards,
    Slava Imeshev
    "Jon Sutula" <[email protected]> wrote in message news:[email protected]...
    >
    I fixed the problem. It turns out I didn't need to use a custom classloader at
    all, I just use Reflection directly on the classes ruturned from my JNDI lookup.
    So when I lookup the home class, I don't need to narrow or cast it, I just use
    Reflection to invoke the "create" method. Then I use the object that I get from
    create and directly invoke whatever method on it I need, again using Reflection.
    And that works.
    "Slava Imeshev" <[email protected]> wrote:
    Hi Jon,
    The problem is, this class is not available for the classloader
    running your "main code".
    You can try to hack the into the thread context class loader:
    Thread thread = Thread.currentThread();
    ContextClassLoader originalClassLoader = thread.getContextClassLoader();
    try {
    YourURLClassloader yourClassLoader = new
    YourURLClassloader(originalClassLoader);
    thread.setContextClassLoader(yourClassLoader );
    // your code goes here
    } finally {
    // Don't forget to restore it !!!
    thread.setContextClassLoader(originalClassLoader);
    Be very cautious. If you fail to restore the original context class loader,
    you will likely have to restart the server.
    Hope this helps.
    Regards,
    Slava Imeshev
    "Jon Sutula" <[email protected]> wrote in message news:[email protected]...
    I am using WebLogic 8.1 and am trying to lookup the home interfacefor an EJB (_ejbRemote_)
    from another EJB (_ejbCurrent_). They are deployed in seperate EARs.When I bundle
    the home and remote interfaces for ejbRemote in the EAR file that
    ejbCurrent
    is deployed in, everything works fine. But I need to be able to configure
    ejbRemote
    at run time and my customers don't want to have to bundle their classesin my
    EAR. So I invoke a custom classloader (of type java.net.URLClassLoader)that will
    load the home and remote interface classes for ejbRemote from a configurable
    location at runtime. This finds the classes no problem, and the InitialContext.lookup()
    returns a stub, but I get a 'java.lang.ClassCastException: Cannot narrowremote
    object' error when I call PortableRemoteObject.narrow(home, homeClass);
    The code looks like:
    // Assume EJBHomeStr = "com.foo.TestHome" in this case
    // Load the home interface class. This works.
    Class homeClass = urlClassLoader.loadClass(EJBHomeStr);
    // Lookup the home interface. This works.
    Object lookedUpHomeObject = initialContext.lookup(JNDIName);
    // This fails.
    Object homeObject = PortableRemoteObject.narrow(lookedUpHomeObject,homeClass);
    And the weblogic error looks like
    ... ; nested exception is:
    java.lang.ClassCastException: Cannot narrow remote object tocom.foo.TestHome
    at weblogic.iiop.PortableRemoteObjectDelegateImpl.narrow(PortableRemoteO
    bjectDelegateImpl.java:219)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
    at ...[the rest is just my application code stack...]
    When I log the ClassLoaders for the affected objects, using getClass().getClassLoader(),
    I get:
    <snippet from log follows>
    getClass().getClassLoader(): weblogic.utils.classloaders.GenericClassLoader@667da1
    finder:
    weblogic.utils.classloaders.MultiClassFinder@db9199 annotation: myEJBApp@
    homeClass.getName(): com.foo.TestHome classloader = java.net.URLClassLoader@4f1707
    lookedUpHomeObject.getClass().getName(): com.foo.Test_EJB_kx82zy_HomeImpl_810_WLStub
    classloader = weblogic.utils.classloaders.GenericClassLoader@667da1
    finder: weblogic.utils.classloaders.MultiClassFinder@db9199 annotation:myEJBApp@
    <end snippet from log>
    So it appears that since the looked up Stub was loaded by the WebLogicclassloader
    and the actual Home class was loaded by my URLClassLoader, the narrow()can't
    reconcile the two. I have tried both rmic and the Weblogic appc commandto pre-generate
    the stubs, which I put in the same JAR as my home and remote interfaceclasses
    and load with my custom classloader. But the standard stub (generatedby either
    rmic or appc) is named TestHomeStub.class and Weblogic is ignoringthose and
    making a class with the name Test_EJB_kx82zy_HomeImpl_810_WLStub, asshown above.
    I have also tried to put the remote interface classes and stubs inthe System
    classpath using the -classpath option when I start WebLogic, but sameresult.
    The question is, Is there a way in WebLogic to communicate with a remoteEJB in
    a seperate EAR without bundling anything about that remote EAR in myEAR? Or is
    there something I've missed? I need to keep my application J2EE compliant,meaning
    I can't hardcode any AppServer-specific code in my application.
    Thanks.

  • Why do we need the @EJB annotation at the class level?

    Why do we need the @EJB annotation at the class level?
    Eg: Why do we need the first piece of code, when the second code seems much simpler .
    *1.*
    @Stateful
    @EJB(name="ejb/TradeLocalNm",
    beanInterface=TradeLocal.class)
    public class TradeClientBean implements TradeClientRemote {
    *2.*
    @Stateful
    public class TradeClientBean implements TradeClientRemote {
    @EJB private TradeLocal trd;
    }

    I think it is possible to do it in an aggregated level however you need to define your distribution rules in order to get the desired result, you need also to consider that if distribution rules changes and the value after promotional planning returns the same value, it is possible that detailed level are not realigned to the new distribution rule (e.g. regarding another ratio).
    Maybe this is one of several causes.
    Regards,
    Carlos

  • When not using EJBs can I make BD a Singleton and cache facade instances?

    Hi,
    In an application which does not use EJBs can I make BD(Business Delegate) a singleton?
    I was very sure about doing this but when I tried Google on the same subject the answers were'nt supportive of this but that was in the context of applications which used EJBs. And also item 4 in Effective Java isnt very supportive of caching Objects at the drop of a hat.
    When not using EJBs would it be an unnecessary thing to make BD a singleton and cahce Facade instances in a BD and DAO instances in a Facade? I am planning to use a array based blocking bounded buffer for the purposes of caching. Or would it be better to make both BD and a facade as SIngletons and just cache DAOs in a Facade?
    Any suggestion would be of good help to me.
    Thanks a lot.

    Not sure I understand all your design, but you seem
    to describe an architecture where requests are queued
    and handled serially.Sorry if I messed up while explaining it. No, it will not be handled serially. Since the BD is a singleton multiple threads can pass messages to it simulteanously, a bit like an object of the Action class in Struts. Since I dont see having any synchronized methods in a BD requests will be handled simulteanously.
    The impact on throughput of handling requests
    serially (as opposed to parallelizing them) probably
    outweights by far the cost of instantiating one more
    object per request...Yes, I understand that but as I explained above the reqests wont be handled serially.
    To be more clear, I am thinking of using any one of these two things:
    1) BD(Singleton)-->Facade(Singleton, caches DAOs in a thread safe data structure)
    2)1) BD(Singleton, caches Facade instances in a thread safe data structure)-->Facade(caches DAOs in a thread safe data structure).
    the thread safe data structure I am planning to have is a array based bounded buffer which blocks using wait and notify mechanism.
    Thank you for the reply.

  • Do you still need EJB when you can do it all with JSF/JSC?

    I think EJBs make J2EE unnecessarily complex for 80% of small to mid or even some large scale applications. When you can separate the logic and view using JSF and Servlets, and still do transactions (using JSC DataProviders), why do you still need EJBs? I have heard nightmares with EJBs deployment and how its complex to move them over from test to production servers.
    Are EJBs getting obsolete and not worth learning? Afterall, in the Microsoft world, there is nothing like EJB and all they got is ASP.NET (similar to JSF) -- along with its associated data classes and .NEt framework. I am sure they also promote separating logic from presentation.
    I think JSF is the best thing Java world has got to compete with Microsoft on developer productivity for small to medium size applications.
    Message was edited by:
    Sabir

    J2EE EJB's are far from being a holy grial capable of solving any situation. They are complex, difficult to learn and code, but we need to be fair and tell the whole story.
    EJB's are part of the J2EE technology and offer infrastructure needed in complex applications. I.E., you mention
    "When you can separate the logic and view using JSF and Servlets, and still do transactions (using JSC DataProviders)"
    but these are only database level transactions. The J2EE app servers can handle global (and distributed) transactions involving different operations over different databases and transactions ruled by non-database software. Just imagine the complexity of handling a "rollback" of this kind. Put that in .NET pipe and try to smoke it.
    J2EE EJB Entity Beans were the black sheep of the family. They were oriented to easily handle fine operations (i.e. update a specific record of information) but on the other hand present a poor performance in operations over large sets of data. You can do some optimizations but..... Now the story is a bit different with JavaEE 5 and the Java Persistence API -inspired on Hibernate-.
    The bottom line is (as you mention in your post): J2EE/JavaEE are not needed by most of small or mid sized apps. However, I would strongly encourage you to have a look at the JavaEE 5 technology. The fact that portions of the JavaEE technology do not have a counterpart in .NET does not mean that they are not worth to (at least) have a look at them.
    Best regards
    Antonio

  • Ejb-link not working when i access ejb in different ear

    Hi All
    I am here trying to access ejb's which is in different ear, I am providing ejb-link inside web.xml of war file deployed inside deffirent ear file.
    I am using wls8.1sp5. I tried different combination with elb-link name , but its not working . <ejb-ref>
    <ejb-ref-name>ejb/AuditService</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.onstar.audit.ejb.AuditServiceHome</home>
    <remote>com.onstar.audit.ejb.AuditService</remote>
    <ejb-link>ccarenewal.jar#AuditService</ejb-link>
    </ejb-ref>
    <ejb-ref>
         <ejb-ref-name>ejb/AccountService</ejb-ref-name>
         <ejb-ref-type>Session</ejb-ref-type>
         <home>com.onstar.account.ejb.AccountServiceHome</home>
         <remote>com.onstar.account.ejb.AccountService</remote>
         <ejb-link>ccarenewal.jar#AccountService</ejb-link>
         </ejb-ref>
    Exception:weblogic.management.ApplicationException: activate failed for sbwo Module: sbwo Error: weblogic.management.DeploymentException: Could not setup environment - with nested exception: [weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct.] weblogic.deployment.EnvironmentException: [J2EE:160101]Error: The ejb-link 'ccarenewal.jar#AuditService' declared in the ejb-ref or ejb-local-ref 'ejb/AuditService' in the application module 'accountadj.war' could not be resolved. The target EJB for the ejb-ref could not be found. Please ensure the link is correct. at weblogic.deployment.EnvironmentBuilder.addEJBLinkRef(EnvironmentBuilder.java:658) at weblogic.deployment.EnvironmentBuilder.addEJBReferences(EnvironmentBuilder.java:467) at weblogic.servlet.internal.CompEnv.init(CompEnv.java:123) at weblogic.servlet.internal.WebAppServletContext.activate
    I will appreciate any help.
    Rajiv

    Rob,
    Thanks for your reply.
    Below is all deployment descriptor entries i have(ejb-jar.xml, weblogic-ejb-jar.xml, web.xml, weblogic.xml)
    please correct me if i have wrong entries any where.
    ejb-jar.xml
    ejb-ref>
    <description />
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.onstar.account.ejb.AccountServiceHome</home>
    <remote>com.onstar.account.ejb.AccountService</remote>
    <ejb-link>AccountService</ejb-link>
    </ejb-ref>
    weblogic-ejb-jar.xml
    <ejb-reference-description>
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <jndi-name>cca/AccountService</jndi-name>
    </ejb-reference-description>
    web.xml
    <ejb-ref>
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <home>com.onstar.account.ejb.AccountServiceHome</home>
    <remote>com.onstar.account.ejb.AccountService</remote>
    <ejb-link>ccarenewal.jar#AccountService</ejb-link>
    </ejb-ref>
    weblogic.xml
    <ejb-reference-description>
    <ejb-ref-name>ejb/AccountService</ejb-ref-name>
    <jndi-name>cca/AccountService</jndi-name>
    </ejb-reference-description>
    I appreciate your help.
    Thanks
    Rajiv

  • Interop Survey: Which EJB Container is _known_ to work with which RDBMS?

    Which EJB Container
    have you personally used to successfully deploy entity beans
    in combination with which RDBMS Server Product[s]
    in a production environment supporting more than just a few users?
    EJB Container
    .VendorName =
    .ProductName =
    .ProductVersion =
    .ProductLanguage =
    .EJB-Spec-Version =
    RDBMS Server 1
    .VendorName =
    .ProductName =
    .ProductVersion =
    .ProductLanguage =
    Did you do multi database update ACID transactions that were managed by the EJB Container (ie CMP not BMP)?
    YES
    NO
    If so, did you do them across more than one RDBMS Server Product, such as mixing DB2 with SQL Server?
    YES
    NO
    RDBMS Server Product 2
    .VendorName =
    .ProductName =
    .ProductVersion =
    .ProductLanguage =
    I intend to publish the results to this forum by 15 Aug 2005.
    Please post any responses until 31 July 2005 so I can consider them in the survey.

    Tomcat does not support EJB deployment as it is a mere servlet engine. But it can be integrated with with JBoss, an app server which is freely available.
    -amit

  • Reg: How to know name of server in which ejb is deployed

    Hello:
    Can anyone tell me what the best way to know the name of the server in which
    ejb is deployed inside bean class.
    Thanks,
    Vijay

    But if i remember using java.net inside is a violation of spec.. and whats
    the reason u want to know ant the network level things inside a EJB..
    Amar
    "Arjuna Chala" <[email protected]> wrote in message
    news:3c644718$[email protected]..
    if you want to know the system name then the call
    System.out.println(java.net.InetAddress.getLocalHost().getHostName())should
    work.
    "VijayKumar" <[email protected]> wrote in message
    news:3c643a2c$[email protected]..
    Hello:
    Can anyone tell me what the best way to know the name of the server
    in
    which
    ejb is deployed inside bean class.
    Thanks,
    Vijay

  • Naming Problems with EJB when accessing from WebApplication

    Hi all,
    I'm trying to deploy an application consisting of several stateless session beans, one message driven bean and a web application. Everything works fine, until I try to log in (webapp). Then I get the following error:
    com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at ik, the whole lookup name is ik/sec/IKAuthenticationEJB.
    So the lookup name ik/sec/IKAuthenticationEJB is used in the code, whereas the JNDI Name of the requested bean is
    sap.com/Integrationkernel/IKAuthenticationEJB (As showed in the Admin Tool). I'm wondering why there is this "sap.com" as I choosed a different name for the provider (But the error remains even if I change it to "sap.com").
    As I cannot find any information about the "NameNotFoundException" I just tried the following:
    - add a "ejb-ref" section to web.xml
      <ejb-ref>
         <ejb-ref-name>ik/sec/IKAuthenticationEJB</ejb-ref-name>
         <ejb-ref-type>Session</ejb-ref-type>
         <home>com.tsystems.ik.security.authentication.IKAuthenticationEJBHome</home>
         <remote>com.tsystems.ik.security.authentication.IKAuthenticationEJBRemote</remote>
         <ejb-link>sap.com/Integrationkernel/IKAuthenticationEJB</ejb-link>
      </ejb-ref>
    - add a web-j2ee-engine.xml to the Web Application:
         <web-j2ee-engine>
             <ejb-ref>
                <ejb-ref-name>ik/sec/IKAuthenticationEJB</ejb-ref-name>
                <jndi-name>sap.com/Integrationkernel/IKAuthenticationEJB</jndi-name>
            </ejb-ref>
         </web-j2ee-engine>
    Does anybody know what to do? Did I declare the references in a wrong way?
    Is there a complete API Javadoc available? I just found the very small one on SDN...
    Thanks a lot,
    Nadine

    Hi Nadine,
    in order to lookup ab EJB from a web component you have to declare an ejb reference (ejb-ref section) in the web.xml. The jndi name in the web-j2ee-engine.xml  can be omitted if you are sure that the information provided by the "ejb-ref" section is sufficient to identify the EJB component.
    From the example you wrote I see that the ejb-link element is not correct. According to the EJB 2.0 FR specification (Appendix B, page 518) "ejb-link element must be the ejb-name of an enterprise bean". Probably this inconsistent information misleads the EJB Container in resolving the right reference.
    My advice is simply to omit this and leave the "home" and "remote" elements. They should be enough.
    A hint: you can use the "lsn" shell command from the "naming" group to observe the JNDI tree on a particular server node.
    I hope this will help you.
    Best regards,
    Svetoslav

  • Why all the conspiracy against EJBs?

    Hi,
    I see a lot of people (within our organization) claiming EJBs are heavy weight, while Spring is lightweight. And they hate EJBs as if it was the worst sin committed in enterprise Java. I have pretty much been a Spring and Hibernate developer for the past 1.5 years.
    But on various blogs I saw positive views of EJB 3.0. So I tried building simple crud stuff using it. I found it surprisingly simpler to develop in than Spring. So, what exactly is the overhead caused by EJB 3.0 which Spring+Hibernate do not suffer from?
    To put it more precisely, how do the following two cases differ to make EJB heavier than Spring?
    EJB 3.0
    1. Stateless EJBs managed by Java EE container.
    2. EntityManager injected by container (Glassfish creates another instance of the bean with new EM instance to handle concurrent requests to same bean).
    3. Container managed transactions.
    4. Accessed using Local interface.
    5. Injected using EJB 3.0 annotations.
    Spring
    1. Singleton beans managed by Spring.
    2. A thread-safe proxy of EntityManager injected by Spring.
    3. Spring managed transactions.
    4. Accessed using Local interface.
    5. Injected using Spring XML.

    Completely agree (though I'm admittedly biased). Much of the negative perception comes from pre - EJB 3.0. Also want to point out that we're building on the success of EJB 3.0 to further simplify the programming model and add a number of long-requested features in EJB 3.1 (http://jcp.org/en/jsr/detail?id=318) To name a few :
    -- Optional Local interfaces so a session bean can be developed using only a bean class
    -- Packaging and deployment directly in a .war without the need of a separate ejb-jar
    -- Singleton session beans
    -- Application Startup/Shutdown callbacks
    -- Asynchronous session bean invocations
    -- Automatic timer creation and calendar-based timers
    and more...
    See my blog for more details. http://blogs.sun.com/kensaks/
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • When to use @Resource and when to use @EJB for dependency injection

    Hi,
    When do you use
    @Resource and when do you use @EJB for dependency injection?
    Thanks

    Captain obvious: Use @EJB for injection of EJBs, and @Resource for everything else.
    There was a discussion about this very topic quite recently, perhaps you can find it through the search.

  • Have to ask again:when to use ejb-ref ?

    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

    In WLS you can have either global JNDI names that are visible throughout
    the server or JNDI names that are local to your application.
    The recommended best practice these days is to use ejb-refs and/or
    ejb-links to lookup your EJBs. For local EJBs, you don't need to have a
    global JNDI name since they are not visible to other applications.
    -- Rob
    scratchback wrote:
    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

  • When to use ejb-ref?

    if i do not write <ejb-ref> in ejb-jar.xml,what will happen?the application
    can not run or performance is low?
    and is there any difference between bmp and cmp?i mean "does cmp need
    <ejb-ref>?"
    Ciao,
    zhxt

    In WLS you can have either global JNDI names that are visible throughout
    the server or JNDI names that are local to your application.
    The recommended best practice these days is to use ejb-refs and/or
    ejb-links to lookup your EJBs. For local EJBs, you don't need to have a
    global JNDI name since they are not visible to other applications.
    -- Rob
    scratchback wrote:
    hi, I asked this last week but nobody answered it.
    i am really curious about it and i checked some docs it said " it is useful
    coz beans can look each other up without needing to initialize JNDI to any
    particular driver".
    i wonder what means particular driver and when there will be great
    difference between using and not using.
    thanx in advance
    Ciao,
    zhxt

  • Is there a way not to have to chose an available server in the console when deploying an ejb?

    Is there a way not to have to chose an available server in the console when deploying
    an ejb? Everytime we deploy our beans we have to logon to the console select the
    ejb and then chose a server under the tab targets? Can this be automated?

    You could try to select the target in the config.xml file, but this is
    not recommended by BEA.
    Nils
    Fred Bloggs wrote:
    >
    Is there a way not to have to chose an available server in the console when deploying
    an ejb? Everytime we deploy our beans we have to logon to the console select the
    ejb and then chose a server under the tab targets? Can this be automated?--
    ============================
    [email protected]

  • Why there are restrictions on EJB, but not on Servlet?

    Hi,
    There are some restrictions on EJB, for example,
    * use the java.lang.reflect Java Reflection API to access information.
    * listen on, accept connections on, or multicast from a network socket
    * define a class in a package
    But I can not find similar restrictions for Servlet. Why?

    I understand why there are restrictions for EJB, for example:
    * For security: it does not allow "java.lang.reflect Java Reflection API"
    * For thread management: user thread in not allowed.
    * For portability from machine to machine: file system access is not allowed.
    The same issues exist for servlet. But no restrictions.

Maybe you are looking for