<!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="https://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;">
    Barrier service restart and dependency injection
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/mashiur.rahman">MUHAMMAD MASHIUR RAHMAN</a> in <i>EJB3 Development</i> - <a href="https://community.jboss.org/message/729625#729625">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p><span style="font-family: times new roman,times; font-size: 12pt;">I have a service depends on jboss.ha:service=HASingletonDeployer,type=Barrier</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">When I stop the Barrier from jmx-console, my service also stopped and destroyed as well. </span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">Then if I start the barrier from jmx-console, the create method of the service is called two times then start method is called but jboss doesn't inject any dependency.</span></p><p>&#160; </p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160; @Resource</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160; public TimerService timerService;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160; @Resource</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160; public SessionContext sessionContext;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; </p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160; @PersistenceContext</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160; public EntityManager mEm;</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160; From service start method I found timerService,mEm, sessionContext everything is null.&#160; Can anyone please help me why this is happening?</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> <span style="font-size: 12pt; font-family: times new roman,times;">When I stop the barrier from jmx-console, I get follwing messages in my log&#160; </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-size: 12pt; font-family: times new roman,times;">2012-04-12 17:05:27,141 INFO&#160; [STDOUT] (http-0.0.0.0-8080-1) SingletonBarrierService stopped</span></p><p><span style="font-size: 12pt; font-family: times new roman,times;">2012-04-12 17:05:27,150 INFO&#160; [org.jboss.ejb3.EJBContainer] (http-0.0.0.0-8080-1) STOPPED EJB: adactus.diactus.cluster.ejb.service.SingletonBarrierService ejbName: SingletonBarrierService</span></p><p><span style="font-size: 12pt; font-family: times new roman,times;">2012-04-12 17:05:27,151 INFO&#160; [STDOUT] (http-0.0.0.0-8080-1) SingletonBarrierService destroyed</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: times new roman,times; font-size: 12pt;">Then if start again I get the messages below..</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,174 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1) installing bean: diactus:service=singletonBarrierService</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,174 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160; with dependencies:</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160; and demands:</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; jboss.j2ee:ear=clusterTest.ear,jar=clusterTestEJB.jar,name=SingletonBarrierService,service=EJB3</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; jboss.ejb:service=EJBTimerService</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; persistence.unit:unitName=clusterTest.ear/clusterTestEJB.jar#clusterTestEJB</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; jboss.ha:service=HASingletonDeployer,type=Barrier</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160; and supplies:</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; Class:adactus.diactus.cluster.ejb.service.HASingletonServiceRemote</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; Class:adactus.diactus.cluster.timer.StaticEJBTimerOwner</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; jndi:clusterTest/SingletonBarrierService/local-adactus.diactus.cluster.timer.StaticEJBTimerOwner</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; jndi:clusterTest/SingletonBarrierService/remote-adactus.diactus.cluster.ejb.service.HASingletonServiceRemote</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; jndi:clusterTest/SingletonBarrierService/remote</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,175 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1)&#160;&#160;&#160; jndi:clusterTest/SingletonBarrierService/local</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 16:56:39,176 INFO&#160; [org.jboss.ejb3.deployers.JBossASKernel] (http-0.0.0.0-8080-1) Installing bean(diactus:service=singletonBarrierService) into kernel</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 17:04:48,980 INFO&#160; [org.jboss.ejb3.EJBContainer] (http-0.0.0.0-8080-1) STARTED EJB: adactus.diactus.cluster.ejb.service.SingletonBarrierService ejbName: SingletonBarrierService</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 17:04:49,005 INFO&#160; [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] (http-0.0.0.0-8080-1) Binding the following Entries in Global JNDI:</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; clusterTest/SingletonBarrierService/remote - EJB3.x Default Remote Business Interface</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; clusterTest/SingletonBarrierService/remote-adactus.diactus.cluster.ejb.service.HASingletonServiceRemote - EJB3.x Remote Business Interface</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; clusterTest/SingletonBarrierService/local - EJB3.x Default Local Business Interface</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; clusterTest/SingletonBarrierService/local-adactus.diactus.cluster.timer.StaticEJBTimerOwner - EJB3.x Local Business Interface</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 17:04:49,013 INFO&#160; [STDOUT] (http-0.0.0.0-8080-1) SingletonBarrierService starting</span></p><p><span style="font-family: times new roman,times; font-size: 12pt;">2012-04-12 17:04:49,013 INFO&#160; [STDOUT] (http-0.0.0.0-8080-1) SingletonBarrierService started</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span style="font-family: times new roman,times;"><span style="font-size: 14pt;">But no dependency is being injected.</span><br/></span></p></div>

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


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

</div>

</body>
</html>