[jboss-user] [EJB3] - @PostConstruct not inoked in ear packaging
Tomas Bartalos
do-not-reply at jboss.com
Thu Jun 30 07:10:58 EDT 2011
Tomas Bartalos [http://community.jboss.org/people/barti] created the discussion
"@PostConstruct not inoked in ear packaging"
To view the discussion, visit: http://community.jboss.org/message/612722#612722
--------------------------------------------------------------
Hi,
I have a very basic problem. I have an ejb with *@PostConstruct annotated method*. When I deploy this ejb packaged as jar to jboss, everything works fine.
But when I package my ejb to ear archive, the *@Postconstruct method is never invoked.*
This means there must be something wrong with my ear packaging, but I have no idea what is the problem.
Here follows my ejb:
@Stateless
public class TestBeanImpl implements TestBean{
public TestBeanImpl() {
System.out.println("Test bean was instantiated");
}
@PostConstruct
public void afterConstruction() {
System.out.println("Test bean after construction");
}
@Override
public void performTest() {
System.out.println("Test was performed");
}
}
When I invoke performTest() method in jar packaging, the output is:
Test bean was instantiated
Test was performed
*But when I invoke performTest() in ear packaging, the output is:*
Test bean was instantiated
Test bean after construction
Test was performed
Here follows my ear package structure:
/
-- lib
--META-INF
/--application.xml
--postconstruct-test-ejb.jar
Here is my content of application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application>
<display-name>postconstruct-test-ear</display-name>
<module>
<ejb>postconstruct-test-ejb.jar</ejb>
</module>
</application>
*My jboss version: Jboss 6.0.0.Final*
I really don't know what is wrong here, please help
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/612722#612722]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110630/87aab4d5/attachment.html
More information about the jboss-user
mailing list