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

Similar Messages

  • How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided.

    How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided via the Help menu other than it showing the pull-down menu selection to make.

    No.  I am able to use the other features such as underlining, highlighting, adding rectangles and oval and save those changes.

  • Why do we need to assign ip for the D channel ISDN-PRI

    Why do we need to assign ip address to the D channel (signaling ) when we configure ISDN-PRI in the example below :
    http://www.cisco.com/univercd/cc/td/doc/product/access/ap/ap_ts3/ap_ts3sw/apswisd.htm
    <quote>
    Step 1:Specify the D channel of the first Primary Rate Interface (PRI):
    AS01(config)# interface Serial 0:23
    AS01(config-if)#
    Step 2: Assign an IP address and subnet mask to the interface:
    AS01(config-if)# ip address 172.16.254.253
    </quote>
    Regards

    You can assing one there, and / or on dialer interfaces. It depends on what you are doing.
    These will be the address used by PPP when it runs on the B-channels.

  • CS5: Why do I need 2 places to define the Chapter Number style?

    Hello,
    I was wondering, when I use Chapter Number via the text Variables, I can define the nubers style over there, but I can also define it via Numbering and Sections options.
    Why do I need 2 places to define that?
    thanks,
    shlomit

    Hello,
    I was wondering, when I use Chapter Number via the text Variables, I can define the nubers style over there, but I can also define it via Numbering and Sections options.
    Why do I need 2 places to define that?
    thanks,
    shlomit

  • Why do I need to keep all of the old backups?

    Yes, I know it is great, but it uses a lot of disk space (my back up is 100 gb, I should a need a 2 tera external hard drive to keep them all!). Is it OK if I manually delete all previous ones (a drag, I know, but might be the only way)

    Tif wrote:
    Thanks for the replies, and yes, you are right, it is not using the space I thought it was but much less. I am doing what you two suggested here, I am backing up everything from scratch. The thing I don´t understand, though, is ... Why, if when the disk runs out of space TM automatically deletes the oldest one, I can´t do the same manually?
    Time Machine's incremental backups back up only the things that have changed since the last backup, which is why the backups can be quite small. New and modified files are added to the Time Machine disk in their entirety; everything else gets a special type of alias - a hard link - that simply points to wherever the real file was last stored (the "wherever" is more a "whenever": it points to the backup that contains the real file). The files aren't moved around; the pointers save all that trouble.
    So, let's say you have your original backup, A, and interim backups B and C. You have a new file in backup B, so it doesn't exist in A. When backup C is done, it uses only a pointer to the file in backup B, because you haven't modified the file. What happens when you manually delete backup B? The file disappears and the pointer in C doesn't have anything to point to! Time Machine knows, when it deletes stuff, what's real and what's a pointer, and if it has to change pointers, and so on.
    This may not always be an issue if you have a current copy of a file on your drive - in the Now, so to speak. Unless, of course, you modify it and then want to get the previous version (one of the handiest things about Time Machine).
    (And Time Machine does erase files when it deletes backups: you can't always get at all the modified versions of a file, for instance, if those dates disappear; and, if you create a file that's stored in backup B, and then you Trash it later, when B is deleted, so is the file and all the pointers to it.)
    s.

  • Why does apple need creditcard info to download the free yosemite update?

    I want to know why Apple needs creditcard info to download the free Yosemite update.

    Apple sets the rules.

  • Why do we need private static method or member class

    Dear java gurus,
    I have a question about the use of private and static key words together in a method or inner class.
    If we want to hide the method, private is enough. a private static method is sure not intended to be called outside the class. So the only usage I could see is that this private static method is to be called by another static method. For inner class, I see the definition of Entry inner class in java.util.Hashtable, it is static private. I don't know why not just define it as private. Could the static key word do anything better.
    Could anybody help me to clear this.
    Thanks,

    What don't you get? Private does one thing, andstatic does >something completely different.
    If you want to listen to music, installing an airconditioner doesn't help>
    Hi, if the private keyword is the airconditioner, do
    you think you could get music from the static keyword
    (it acts as the CD player) in the following codes:You're making no sense and you're trying to stretch the analogy too far.
    Private does one thing. If you want that thing, use private.
    Static does something completely different and unrelated. If you want that thing, use static.
    If you want both things, use private static.
    What do you not understand? How can you claim that you understand that they are different, and then ask, "Why do we need static if we have private"? That question makes no sense if you actually do understand that they're different.

  • Why do we need to plan promotions at the lowest level of aggregation

    Hi,
         The documentation says that we need to plan the promotions at the lowest level of aggregation i.e., the material level. Why? Is there a specific reason for this? Can we plan at other levels of aggregation as well? What happens if we plan at higher level;s of aggregation?
    Thanks.

    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

  • Why do I need iOS 5 to buy the iPhoto app???

    I have an iPhone 4 and when I try to buy the iPhoto app, it tells me I need iOS 5.1. Why? And how do I upgrade???

    You need iOS 5.1 because that is the latest iOS and Apple developed the iPhoto for iOS app to use this most recent version.
    If you already have iOS 5.0 or 5.0.1 you can update on your iPhone by going to
    Settings > General > Software Update
    If you have an earlier version of iOS then you'll have to connect your iPhone to your computer and start iTunes. Select your iPhone in the left column and select General in the right column. Look down the screen to learn about updating the iOS.
    The update is free but, especially if you have iOS version 4 something you may also have to update some of your apps. Pages for instance requires a free update to work under iOS 5.1.

  • Why do you need a credit card # if the app is free

    I do not have a valid credit card that I can remember a password for.
    What can I do to download
    Firefox?

    If this is the Firefox home app, it may be a requirement of the iPhone site to enter credit card details. This is not a requirement from Mozilla.

  • Why can't my code see annotations in a class file?

    So I have a JAR file with some classes in it. I have used DJ Java Decompiler to inspect the class in question and I can definitely see the annotations in it.
    I'm working on a Maven MOJO that reads the JAR files to find the annotations, but for some reason my code does not find any annotations at all. Does anyone have any ideas what the problem might be?
    The StreamLoader seems to be working because when I load the classes, their names get logged properly. Could there be something in the StreamLoader that is stripping off the annotations?
    Cheers, Eric
    try
        JarFile jarFile = new JarFile(artifact.getFile());
        Enumeration<JarEntry> jarEntries = jarFile.entries();
        while (jarEntries.hasMoreElements())
            JarEntry jarEntry = jarEntries.nextElement();
             if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(".class"))
                getLog().info("jarEntry.getName() = " + jarEntry.getName());
                try
                 Class<?> entry = streamLoader.loadClass(jarFile.getInputStream(jarEntry));
                 getLog().info("entry " + entry.getName());
                 if (entry.isAnnotationPresent(DotNet.class))
                     getLog().info("including " + entry.getName());
                 DotNet dotNet = entry.getAnnotation(net.sf.jni4net.annotations.DotNet.class);
                 if (dotNet == null)
                     Annotation [] annotations = entry.getAnnotations();
                     for (Annotation annotation : annotations)
                         getLog().info("annotation " + annotation.toString());
                 else
                     getLog().info("including " + entry.getName());
             catch (Throwable t)
                 getLog().warn("can't find class " + jarEntry.getName());
    catch (IOException e)
        getLog().error(e.getMessage(), e);
    class StreamLoader extends ClassLoader
        public StreamLoader(ClassLoader parent)
            super(parent);
        public Class<?> loadClass(InputStream input) throws ClassNotFoundException
            try
                ByteArrayOutputStream buffer = new ByteArrayOutputStream();
                int data = input.read();
                while(data != -1)
                    buffer.write(data);
                    data = input.read();
                input.close();
                byte[] classData = buffer.toByteArray();
                return defineClass(null, classData, 0, classData.length);
            catch (MalformedURLException e)
                e.printStackTrace();
            catch (IOException e)
                e.printStackTrace();
            return null;
    }

    Yes.
    @Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME)
    public @interface DotNet { }I am assuming that if it were not set that way then it would not show up in the class file at all - but I could be wrong.
    There are also other annotations with RetentionPolicy.RUNTIME, i.e. @ThreadSafe, but my code cannot see them either, even though the disassembler can see them.
    Cheers, Eric

  • Having problem access the EJB 3 from Web Component

    Hi ,
    I have an EJB 3 entity AuctionItem and a session ItemProcessor only implements the local interface IItemProcessor, then I use a servlet to access the findAll method in the ItemProcessor. I've created a Enterprise Applicaiton project to contain the ejb jar and the war file, but after I deploy the ear successfully, I couldn't access to my servlet through http://localhost:8080/AuctionWeb/AuctionServlet, it keeps giving me error like follwoing. Do you know why, your help will be very appreciated !
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
         at web.AuctionServlet.doGet(AuctionServlet.java:43)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    My code sample:
    public class AuctionServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
          @EJB
             private IItemProcessor itemProcessor;
         public AuctionServlet() {
              super();
         protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Servlet AuctionServlet</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("<h1>Servlet AuctionServlet at " + request.getContextPath () + "</h1>");
            List items = itemProcessor.findAll();
           for (Iterator it = items.iterator(); it.hasNext();) {
            AuctionItem elem = (AuctionItem) it.next();
           out.println(" <b>"+elem.getItemid()+" </b><br />");
           out.println(elem.getTitle()+"<br /> ");
            out.println("</body>");
            out.println("</html>");
    .....And the session bean is :
    package sessions;
    import javax.annotation.Resource;
    import javax.ejb.Local;
    import javax.ejb.Stateless;
    import javax.persistence.*;
    import javax.sql.DataSource;
    import java.util.List;
    import entities.AuctionItem;
    @Stateless(name = "ItemProcessor")
    public class ItemProcessor implements sessions.IItemProcessor {
         @PersistenceContext
         EntityManager entityManager;
         public Long createItem(String title, Double value, String description,
                   String status) {
              AuctionItem item = new AuctionItem();
              item.setTitle(title);
              item.setValue(value);
              item.setDescription(description);
              item.setStatus(status);
              entityManager.persist(item);
              return item.getItemid();
         public String findItemByKey(Long id) {
              AuctionItem item = entityManager.find(AuctionItem.class, id);
              return item.getTitle();
         public List findAll() {
            return  entityManager.createQuery("select object(o) from AuctionItem as o").getResultList();
    }

    The most common reason for this failure is if your web.xml does not refer to the latest web application
    .xsd :
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http
    ://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/x
    ml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    Otherwise, the web application is considered to be a J2EE 1.4 application and annotations
    are not processed. If that's not the case you can also run the application through the
    verifier to see if it identifies any issues.

  • Handling file objects in the EJB layer

    It is seen that file handling in the EJB violates the specs.
    But, I have the requirement to read and parse some xpdl(xml specification) file in EJB.
    The parsing function is already in the EJB layer and the filepath is obtained as input from jsp(in the request) in a servlet.
    Im passing the filepath as a parameter to the bean method before parsing.
    Now the requirement is to construct the File object out of xpdl file and pass it as a parameter to EJB method. How can this be achieved?

    Hi,
    I'm not sure if this is helpful or not, but I just wanted to ask: If you know you need to parse the file on the EJB side, why not just go and do it? If you can always guarantee that files will be present in the same location that the beans are deployed to, then I don't think there is anything stopping you from reading them, if you know the full path to each file?
    You wrote that the path to the file is obtained from a JSP page. If those files need to be parsed anyway, you could move the parsing code to your JSPs (servlets), and use ServletContext.getResourceAsStream to read the contents. Then you could send the contents as a parameter to your EJB call.
    One last thing: if the files are large, you might want to consider using JMS and message-driven beans to do the reading/parsing job. Your MDBs could then call the EJBs, but you would have to return your results in an asynchronous manner.
    Just a couple of thoughts.
    Mark

  • Question on The @EJB Annotaion

    Hello everyone,
    How does the @EJB annotation works? Does it already assign an instance of the EJB once a field is annotated by it?
    For example I have a code below;
    public class MyClass {
        @EJB
        StudentEJB studentEJB;
        @EJB
        EmployeeEJB employeeEJB;
        public void process(int type) {
            switch(type) {
                case STUDENT:
                    studentEJB.processRecord();
                    break;
                case EMPLOYEE:
                    employeeEJB.processRecord();
                    break;
    }From the code above, either one of the EJB will be used/invoked, making the other EJB not used at all. My concern there is that other wasted EJB instance.
    I would appreciate any of your insights on these.
    - Pat
    Edited by: theevilclown on Apr 27, 2010 11:17 PM

    Hi Jack,
    This is a good starting point when using Call Library Function node. Check out this Help Page
    Van L
    NI Applications Engineer

  • Help needed in EJB - to call AS from EJB a Session Bean

    Hi All ,
    I have been strictly told not to use Web Services as all the applications are on the same server
    actually I have to make an EJB invocation to an Application Service from the CAF layer from a Session Bean of another EJB Project(Not a CAF Service).
    the CAF layer has 5 parts metadata , permissions , dictionary , ear and ejbmodule.
    I added the ejbModule to the Build Path of the calling EJB Session Bean. And so I was able to access the operations of the Application Service which in turn accesses a BAPI(The Appl Service operation returns a String).
    But while executing I got the exception java.lang.RuntimeException: java.lang.NoClassDefFoundError
    My method :
    Normally from a Dynamic Web Project acting as a client to an EJB Session bean, I was able to get access to EJB Local Interface by using
      private ConverterLocal converterBean = null;
      public void jspInit() {
        try {
         InitialContext ic = new InitialContext();
         converterBean = (ConverterLocal)
         ic.lookup("java:comp/env/Converter");
        } catch (Exception ex) {
             System.out.println("Couldn't create converter bean."+
           ex.getMessage());
    BigDecimal dollarAmount =  converterBean.euroToDollar(value);
    So I created a JNDI field in ejb-j2ee-engine.xml
    enterprise-beans>
            <enterprise-bean>
         <ejb-name>com.sap*******.bapi_company_getlist.BAPI_COMPANY_GETLIST</ejb-name>
                   <jndi-name>COMPANY</jndi-name>
                </enterprise-bean>
    </enterprise-beans>
    And from my Session Bean , I tried to access it using the code in already existing Bean which was working fine
    BAPI_COMPANY_GETLISTBeanImpl bean = new BAPI_COMPANY_GETLISTBeanImpl();
              try {
                   InitialContext ctx = new InitialContext();
                   bean = (BAPI_COMPANY_GETLISTBeanImpl)ctx.lookup("COMPANY");
              } catch (NamingException e) {
                   System.out.println("Converter Bean can't be created");
                   String send = bean.returnDetails();
    And I tried to print the String , but I got the above error
    I have a doubt :
    1) How do I specify the JNDI name ie in the ejb-j2ee-engine.xml file , what should I add as the name of the ejb
    is this sufficient , or are there more steps ??

    Hi Ekaterina,
    I have the document to access my Bean from another Bean.
    I could access my Bean from a standalone Java class with this code
    Properties props = new Properties();
              props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");
              props.put(Context.PROVIDER_URL,"hostname:port");
              try{
                   Context ctx = new InitialContext(props);
                   Object o = ctx.lookup("sap.com/TestEAR/REMOTE/TestBean/com.@#$.TestRemote");
                   TestRemote testRem = (TestRemote)javax.rmi.PortableRemoteObject.narrow(o, TestRemote.class);
                   String msg = testRem.getMessage();
                   System.out.println(msg);
    And in this document there is a way shown to access a bean from another Bean.
       http://help.sap.com/saphelp_nw04/helpdata/en/13/c8633e0084e946e10000000a114084/frameset.htm
    If your client is another enterprise bean, declare the EJB reference in the ejb-jar.xml.
    -For more information, see Declaring EJB References.
    But the problem is that in EJB 3.0 ,  I can't see the ejb-jar.xml file .
    So how should I have a Bean as a client to another Bean, I am not that familiar with Annotations.

Maybe you are looking for

  • Create a change pointer

    Hi everybody. I need to throw a change pointer when a equipment is modified (Table EQUI). I´d like to throw this change pointer when the user change the status of this object (Tabla JEST, field STAT). The problem is that in transaction BD52 I can´t f

  • Promblems of showing chinese character set in workshop 8.1

    Promblems of showing chinese character set in workshop 8.1 IDE I just saw the rectangle( it meant that can't find proper font). Could anybody tell me how to fix it ?

  • IPhoto crashing my library

    I don't know why my iPhoto just crashes: *Your photo library is either in use by another application or has become unreadable* Shut down and restart your computer, and then open iPhoto again. If the problem persists, try rebuilding your photo library

  • Can't update apps because app world won't work

    I have like 8 app updates but I can't update them because app world isn't letting me sign in. It takes like 2 minutes to authenticate my sign in info and it says it can't do it and has to close app world because an error occured.  AND I can't update

  • How much is a i phone 6 plus if i already have a i phone

    i have a iphone 5s and cracked it but want the i phone 6 plus and was wondering how much it would be