Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 113252

Summary: [Help] problem loading xerces parser under tomcat/help in rcp
Product: [Eclipse Project] Platform Reporter: Francis Upton IV <francisu>
Component: User AssistanceAssignee: Curtis d'Entremont <curtispd>
Status: RESOLVED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: eclipse, hugo.a.garcia, jstuckey, tjwatson
Version: 3.1.1   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
example bundle none

Description Francis Upton IV CLA 2005-10-20 11:52:47 EDT
This is running an RCP application and trying to use help.  I include the
plugins required by help (ant, lucene, tomcat, and the 5 helps), in my product
definition as well as in the run configuration.

I get this error when starting up help (which also says at the top of the help
browser "There was an error in your action").

It is failing on this line in BaseHelpSystem.java:

	public static synchronized WorkingSetManager getWorkingSetManager() {
		if (getInstance().workingSetManager == null) {
>>>>			getInstance().workingSetManager = new WorkingSetManager();
		}
		return getInstance().workingSetManager;
	}

Looks like it is having trouble creating the WorkingSetManager.  Note this
occurs with my eclipse application both on Windows and Linux.



I start up help like this:

window.getWorkbench().getHelpSystem().displayHelpResource("/com.oaklandsw.transform.doc/help/index.html");
                       

There is nothing in the jre/lib/ext directory (that was not installed with the
JRE, which is 1.4.2_09).


Here is the error:


StandardWrapperValve[org.eclipse.help.internal.webapp.jsp.advanced.searchView_jsp]:
Servlet.service() for servlet
org.eclipse.help.internal.webapp.jsp.advanced.searchView_jsp threw exception
javax.servlet.ServletException
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
	at
org.eclipse.help.internal.webapp.jsp.advanced.searchView_jsp._jspService(searchView_jsp.java:225)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:534)
----- Root Cause -----
java.lang.NoClassDefFoundError
	at
org.eclipse.help.internal.base.BaseHelpSystem.getWorkingSetManager(BaseHelpSystem.java:107)
	at
org.eclipse.help.internal.webapp.servlet.WebappWorkingSetManager.<init>(WebappWorkingSetManager.java:42)
	at org.eclipse.help.internal.webapp.data.SearchData.<init>(SearchData.java:59)
	at
org.eclipse.help.internal.webapp.jsp.advanced.searchView_jsp._jspService(searchView_jsp.java:66)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:534)
Comment 1 Francis Upton IV CLA 2005-10-20 12:01:29 EDT
Oh, here is some additional information, looks like the 'cat can't find the
Xerces parser, which is causing the WorkingSetManager to fail to load.

I have the Xerces parser in a plugin (which contains only Jars).  This plugin is
in the product/run configuration (and I can successfully use the xerces parser
in other places in my app).  I stepped through the class loading of Tomcat when
it tries to load the parser, and it seems only to look in the classloader
associated with the Tomcat bundle.  When my app tries to load the xerces parser
classes from other places, it loads correctly as the thread contextclassloader
is pointing to an Eclipse classloader that is pointing directly to the bundle
that has all of my required Jars (including the Xerces parser).

How can I get the tomcat plugin to look in my other plugins to find the required
Jar files?

ApplicationDispatcher[/help] Servlet.service() for servlet
org.eclipse.help.internal.webapp.jsp.advanced.searchScoped_jsp threw exception
javax.servlet.ServletException: Provider
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
	at
org.eclipse.help.internal.webapp.jsp.advanced.searchScoped_jsp._jspService(searchScoped_jsp.java:188)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
	at
org.eclipse.help.internal.webapp.jsp.advanced.search_jsp._jspService(search_jsp.java:57)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:534)
----- Root Cause -----
javax.xml.parsers.FactoryConfigurationError: Provider
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found
	at
javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:99)
	at
org.eclipse.help.internal.workingset.WorkingSetManager.<clinit>(WorkingSetManager.java:44)
	at
org.eclipse.help.internal.base.BaseHelpSystem.getWorkingSetManager(BaseHelpSystem.java:107)
	at
org.eclipse.help.internal.webapp.servlet.WebappWorkingSetManager.<init>(WebappWorkingSetManager.java:42)
	at org.eclipse.help.internal.webapp.data.SearchData.<init>(SearchData.java:59)
	at
org.eclipse.help.internal.webapp.jsp.advanced.searchScoped_jsp._jspService(searchScoped_jsp.java:65)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
	at
org.eclipse.help.internal.webapp.jsp.advanced.search_jsp._jspService(search_jsp.java:57)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at
org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:534)
Comment 2 Francis Upton IV CLA 2005-10-20 20:49:24 EDT
I have a solution to the problem, which is to update the org.eclipse.tomcat
plugin manifest.mf file adding the following line:

Eclipse-BuddyPolicy: global

This allows the plugin to find the parser if it's anywhere.
Comment 3 Francis Upton IV CLA 2005-12-19 22:17:32 EST
Has anyone looked at this?  Since the fix is so simple, it would be nice to get it into a release.

Thanks,

Francis
Comment 4 Curtis d'Entremont CLA 2005-12-20 11:26:16 EST
Just to better understand the problem - is it that your JRE doesn't provide an XML parser implementation, and that you instead provide it via another plugin that the tomcat plugin does not depend on?
Comment 5 Francis Upton IV CLA 2005-12-20 11:49:56 EST
Because I'm using the Xerces parser in other places in my process, the help plugin wants to use it as well.  However, it can't find it.  I do provide the Xerces parser in one of my plugins.

This will allow it to find the parser whereever it is.

Thanks for scheduling this!
Comment 6 Curtis d'Entremont CLA 2005-12-26 19:46:44 EST
Fix applied.
Comment 7 Curtis d'Entremont CLA 2006-03-03 15:08:35 EST
The fix for this has brought forth another bug, the opposite problem. If you have a commons logging jar tomcat will find that one instead of its own (which appears to be incompatible). The fix is causing more problems than it is fixing, and also I've just learned that using the global buddy policy is highly discouraged. For these reasons I am rolling back.

Francis, can you find an alternative solution ?
Comment 8 Thomas Watson CLA 2006-03-03 16:18:54 EST
How is the xerces parser configured to be the global one used by everyone?  Are you setting some system property that tells JAXP to use xerces e.g.

javax.xml.parsers.DocumentBuilderFactory =
     org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

I'm not sure why this is only causing problems for help.  I would expect the extension registry implementation to have similar issues when getting a parser.
Comment 9 Francis Upton IV CLA 2006-03-03 18:24:42 EST
wow, you're TJ Watson? 

This is what I do:

        System.setProperty("javax.xml.parsers.DocumentBuilderFactory",
                           "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
        System.setProperty("javax.xml.parsers.SAXParserFactory",
                           "org.apache.xerces.jaxp.SAXParserFactoryImpl");

I don't have any other problems; it seems to parse the configuration files just fine.  Is there another way I should be setting things up so that I can use the Xerces parser when I parse XML and have eclipse work properly?
Comment 10 Thomas Watson CLA 2006-03-04 09:15:34 EST
Created attachment 35719 [details]
example bundle

I am a TJ Watson, but not THE TJ Watson ;-)

I would suggest you use a 
/META-INF/services/javax.xml.parsers.SAXParserFactory or
/META-INF/services/javax.xml.parsers.DocumentBuilderFactory. 
file in your bundle with the xerces parser to configure xerces for your bundle.  The only requirement is that this file available on your Bundle-Classpath.  Attached is a simple example.
Comment 11 Hugo A. Garcia CLA 2006-03-16 11:56:35 EST
Just a wild guess but will using the tomcat 5.x series instead of the 4.x series remove the diferrences in the logging libs?
Comment 12 Curtis d'Entremont CLA 2006-03-16 13:07:00 EST
(In reply to comment #11)
> Just a wild guess but will using the tomcat 5.x series instead of the 4.x
> series remove the diferrences in the logging libs?

Probably, but the logging lib problem should have gone away after we rolled back the proposed fix to this one. It was causing Tomcat to use the logging from another plugin, but that logging was incompatible and it was failing to start.
Comment 13 Hugo A. Garcia CLA 2006-03-16 13:11:50 EST
(In reply to comment #12)

> Probably, but the logging lib problem should have gone away after we rolled
> back the proposed fix to this one.

I confirmed that the problem went away in the latest integration build I20060315-1200

-H

Comment 14 Curtis d'Entremont CLA 2006-03-30 11:56:33 EST
Francis, did Tom's suggestion solve your problem?
Comment 15 Francis Upton IV CLA 2006-03-30 17:32:34 EST
Yes, it certainly did, sorry I did not get a chance to try it sooner.  Thanks Tom.  You can close this one.
Comment 16 Curtis d'Entremont CLA 2006-03-30 17:36:08 EST
Thanks. Closing.