0

I have been working with this code for few days and I getting the Null Pointer Exception all the time. I am using struts2.3.x and Hibernate v5.x along with Full-hibernate-plugin. it's a simple login module, As the User login the following package with action is invoked,

<package name="<your_package_name>" namespace="/" extends="struts-default">
        <action name="Login" class="<class url>.LoginAction" method="fn_Redirect_OAuth">
            <result name="success" type="redirectAction">
                <param name="actionName">user/Authenticate</param>
                <param name="_strUsername">${_objLoginModal.get_strUsername()}</param>
                <param name="_strPassword">${_objLoginModal.get_strPassword()}</param>
            </result>
        </action>
    </package>

After the successful return form the action I am redirecting the action to another package with another action as you can see above. And that package is a hibernate-default extended package,which is as follow

<package name="<your_package_name>" namespace="/user" extends="hibernate-default">
  <action name="Authenticate" class="<class_url>.LoginAction" method="fn_Login_User">
    <interceptor-ref name="basicStackHibernate"></interceptor-ref>
    <result name="success" type="redirect">../mail/de/inbox</result>
    <result name="input">login.jsp</result>
    <result name="error">error.jsp</result>
  </action>
</package>

And when I am trying to access the parameters(Which i passed from the previous action) I am getting the Null Pointer Exception.

Does anyone have any idea about it? as I am new to Hibernate and Full-hibernate-plugin please do help. Thanks in Advance.

Sebin Thomas
  • 269
  • 5
  • 15
  • Full Hibernate Plugin plugin is from 2010. *This plugin is compatible with Hibernate Validator 3.1.0 and 4.0.2 (since 2.2 version).* Dump it. – Aleksandr M Apr 04 '16 at 07:50
  • Yes, and i am using Hibernate Validator 4.0.2 – Sebin Thomas Apr 04 '16 at 07:54
  • @AndreaLigios NPE can be unrelated to fhp. Take a look at action declarations. – Aleksandr M Apr 04 '16 at 08:01
  • 1
    @AleksandrM reopened. But it's probably a missing getter or something like that... I'd still consider more useful to drop the plugin that to fix the bug :D – Andrea Ligios Apr 04 '16 at 08:16
  • @Zionz please post your action attribute objModal with its getter / setter, and the objModal object, thanks – Andrea Ligios Apr 04 '16 at 08:23
  • Also read this Q&A related to [Struts2 + FullHibernatePlugin](http://stackoverflow.com/questions/31554922/is-struts2-full-hibernate-plugin-the-standard-way-to-integrate-struts2-and-hiber) – Andrea Ligios Apr 04 '16 at 08:25
  • This question does not appear to be about programming within the scope defined in the [help center](http://stackoverflow.com/help/on-topic). – Roman C Apr 05 '16 at 08:44
  • I have solved the problem removing the plugin.Now its working fine.But i wanna know why there was NULL Pointer Exception arose , Fyi I have used the ModalDriven<> interface to get the values and it does have getter and setter.And if I change the second package to struts-default i can access the variables.But then the Hibernate Session will be NULL – Sebin Thomas Apr 05 '16 at 10:38

0 Answers0