<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: Using ejb-jar.xml for @Singleton bean
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/benoit.heinrich">Benoit Heinrich</a> in <i>EJB3</i> - <a href="http://community.jboss.org/message/587183#587183">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi Jaikiran,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've tried the suggested approach but unfortunately it doesn't work.</p><p>There is no error in the logs, but the startup postcontruct method isn't fired.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Here is the new class I've used:</p><p>package com.example.services.startup;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>import com.example.services.version.VersionManager;</p><p>import org.apache.commons.logging.Log;</p><p>import org.apache.commons.logging.LogFactory;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>import javax.annotation.PostConstruct;</p><p>import javax.ejb.Singleton;</p><p>import javax.ejb.Startup;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>@Singleton</p><p>@Startup</p><p>public class StartupBean {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; private static final Log log = LogFactory.getLog(StartupBean.class);</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; private VersionManager versionManager;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; @PostConstruct</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public void startup() {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; log.info("System started (version " + versionManager.getVersion() + ")");</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>And here is the output from jboss:</p><p>10:15:19,793 INFO&#160; <a class="jive-link-external-small" href="org.jboss.deployment.dependency.ContainerDependencyMetaData">org.jboss.deployment.dependency.ContainerDependencyMetaData</a> addJndiDependency, JndiDependencyMetaData@e32434{01-services/VersionManagerBean/local}</p><p>10:15:19,795 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.deployers.Ejb3DependenciesDeployer">org.jboss.ejb3.deployers.Ejb3DependenciesDeployer</a> Encountered deployment AbstractVFSDeploymentContext@22312589<span></span></p><p>10:15:19,795 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.deployers.Ejb3DependenciesDeployer">org.jboss.ejb3.deployers.Ejb3DependenciesDeployer</a> Encountered deployment AbstractVFSDeploymentContext@22312589<span></span></p><p>10:15:19,811 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.instantiator.deployer.BeanInstantiatorDeployerBase">org.jboss.ejb3.instantiator.deployer.BeanInstantiatorDeployerBase</a> Installed org.jboss.ejb3.instantiator.impl.Ejb31SpecBeanInstantiator@42791a into MC at org.jboss.ejb.bean.instantiator/99-startup/startup-1.19.0-SNAPSHOT/StartupBean</p><p>10:15:19,811 WARN&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.interceptor.InterceptorInfoRepository">org.jboss.ejb3.interceptor.InterceptorInfoRepository</a> EJBTHREE-1852: InterceptorInfoRepository is deprecated</p><p>10:15:19,841 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer">org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer</a> Installing container for EJB StartupBean</p><p>10:15:19,841 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer">org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer</a> with dependencies: </p><p>10:15:19,841 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer">org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer</a> with demands: </p><p>10:15:19,841 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer">org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer</a> jboss-injector:topLevelUnit=99-startup.ear,unit=startup-1.19.0-SNAPSHOT.jar,bean=StartupBean</p><p>10:15:19,841 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer">org.jboss.ejb3.singleton.deployer.SingletonContainerDeployer</a> with supplies: </p><p>10:15:19,843 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.singleton.deployer.SingletonBeanJNDIBinderDeployer">org.jboss.ejb3.singleton.deployer.SingletonBeanJNDIBinderDeployer</a> Binding the following entries in JNDI for singleton bean: StartupBean</p><p>10:15:19,875 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.session.SessionSpecContainer">org.jboss.ejb3.session.SessionSpecContainer</a> Starting jboss.j2ee:ear=99-startup.ear,jar=startup-1.19.0-SNAPSHOT.jar,name=StartupBean,service=EJB3</p><p>10:15:19,875 WARN&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.session.SessionSpecContainer">org.jboss.ejb3.session.SessionSpecContainer</a> EJBTHREE-2126: container jboss.j2ee:ear=99-startup.ear,jar=startup-1.19.0-SNAPSHOT.jar,name=StartupBean,service=EJB3 does not verify the businessObjectFactory</p><p>10:15:19,876 INFO&#160; <a class="" href="http://community.jboss.org/message/587183#587183">Re: Using ejb-jar.xml for @Singleton bean</a> STARTED EJB: com.example.services.startup.StartupBean ejbName: StartupBean</p><p>10:15:19,876 WARN&#160; <a class="" href="http://community.jboss.org/message/587183#587183">Re: Using ejb-jar.xml for @Singleton bean</a> EJBTHREE-2193: using deprecated TimerServiceFactory for restoring timers</p><p>10:15:19,898 INFO&#160; <a class="jive-link-external-small" href="org.jboss.ejb3.nointerface.impl.jndi.AbstractNoInterfaceViewBinder">org.jboss.ejb3.nointerface.impl.jndi.AbstractNoInterfaceViewBinder</a> Binding the following entry in Global JNDI for bean:StartupBean</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;99-startup/StartupBean/no-interface -&amp;gt; EJB3.1 no-interface view</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Do you see anything wrong I'am doing here?</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/587183#587183">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in EJB3 at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>