0 Replies Latest reply on Sep 15, 2015 3:42 AM by Pavan Sharma

    spring bean setter is not working in jboss. Injected bean is getting null while invoking

    Pavan Sharma Newbie

      I am getting one class instance while not for other in same class and defined in same config.xml file. This is working fine when deployed on webSphere & Tomcat but creating issue on Jboss EAP 6.3.

      1. I have one auth.xml config file that contains below

      <bean id="loginController" class="com.abc.mvc.controller.auth.LoginController"
      parent="abcAbstractCommandController">
      <property name="spAuthOperation" ref="spAuthOperation" />
      <property name="commandName" value="loginCommand" />
      <property name="commandClass"
      value="com.abc.mvc.command.auth.LoginCommand" />
      <property name="validator" ref="loginValidator" />
      <property name="otpAuthJSONBldr" ref="otpAuthJSONBldr" />
      </bean>

      <bean id="otpAuthJSONBldr"
      class="com.abc.json.builder.auth.OTPAuthJSONBldr"
      parent="comJSONBuilder" />

      2. LoginController.java; In this class i have injected one operation and one jsonBldr that is defined in auth.xml config file.

      public class LoginController extends AbstractCommandController {

      SPAuthOperation spAuthOperation;

      private ABCJSONBuilder otpAuthJSONBldr;

      public SPAuthOperation getspAuthOperation()

      { return spAuthOperation; }

      public void setspAuthOperation(SPAuthOperation spAuthOperation)

      { this.spAuthOperation = spAuthOperation }

      public ABCJSONBuilder getOtpAuthJSONBldr()

      { return otpAuthJSONBldr; }

      public void setOtpAuthJSONBldr(ABCJSONBuilder otpAuthJSONBldr1)

      { this.otpAuthJSONBldr = otpAuthJSONBldr1; }

      }

      now when i am trying to invoke logincontroller thru my application then getting spAuthOperation class instance but not otpAuthJSONBldr. this is strange thing.

      Below is the Jboss trace log where also getting 'otpJsonBldr' instance created on server startup but then not getting at runtime and application invocation..

      2015-09-14 12:38:17,656 [ServerService Thread Pool -- 59] TRACE - Found bean property 'otpAuthJSONBldr' of type [com.abc.json.builder.auth.ABCJSONBuilder]
      Creating shared instance of singleton bean 'otpAuthJSONBldr'
      2015-09-14 12:38:21,833 [ServerService Thread Pool -- 59] DEBUG - Creating instance of bean 'otpAuthJSONBldr'
      2015-09-14 12:38:21,834 [ServerService Thread Pool -- 59] DEBUG - Eagerly caching bean 'otpAuthJSONBldr' to allow for resolving potential circular references
      2015-09-14 12:38:21,835 [ServerService Thread Pool -- 59] TRACE - Getting BeanInfo for class [com.abc.json.builder.auth.otpAuthJSONBldr]
      2015-09-14 12:38:21,837 [ServerService Thread Pool -- 59] TRACE - Caching PropertyDescriptors for class [com.abc.json.builder.authotpAuthJSONBldr]


      Creating implicit proxy for bean 'otpAuthJSONBldr' with 1 common interceptors and 0 specific interceptors
      2015-09-14 12:38:21,863 [ServerService Thread Pool -- 59] DEBUG - Creating CGLIB2 proxy: target source is SingletonTargetSource for target object[com.abc.json.builder.auth.otpAuthJSONBldr@10b53e6]
      2015-09-14 12:38:21,863 [ServerService Thread Pool -- 59] DEBUG - Unable to apply any optimisations to advised method: protected com.abc.json.builder.auth.ABCPayloadHeader com.abc.json.builder.authotpAuthJSONBldr.createHeader(com.abc.json.builder.auth.context.ResponseContext)
      2015-09-14 12:38:21,864 [ServerService Thread Pool -- 59] DEBUG - Unable to apply any optimisations to advised method: public java.lang.Object com.abc.json.builder.auth.otpAuthJSONBldr.createJSONResponse(com.abc.json.builder.auth.context.ResponseContext)
      2015-09-14 12:38:21,864 [ServerService Thread Pool -- 59] DEBUG - Unable to apply any optimisations to advised method: protected void com.abc.json.builder.auth.otpAuthJSONBldr.populatePayLoad

      2015-09-14 12:38:21,882 [ServerService Thread Pool -- 59] DEBUG - Finished creating instance of bean 'otpAuthJSONBldr'

      Need input on urgent basis.....

      Thanks In advance