Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.1.2
    • Component/s: Assembly/Configuration
    • Labels:
      None
    • Environment:
      WINXP
      MYSQL
      Jetspeed-2.2-dev

      Description

      Hi

      I am unable to use the "CommonPortletServices.CPS_JETSPEED_POWERTOOL_FACTORY"
      When ever i try to use this service Class cast exception occurred.

      I have already made a entry in jetspeed-portlet.xml as <js:service name='Powertools'/>

        Activity

        Hide
        Scott T Weaver added a comment -

        A please verify that the jetspeed-portal-2.1.jar <strong>IS NOT</strong> present in any of your portlet applications. Having it in both the jetspeed portal application and one more portlet applications may cause this issue. Also verify that the jetspeed-portal-2.1.jar <strong>IS NOT</strong> is not part of a shared classloader (shared/lib or common/lib tomcat, APP-INF/lib in BEA) or the system classloader as this will also cause classcast exceptions. So the simple of it is: make sure that jetspeed-portal-2.1.jar is<strong>ONLY</strong> present in your jetspeed/WEB-INF/lib directory.

        Show
        Scott T Weaver added a comment - A please verify that the jetspeed-portal-2.1.jar <strong>IS NOT</strong> present in any of your portlet applications. Having it in both the jetspeed portal application and one more portlet applications may cause this issue. Also verify that the jetspeed-portal-2.1.jar <strong>IS NOT</strong> is not part of a shared classloader (shared/lib or common/lib tomcat, APP-INF/lib in BEA) or the system classloader as this will also cause classcast exceptions. So the simple of it is: make sure that jetspeed-portal-2.1.jar is<strong>ONLY</strong> present in your jetspeed/WEB-INF/lib directory.
        Hide
        David Sean Taylor added a comment -

        I thought I had a typo in the service name. I was about to fix it, but it appears that is not the case. Yes, I think Scott has a point. Please try out what Scott recommended above.

        Show
        David Sean Taylor added a comment - I thought I had a typo in the service name. I was about to fix it, but it appears that is not the case. Yes, I think Scott has a point. Please try out what Scott recommended above.
        Hide
        Vivek Kumar added a comment -

        I thought you solved my problem , but i don't include jetspeed-portal-2-2-dev.jar

        then i got this error

        Failed to load portlet ServicePortlet: java.lang.NoClassDefFoundError: org/apache/jetspeed/velocity/JetspeedPowerToolFactory

        I think Class cast exception occurs in jetspeedpowertool service as it doesn't belong to shared modules.

        Show
        Vivek Kumar added a comment - I thought you solved my problem , but i don't include jetspeed-portal-2-2-dev.jar then i got this error Failed to load portlet ServicePortlet: java.lang.NoClassDefFoundError: org/apache/jetspeed/velocity/JetspeedPowerToolFactory I think Class cast exception occurs in jetspeedpowertool service as it doesn't belong to shared modules.
        Hide
        Scott T Weaver added a comment -

        So, is the NoClassDef happening in the portal (jetspeed) itself or one of your portlet applications?

        Show
        Scott T Weaver added a comment - So, is the NoClassDef happening in the portal (jetspeed) itself or one of your portlet applications?
        Hide
        David Sean Taylor added a comment -

        I needed to add an API for the JetspeedPowerToolFactory, then you must use this interface in your portlet code, not the implementation from the jetspeed-portal jar.
        In your portlet you can now safely request the JetspeedPowerToolFactory as:

        import org.apache.jetspeed.layout.JetspeedPowerToolFactory;
        ...
        JetspeedPowerToolFactory powerToolFactory =
        (JetspeedPowerToolFactory;)getPortletContext().getAttribute(CommonPortletServices.CPS_JETSPEED_POWERTOOL_FACTORY);

        Show
        David Sean Taylor added a comment - I needed to add an API for the JetspeedPowerToolFactory, then you must use this interface in your portlet code, not the implementation from the jetspeed-portal jar. In your portlet you can now safely request the JetspeedPowerToolFactory as: import org.apache.jetspeed.layout.JetspeedPowerToolFactory; ... JetspeedPowerToolFactory powerToolFactory = (JetspeedPowerToolFactory;)getPortletContext().getAttribute(CommonPortletServices.CPS_JETSPEED_POWERTOOL_FACTORY);
        Hide
        Ate Douma added a comment -

        David,

        The build for the jetspeed-api is broken as result of adding the new o.a.j.layout.JetspeedPowerToolFactory interface.
        It depends on the jetspeedPowerTool interface which still is defined in the jetspeed-portal component.
        Although moving that interface to the jetspeed-api would seem easy enough the do, there is a caveat: it exposes the commons-configuration Configuration class.
        And because the jetspeed-api needs to be deployed in the shared/lib context, it would pull in the commons-configuration there too, which we definitely don't want (not even can).

        So, this solution more or less isn't going to work out and we need to think of some workaround for it.
        Changing the JetspeedPowerTool interface to not expose commons-configuration might be a way to do it, but I'm not sure that's feasible.

        I've scanned the (Java) code for usage of the specific method: Configuration getTypeConfiguration(String type, String name, String location), and have found none, but maybe there are extensions out there which might use it?
        If not, we could opt for changing the interface and return a Properties object instead.

        WDYT?

        Show
        Ate Douma added a comment - David, The build for the jetspeed-api is broken as result of adding the new o.a.j.layout.JetspeedPowerToolFactory interface. It depends on the jetspeedPowerTool interface which still is defined in the jetspeed-portal component. Although moving that interface to the jetspeed-api would seem easy enough the do, there is a caveat: it exposes the commons-configuration Configuration class. And because the jetspeed-api needs to be deployed in the shared/lib context, it would pull in the commons-configuration there too, which we definitely don't want (not even can). So, this solution more or less isn't going to work out and we need to think of some workaround for it. Changing the JetspeedPowerTool interface to not expose commons-configuration might be a way to do it, but I'm not sure that's feasible. I've scanned the (Java) code for usage of the specific method: Configuration getTypeConfiguration(String type, String name, String location), and have found none, but maybe there are extensions out there which might use it? If not, we could opt for changing the interface and return a Properties object instead. WDYT?
        Hide
        Ate Douma added a comment -

        Changed the Priority to Blocker as the current changes made for this issue result in a broken build

        Show
        Ate Douma added a comment - Changed the Priority to Blocker as the current changes made for this issue result in a broken build
        Hide
        David Sean Taylor added a comment -

        WDIT? remove the Configuration dependency in the API, going to try now....

        Show
        David Sean Taylor added a comment - WDIT? remove the Configuration dependency in the API, going to try now....
        Hide
        David Sean Taylor added a comment -

        moved the JetspeedPowerTool interface to the api
        JetspeedVelocityPowerTool extends JetspeedPowerTool for Velocity specific operations
        removed dependencies on Commons Configuration
        please see if it works for you, if so, close the issue

        Show
        David Sean Taylor added a comment - moved the JetspeedPowerTool interface to the api JetspeedVelocityPowerTool extends JetspeedPowerTool for Velocity specific operations removed dependencies on Commons Configuration please see if it works for you, if so, close the issue
        Hide
        Ate Douma added a comment -

        Yes, its working again, thanks David.

        Show
        Ate Douma added a comment - Yes, its working again, thanks David.

          People

          • Assignee:
            David Sean Taylor
            Reporter:
            Vivek Kumar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development