6 Replies Latest reply on Jun 5, 2007 11:08 AM by julien1

    xwiki-1.0.war on JBoss Portal as a portlet

    advaittrivedi

      Hi All,

      I am required to run xwiki as portlet on JBoss Portal. I have deployed xwiki-1.0.war in JBoss Portal's server/default/deploy/xwiki directory as specified in http://www.xwiki.org/xwiki/bin/view/AdminGuide/InstallationJBoss. I have also configured MySQL as specified in http://www.xwiki.org/xwiki/bin/view/AdminGuide/InstallationMySQL. But when in start JBoss Portal I get:

      18:06:49,573 ERROR [AbstractKernelController] Error installing to Start: name=portal:container=Portlet,id=/xwiki-1.0.xwiki state=Createorg.jboss.portal.portlet.container.PortletInitializationException: The portlet xwiki threw a runtime exception during init
      at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:285)
      at org.jboss.portal.portlet.container.PortletContainerAdapter.start(PortletContainerAdapter.java:72)
      at sun.reflect.GeneratedMethodAccessor165.invoke(Unknown Source)
      Caused by: java.lang.ClassCastException: com.xpn.xwiki.web.XWikiPortlet
      at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:247)
      ... 147 more

      My JBoss AS is v4.0.5.GA. Cant figure out the reason behind ClassCastException. I have also got jspwiki configured and it is running OK as a portlet.

      Thanks & Regards,

        • 1. Re: xwiki-1.0.war on JBoss Portal as a portlet
          soshah

          Try the following configuration:

          1/ Go to deploy/jbossweb-tomcat.sar/META-INF/jboss-service.xml and change the value
          of UserJBossWebLoader from false to true.

          See by doing this, if your ClassCastException goes away

          Thanks

          • 2. Re: xwiki-1.0.war on JBoss Portal as a portlet
            advaittrivedi

            thanks sohil.
            yes it worked, cce is no more.

            But how when i put the portlet on page and run it i get:

            com.xpn.xwiki.XWikiException: Error number 11007 in 11: Exception while getting URL from request


            Wrapped Exception:


            java.lang.NullPointerException
            at com.xpn.xwiki.XWiki.getRequestURL(XWiki.java:464)
            at com.xpn.xwiki.web.Utils.prepareContext(Utils.java:203)
            at com.xpn.xwiki.web.XWikiPortlet.prepareContext(XWikiPortlet.java:58)
            at com.xpn.xwiki.web.XWikiPortlet.doView(XWikiPortlet.java:259)

            Any idea? I will be putting this to xwiki forums also.

            • 3. Re: xwiki-1.0.war on JBoss Portal as a portlet

              XWiki portlet cannot run in JBoss Portal without modifications.

              Actually XWiki wants to access the requet URL

              Since the request URL is not provided by the PortletRequest, it has an abstraction to get the request URL by using hacks like a cast to a specific class from portal vendors.

              That has not been implemented for JBoss Portal.

              You should look at the source code of xwiki and see if you can recompile with the following modification:

              In the class com.xpn.xwiki.web.XWikiPortletRequest there is a getHttpServletRequest() method. You should try to add the following code:


              if (request.getSession().getPortletContext().getServerName().equals("JBossPortal/1.0")))
              {
               Class clazz = Thread.currentThread().getContextClassLoader().loadClass("org.jboss.portal.bridge.JBossServletContextProvider");
               Method getHttpServletRequest = clazz.getMethod("getHttpServletRequest", new Class[]{GenericPortlet.class,PortletRequest.class};
               return (HttpServletRequest)getHttpServletRequest.invoke(null, new Object[]{null,portletRequest});
              }
              


              That should fix that first issue you are having.


              • 4. Re: xwiki-1.0.war on JBoss Portal as a portlet

                Other thing you should do rather is to remove the portlet.jar that must be in the xwiki war file.

                "advaittrivedi" wrote:
                Hi All,

                I am required to run xwiki as portlet on JBoss Portal. I have deployed xwiki-1.0.war in JBoss Portal's server/default/deploy/xwiki directory as specified in http://www.xwiki.org/xwiki/bin/view/AdminGuide/InstallationJBoss. I have also configured MySQL as specified in http://www.xwiki.org/xwiki/bin/view/AdminGuide/InstallationMySQL. But when in start JBoss Portal I get:

                18:06:49,573 ERROR [AbstractKernelController] Error installing to Start: name=portal:container=Portlet,id=/xwiki-1.0.xwiki state=Createorg.jboss.portal.portlet.container.PortletInitializationException: The portlet xwiki threw a runtime exception during init
                at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:285)
                at org.jboss.portal.portlet.container.PortletContainerAdapter.start(PortletContainerAdapter.java:72)
                at sun.reflect.GeneratedMethodAccessor165.invoke(Unknown Source)
                Caused by: java.lang.ClassCastException: com.xpn.xwiki.web.XWikiPortlet
                at org.jboss.portal.portlet.container.PortletContainer.start(PortletContainer.java:247)
                ... 147 more

                My JBoss AS is v4.0.5.GA. Cant figure out the reason behind ClassCastException. I have also got jspwiki configured and it is running OK as a portlet.

                Thanks & Regards,


                • 5. Re: xwiki-1.0.war on JBoss Portal as a portlet
                  advaittrivedi

                  I had a look at WEB-INF/lib of xwiki war, but was unable to find portlet.jar !! Though a portlet-api.jar file is there, is this what you meant in your reply?

                  Also, I will try to modify xwiki code as per your suggestion, but right now facing some subversion issue and unable to download source :(

                  Thanks & Regards

                  • 6. Re: xwiki-1.0.war on JBoss Portal as a portlet

                    yes I meant the jar that contains javax.portlet.* classes.

                    their SVN is a bit messy and their 1.0 downloads does not seem to contain the source code.

                    I used the user dev alias to download a trunk version of xwiki and looked at the source code briefly. I don't know what is the URI for the 1.0 release.