This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes @Startup annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@Startup annotation" Watch "@Startup annotation" New topic
Author

@Startup annotation

Laura Barroso
Ranch Hand

Joined: Sep 21, 2009
Posts: 30
Hi, I'm looking information about the @Startup annotation but I have not success...does anyone know how to use this annotation???
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

@Startup is a new concept introduced in EJB3.1 spec. The spec will have more details about its usage.

[My Blog] [JavaRanch Journal]
Laura Barroso
Ranch Hand

Joined: Sep 21, 2009
Posts: 30
I was wondering if there is any other similar annotation for ejb 3.0... ???
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
There are Bean Lifecycle Callbacks. For example, Stateless session beans have PostConstruct and PreDestroy while Statefull session beans have those, plus PrePassivate and PostActivate. Do these give you what you want?
Laura Barroso
Ranch Hand

Joined: Sep 21, 2009
Posts: 30
No, they don't...What I'm looking for is an annotation that gives me the oportunity for make a call to a business function that I have in my app, but I only need to make this call when I'm deploying my app, the problem now with @Startup is that is only available in ejb 3.1 and my app is in ejb 3.0, so I'm looking for alternatives...One friend of mine says that maybe I could resolve my problem with @Service, but I haven't found much information, does anyone have an example or doc about this annotation???
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

Laura Barroso wrote:One friend of mine says that maybe I could resolve my problem with @Service, but I haven't found much information, does anyone have an example or doc about this annotation???


JBoss specific EJB3.0 @Service allows that to be done. See chapter "Service POJOs (JBoss extension of EJB3)" in the JBoss EJB3 tutorial
Laura Barroso
Ranch Hand

Joined: Sep 21, 2009
Posts: 30
Perfect! just one more question... what library should I include in my code in order to get this annotation work...because netBeans doesn't appear to recognize org.jboss.annotation.Service or org.jboss.annotation.ejb.Management...so what libraries should I include???
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9927
    
158

Do you have JBoss AS installed? The jar will be available in JBOSS_HOME/client folder. The jar is named jboss-ejb3-ext-api.jar.
Laura Barroso
Ranch Hand

Joined: Sep 21, 2009
Posts: 30
problem solve, thank you very much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @Startup annotation
 
Similar Threads
@PostConstruct is never called.
MDB : dynamic selector
What order will multiple @Startup beans be started in?
EAR post install hook to run a class?
How to perform some operation on Container/Application start