1 Reply Latest reply on Oct 11, 2011 7:30 AM by beve

    How to use Eclipse Infocenter WAR with AS7?

    erlend1963

      I am using Eclipse Iinfocenter to provide Online Help for an application. The Infocenter is an integral part of any Eclipse distribution, it is the mechanism which delivers help and documentation for Eclipse; most Eclipse users will have seen it. You can run the Infocenter on its own and provide your own documentation as plugins to the Infocenter; we use this feature to get a professional looking frame around our web documentation (plus features such as full text search, table-of-contents synchronisation, highlighting etc). The infocenter.war file I use is consequently a collection of jars from a regular Eclipse distribution, combined with my documentation in the plugins directory. I don't do any programming or coding on my own per se, I just provide text files for the documentation, jar it up together with the jars from Eclipse, deploy and then I can access the documents from http://localhost:8080/infocenter/index.jsp.

       

      The problem is that my infocenter.war runs fine in JBoss 4, Tomcat 5, Tomcat 6, while it fails when invoked in JBoss 5.1.0, JBoss 6.0, JBoss 7.0 and Tomcat 7. The JBoss error messages are as follows:

      • JBoss 7.0 (error message: org.eclipse.equinox.jsp.jasper.JspServlet cannot be cast to javax.servlet.Servlet)
      • JBoss 6.0 (error message: java.lang.ClassCastException: org.eclipse.equinox.jsp.jasper.JspServlet cannot be cast to javax.servlet.Servlet)
      • JBoss 5.1.0 (error message: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor)

      I have no idea of what could be wrong - maybe some prereq library was available in JBoss 4, but not in later versions, or maybe newer JBoss versions are pickier and fail on things that JBoss 4 silently accepted.

       

      I have enclosed an example infocenter.war, which contains a tiny documentation set. My stuff can be found in /WEB-INF/plugins/bct and ./help-map, the rest is from Eclipse. Any help in solving this is highly appreciated; I would very much like to upgrade the old JBoss 4.0 instance we use today for delivering the documentation via Infocenter.

        • 1. Re: How to use Eclipse Infocenter WAR with AS7?
          beve

          Hi Erlend,

           

          I've been looking into this and from what I understand inforcenter.war is to be deployed as an OSGi web app. I've updated the MANIFEST.MF to include OSGi headers:

           

          Manifest-Version: 1.0
          Bundle-SymbolicName: infocenter
          Bundle-Version: 1.2.0
          Bundle-Name: Infocenter
          Bundle-ManifestVersion: 2
          Bundle-ClassPath: .,
              WEB-INF/lib/org.eclipse.equinox.servletbridge_1.2.0.v20100503.jar,
              WEB-INF/classes,
              WEB-INF/plugins/com.ibm.icu_4.2.1.v20100412.jar,
              WEB-INF/plugins/com.jcraft.jsch_0.1.41.v200903070017.jar,
              WEB-INF/plugins/javax.servlet.jsp_2.0.0.v200806031607.jar,
              WEB-INF/plugins/javax.servlet_2.5.0.v200910301333.jar,
              WEB-INF/plugins/org.apache.commons.el_1.0.0.v201004212143.jar,
              WEB-INF/plugins/org.apache.commons.logging_1.0.4.v201005080501.jar,
              WEB-INF/plugins/org.apache.jasper_5.5.17.v201004212143.jar,
              WEB-INF/plugins/org.apache.lucene.analysis_1.9.1.v20100518-1140.jar,
              WEB-INF/plugins/org.apache.lucene_1.9.1.v20100518-1140.jar,
              WEB-INF/plugins/org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar,
              WEB-INF/plugins/org.eclipse.core.expressions_3.4.200.v20100505.jar,
              WEB-INF/plugins/org.eclipse.core.jobs_3.5.0.v20100515.jar,
              WEB-INF/plugins/org.eclipse.core.runtime.compatibility_3.2.100.v20100505.jar,
              WEB-INF/plugins/org.eclipse.core.runtime_3.6.0.v20100505.jar,
              WEB-INF/plugins/org.eclipse.equinox.app_1.3.0.v20100512.jar,
              WEB-INF/plugins/org.eclipse.equinox.common_3.6.0.v20100503.jar,
              WEB-INF/plugins/org.eclipse.equinox.http.jetty_2.0.0.v20100503.jar,
              WEB-INF/plugins/org.eclipse.equinox.http.registry_1.1.0.v20100503.jar,
              WEB-INF/plugins/org.eclipse.equinox.http.servlet_1.1.0.v20100503.jar,
              WEB-INF/plugins/org.eclipse.equinox.http.servletbridge_1.0.200.v20100503.jar,
              WEB-INF/plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.200.v20100503.jar,
              WEB-INF/plugins/org.eclipse.equinox.jsp.jasper_1.0.200.v20100421.jar,
              WEB-INF/plugins/org.eclipse.equinox.preferences_3.3.0.v20100503.jar,
              WEB-INF/plugins/org.eclipse.equinox.registry_3.5.0.v20100503.jar,
              WEB-INF/plugins/org.eclipse.help.base_3.5.0.v201006080911.jar,
              WEB-INF/plugins/org.eclipse.help.webapp_3.5.0.v20100507.jar,
              WEB-INF/plugins/org.eclipse.help_3.5.0.v20100524.jar,
              WEB-INF/plugins/org.eclipse.osgi.services_3.2.100.v20100503.jar,
              WEB-INF/plugins/org.eclipse.osgi_3.6.0.v20100517.jar,
              WEB-INF/plugins/org.eclipse.update.configurator_3.3.100.v20100512.jar
          Import-Package: javax.servlet,javax.servlet.http, org.eclipse.equinox.servletbridge
          Webapp-Context: infocenter
          

          As you might have noticed I've added a import for the package 'org.eclipse.equinox.servletbridge' even though it is included in the Bundle-ClassPath header. So for this to work, you'll have to deploy WEB-INF/lib/org.eclipse.equinox.servletbridge_1.2.0.v20100503.jar to AS7. I'm not sure about the reason for this but I'll try to figure that out.

           

          One other thing was that I needed to use the fix from this jira to be able to deploy an OSGi web app. To try this out you can clone https://github.com/jbossas/jboss-as and then perform the following steps to merge in the code from that jira:

           

          git co -b osgi-webapp
          git remote add tdiesler https://github.com/tdiesler/jboss-as.git
          git fetch tdiesler 
          git merge tdiesler/as1601
          mvn install -DskipTests=true
          

           

          The built server will be in build/target/jboss-as-7.1.0.Alpha2-SNAPSHOT.

           

          Update standalone/configuration/standalone.xml and set the 'org.osgi.framework.startlevel.beginning to 3:

           

          <property name="org.osgi.framework.startlevel.beginning">3</property>
          
          

           

          Next, start the standalone server.

          Then, deploy org.eclipse.equinox.servletbridge_1.2.0.v20100503.jar  followed by infocenter.war.

          You should see the following in the servers console:

           

          13:16:08,682 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) Starting deployment of "infocenter.war"
          13:16:12,946 INFO  [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-1) Install bundle: infocenter:1.2.0
          13:16:12,960 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 1) Deployed "infocenter.war"
          13:16:13,211 INFO  [org.eclipse.jetty.util.log] (MSC service thread 1-3) started HttpServiceContext{httpContext=org.ops4j.pax.web.extender.war.internal.WebAppWebContainerContext@173ebc5c}
          13:16:13,215 WARN  [org.ops4j.pax.web.extender.war.internal.RegisterWebAppVisitorWC] (MSC service thread 1-3) Jsp support is not enabled. Is org.ops4j.pax.web.jsp bundle installed?
          13:16:31,980 INFO  [org.jboss.osgi.framework.internal.HostBundleState] (MSC service thread 1-3) Bundle started: infocenter:1.2.0
          
          

           

          Now to access infocenter, point you web browser to http://localhost:8090/infocenter/index.jsp

           

          Can you give this a try and let me know if this works for you?

           

          Regards,

           

          /Daniel