I am creating a JSF web project which has an EJB as the managed bean. I am running the project on Apache Tomcat server. But I have to make one of the EJB classes a singleton. I am trying to use the annotation @Singleton
, it is not supported in my Eclipse. But I am able to use the @EJB
annotation. Is there a solution for this?
Asked
Active
Viewed 394 times
0
-
Similar one, can refer http://stackoverflow.com/q/4304757/366964 – Nayan Wadekar Dec 03 '12 at 07:18
-
2Please don't format programming terms, framework names, library names, software bundle names, etc as code. It's not code at all! I also checked your [suggested edit history](http://stackoverflow.com/users/1586628/rajath?tab=activity&sort=suggestions); you're such one user who incorrectly formats everything *slightly* related to programming as code. Please stop doing that. Only format real code (whatever you also *actually* use in code, such as `@Singleton` and `@EJB`) as code :) – BalusC Dec 03 '12 at 11:57
-
2See [TomEE](http://tomee.apache.org) and this video tutorial that uses [EJBs in Eclipse using the Tomcat Adapter](http://www.youtube.com/watch?v=Lr8pxEACVRI) – David Blevins Dec 03 '12 at 22:51
-
@BalusC Will take your suggestion. – Rajath Dec 04 '12 at 04:27
-
@DavidBlevins Tried TomEE, but still not able to use `@Inject`. The video says I have to create a beans.xml, which I have done. Yet, it's not supported. Any idea why that might me happening? – Rajath Dec 04 '12 at 05:38
-
Got it! Added @Inject jar from http://code.google.com/p/atinject/. – Rajath Dec 04 '12 at 05:59
-
@Rajath You shouldn't have had to do that. The (@)Inject library is in the javaee-api jar that is in the tomcat/lib/ directory and should be included automatically for you by Eclipse when using the Tomcat adapter. I demo that all the time and have never had any issues with missing libraries. Are you using the EE version of Eclipse? – David Blevins Dec 04 '12 at 06:24
-
@DavidBlevins Yes, it is the EE version. – Rajath Dec 04 '12 at 08:04