ejb annotation

Discussion in 'Java' started by david wolf, Dec 7, 2006.

  1. david wolf

    david wolf Guest

    I am trying a ejb turorial on ejb 3.0 on jboss.

    When i tried to compile my java code using ant, I got an compile error
    as follows:
    ........
    terBean.java:15: cannot find symbol
    [javac] symbol: class Stateless
    [javac] @Stateless
    [javac] ^

    ----------------my java code---------

    @Stateless
    @Remote(TempConverter.class)
    public class TempConverterBean implements TempConverter {
    public double convertToC(int a){
    return (double)a/2;
    }


    public double convertToF(int a){
    return a * 2.0;
    }

    }

    In order to use annotation, do I need to explicitly include some jar
    file to my classpath?

    I never used annotation before, where these symbols from?

    Thanks,

    David
     
    david wolf, Dec 7, 2006
    #1
    1. Advertising

  2. david wolf

    david wolf Guest

    How to import Stateless annotation?

    By the way, at the beginning of the code, I import the following only:

    import javax.ejb.*;

    Should I put another import statement there, then what is that import
    statement?

    Tor Iver Wilhelmsen wrote:
    > "david wolf" <> writes:
    >
    > > terBean.java:15: cannot find symbol
    > > [javac] symbol: class Stateless
    > > [javac] @Stateless
    > > [javac] ^

    >
    > You need to import the Stateless annotation, which is a class. Oh, and
    > the other annotations while you're at it, too. :)
     
    david wolf, Dec 7, 2006
    #2
    1. Advertising

  3. david wolf schrieb:
    >
    > How to import Stateless annotation?
    >
    > By the way, at the beginning of the code, I import the following only:
    >
    > import javax.ejb.*;
    >
    > Should I put another import statement there, then what is that import
    > statement?


    The import should be fine. But you need to add the class-files (most
    probably contained in a jar-file) to the classpath when compiling.

    HTH
     
    Philip Reimer, Dec 7, 2006
    #3
  4. "david wolf" <> writes:

    > terBean.java:15: cannot find symbol
    > [javac] symbol: class Stateless
    > [javac] @Stateless
    > [javac] ^


    You need to import the Stateless annotation, which is a class. Oh, and
    the other annotations while you're at it, too. :)
     
    Tor Iver Wilhelmsen, Dec 7, 2006
    #4
  5. david wolf

    david wolf Guest

    Can you let me know which jar file I should include in the classpath?

    Thanks Philip,

    David
    Philip Reimer wrote:
    > david wolf schrieb:
    > >
    > > How to import Stateless annotation?
    > >
    > > By the way, at the beginning of the code, I import the following only:
    > >
    > > import javax.ejb.*;
    > >
    > > Should I put another import statement there, then what is that import
    > > statement?

    >
    > The import should be fine. But you need to add the class-files (most
    > probably contained in a jar-file) to the classpath when compiling.
    >
    > HTH
     
    david wolf, Dec 7, 2006
    #5
  6. david wolf

    david wolf Guest

    By the way, I am using jboss 4.0.4.

    If any one let me know which jar file has this inside, that will be
    great.

    David
    david wolf wrote:
    > Can you let me know which jar file I should include in the classpath?
    >
    > Thanks Philip,
    >
    > David
    > Philip Reimer wrote:
    > > david wolf schrieb:
    > > >
    > > > How to import Stateless annotation?
    > > >
    > > > By the way, at the beginning of the code, I import the following only:
    > > >
    > > > import javax.ejb.*;
    > > >
    > > > Should I put another import statement there, then what is that import
    > > > statement?

    > >
    > > The import should be fine. But you need to add the class-files (most
    > > probably contained in a jar-file) to the classpath when compiling.
    > >
    > > HTH
     
    david wolf, Dec 7, 2006
    #6
  7. david wolf

    Jim Cheng Guest

    In Jboss 4.0.5, Stateless annotation is in the jar file jboss-ejb3x.jar
    I believe that it should be the same for Jboss 4.0.4 ( Do your own
    homework to verify it though.)
    However, to successfully compile and run your EJB programs,
    you may also need to a bunch of other jar files, such as:

    commons-httpclient.jar jboss-aspect-library-jdk50.jar
    jboss-ejb3x.jar jboss-remoting.jar jnpserver.jar
    concurrent.jar jboss-common.jar
    jboss-j2ee.jar jbosssx-client.jar
    jboss-aop-jdk50.jar jboss-ejb3.jar jboss.jar
    jboss-transaction.jar


    Regards,
    Jim Cheng


    david wolf wrote:
    > By the way, I am using jboss 4.0.4.
    >
    > If any one let me know which jar file has this inside, that will be
    > great.
    >
    > David
    > david wolf wrote:
    >> Can you let me know which jar file I should include in the classpath?
    >>
    >> Thanks Philip,
    >>
    >> David
    >> Philip Reimer wrote:
    >>> david wolf schrieb:
    >>>> How to import Stateless annotation?
    >>>>
    >>>> By the way, at the beginning of the code, I import the following only:
    >>>>
    >>>> import javax.ejb.*;
    >>>>
    >>>> Should I put another import statement there, then what is that import
    >>>> statement?
    >>> The import should be fine. But you need to add the class-files (most
    >>> probably contained in a jar-file) to the classpath when compiling.
    >>>
    >>> HTH

    >
     
    Jim Cheng, Dec 8, 2006
    #7
  8. david wolf

    david wolf Guest

    Thanks a lot,

    David
    Jim Cheng wrote:
    > In Jboss 4.0.5, Stateless annotation is in the jar file jboss-ejb3x.jar
    > I believe that it should be the same for Jboss 4.0.4 ( Do your own
    > homework to verify it though.)
    > However, to successfully compile and run your EJB programs,
    > you may also need to a bunch of other jar files, such as:
    >
    > commons-httpclient.jar jboss-aspect-library-jdk50.jar
    > jboss-ejb3x.jar jboss-remoting.jar jnpserver.jar
    > concurrent.jar jboss-common.jar
    > jboss-j2ee.jar jbosssx-client.jar
    > jboss-aop-jdk50.jar jboss-ejb3.jar jboss.jar
    > jboss-transaction.jar
    >
    >
    > Regards,
    > Jim Cheng
    >
    >
    > david wolf wrote:
    > > By the way, I am using jboss 4.0.4.
    > >
    > > If any one let me know which jar file has this inside, that will be
    > > great.
    > >
    > > David
    > > david wolf wrote:
    > >> Can you let me know which jar file I should include in the classpath?
    > >>
    > >> Thanks Philip,
    > >>
    > >> David
    > >> Philip Reimer wrote:
    > >>> david wolf schrieb:
    > >>>> How to import Stateless annotation?
    > >>>>
    > >>>> By the way, at the beginning of the code, I import the following only:
    > >>>>
    > >>>> import javax.ejb.*;
    > >>>>
    > >>>> Should I put another import statement there, then what is that import
    > >>>> statement?
    > >>> The import should be fine. But you need to add the class-files (most
    > >>> probably contained in a jar-file) to the classpath when compiling.
    > >>>
    > >>> HTH

    > >
     
    david wolf, Dec 13, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    1
    Views:
    704
    John C. Bollinger
    Jul 15, 2003
  2. Mumbai Joe
    Replies:
    0
    Views:
    611
    Mumbai Joe
    Jul 29, 2003
  3. Jeremy Haile

    To EJB or not to EJB

    Jeremy Haile, Sep 3, 2003, in forum: Java
    Replies:
    5
    Views:
    550
    Christopher Blunck
    Sep 10, 2003
  4. sss

    Call EJB with Annotation

    sss, Dec 2, 2006, in forum: Java
    Replies:
    0
    Views:
    311
  5. Raymond Schanks
    Replies:
    0
    Views:
    671
    Raymond Schanks
    Aug 3, 2010
Loading...

Share This Page