• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[JBoss 6.0 M1] EJB 3.0: @PostConstruct not called

 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a pretty weird and basic problem.
I have 2 session beans. One is stateful, the other one is stateless.
Both have a method which is annotated with @PostConstruct :




None returns the logs and the new value of myVar.
How come ? The @PostConstruct annotation is used to annotate a method that should be called after instantiation.
Edit :
Never mind, fixed it, the method should return void of course !
 
Yair Ivan
Greenhorn
Posts: 15
Eclipse IDE Firefox Browser Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Celinio:

The method on which the PostConstruct annotation is applied MUST fulfill all of the following criteria:


- The method MUST NOT have any parameters except in the case of EJB interceptors in which case it takes
an InvocationContext object as defined by the EJB specification.

- The return type of the method MUST be void.

- The method MUST NOT throw a checked exception.

- The method on which PostConstruct is applied MAY be public, protected, package private or private.

- The method MUST NOT be static except for the application client.

- The method MAY be final.

- If the method throws an unchecked exception the class MUST NOT be put into service except in
the case of EJBs where the EJB can handle exceptions and even recover from them.


source:
http://www.163jsp.com/help/javaee50api/javax/annotation/PostConstruct.html

By.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic