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