ejb annotation

D

david wolf

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
 
D

david wolf

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?
david wolf said:
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. :)
 
P

Philip Reimer

david said:
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
 
T

Tor Iver Wilhelmsen

david wolf said:
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. :)
 
D

david wolf

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

Thanks Philip,

David
 
D

david wolf

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
 
J

Jim Cheng

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
 
D

david wolf

Thanks a lot,

David
Jim said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top