Uploaded image for project: 'PUBLIC - Liferay IDE'
  1. PUBLIC - Liferay IDE
  2. IDE-330

NoClassDefFoundError after updating Hook

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.2.2
    • 1.3
    • Projects
    • None
    • Eclipse Helios and IDE 1.2.2

    Description

      After updating a hook Liferay will crash with a NoClassDefFoundError. Any single class that is used in the hook itself cannot be loaded.

      Steps to reproduce with a simple hook that only does some logging:

      Create a new Hook project, then create a new Hook. Select "Portal properties" for the hooktype and click Next. On "Specify properties to override" select add. For property use auto.login.hooks and type in a classname for value (e.g. com.test.TestHook) and press OK. Press Finish. Create a new class (e.g. com.test.TestHook) and use the following code:

      package com.test;

      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;

      import com.liferay.portal.kernel.log.Log;
      import com.liferay.portal.kernel.log.LogFactoryUtil;
      import com.liferay.portal.model.User;
      import com.liferay.portal.security.auth.AutoLogin;
      import com.liferay.portal.security.auth.AutoLoginException;

      public class TestHook implements AutoLogin {
      private static final Log _log = LogFactoryUtil.getLog(TestHook.class);

      @Override
      public String[] login(HttpServletRequest req, HttpServletResponse response)
      throws AutoLoginException

      { String[] credentials = null; _log.info("Hook test"); return credentials; }

      }

      Now start the server and open a browser to it. You should see the text "Hook test" in the Eclipse console. Now just change the log text a few times and save it. Eclipse will auto redeploy the hook. Now refresh the page in your browser. Change the text again, save and refresh your browser. Usually Liferay will now crash with a NoClassDefFoundError on com.liferay.portal.kernel.log.Log. On a clean Eclipse EE install with the Liferay IDE plugin it crashes on my system usually the first time the hook is auto-redeployed. Sometimes it takes a bit longer, but no more then a few tries,.

      Attachments

        Activity

          People

            gregory.amerson Gregory Amerson
            creepy Paul Bosselaar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11 years, 21 weeks, 2 days ago

              Packages

                Version Package
                1.3