Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jericho 3.4 requires log4j-2.4.1 while Solr still uses 1.2.17 #48

Open
joekiller opened this issue Jan 26, 2016 · 9 comments
Open

Jericho 3.4 requires log4j-2.4.1 while Solr still uses 1.2.17 #48

joekiller opened this issue Jan 26, 2016 · 9 comments

Comments

@joekiller
Copy link
Contributor

It appears that Solr is locked in still at 1.2.17 (log4j version: https://github.com/apache/lucene-solr/blob/master/lucene/ivy-versions.properties#L83 and slf4j-log4j12 version: https://github.com/apache/lucene-solr/blob/master/lucene/ivy-versions.properties#L296) while Jericho 3.4 uses the latest log4j library. When the SolrTextTagger hits the Jericho lib, it'll throw the error listed below.

Jericho's release notes state:

       - Upgraded to the following logger APIs:
         slf4j-api-1.7.12, log4j-2.4.1

Error:

o.a.s.s.SolrDispatchFilter null:java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
    at org.apache.solr.servlet.HttpSolrCall.sendError(HttpSolrCall.java:618)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:477)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:214)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:179)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
    at net.htmlparser.jericho.LoggerProviderLog4J.getLogger(LoggerProviderLog4J.java:35)
    at net.htmlparser.jericho.LoggerProviderLog4J.getSourceLogger(LoggerProviderLog4J.java:41)
    at net.htmlparser.jericho.Source.newLogger(Source.java:1685)
    at net.htmlparser.jericho.Source.<init>(Source.java:151)
    at net.htmlparser.jericho.StreamedSource.<init>(StreamedSource.java:235)
    at org.opensextant.solrtexttagger.HtmlOffsetCorrector.<init>(HtmlOffsetCorrector.java:46)
    at org.opensextant.solrtexttagger.TaggerRequestHandler.initOffsetCorrector(TaggerRequestHandler.java:251)
    at org.opensextant.solrtexttagger.TaggerRequestHandler.handleRequestBody(TaggerRequestHandler.java:154)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2068)
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:669)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:462)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 34 more
@dsmiley
Copy link
Member

dsmiley commented Jan 27, 2016

Wouldn't a test hit this?

Looking at Jericho's POM http://mvnrepository.com/artifact/net.htmlparser.jericho/jericho-html/3.4 I see it's loggers are listed as optional. It seems it shouldn't matter? But somehow you hit this exception so it does.

@joekiller
Copy link
Contributor Author

Yeah I'll try to determine a root cause but it's not high priority. I just
got the libraries required.
On Jan 27, 2016 4:07 PM, "David Smiley" [email protected] wrote:

Wouldn't some test this this?

Looking at Jericho's POM
http://mvnrepository.com/artifact/net.htmlparser.jericho/jericho-html/3.4
I see it's loggers are listed as optional. It seems it shouldn't matter?
But somehow you hit this exception so it does.


Reply to this email directly or view it on GitHub
#48 (comment)
.

@LusciousPear
Copy link

+1

@dsmiley
Copy link
Member

dsmiley commented Feb 13, 2017

My suspicion is that Jericho's internal logger picking algorithm might have a Log4j impl detecting one that isn't compatible with Solr. We might need to manually tell it which one to use. See http://jericho.htmlparser.net/docs/javadoc/net/htmlparser/jericho/Config.html#LoggerProvider I would appreciate it if someone tinkers with this further so we can get this fixed. It appears it'd require a one-liner at the spot where we first reference Jericho to set it's logger to LoggerProvider.SLF4J

@dsmiley
Copy link
Member

dsmiley commented May 2, 2018

BTW FWIW Solr 7.4 (not released yet) now uses Log4j 2. So whatever's going on here should soon become a non-issue.

@nageshgnn
Copy link

nageshgnn commented Jul 26, 2018

Any updates on this issue? We are also getting this issue.
After adding the jar, log4j-api-2.4.1, issue got fixed. is there any way to fix this issue with out adding a new jar.

2018-07-26 15:17:45,872 [http-nio-8080-exec-4] ERROR - 74: (doFilter) Filter [JSPFilter];
javax.servlet.ServletException: javax.servlet.ServletException: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
... 24 more
Caused by: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:560)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:461)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
... 30 more
Caused by: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:909)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:838)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
... 39 more
Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager
at net.htmlparser.jericho.LoggerProviderLog4J.getLogger(LoggerProviderLog4J.java:35)
at net.htmlparser.jericho.LoggerProviderLog4J.getSourceLogger(LoggerProviderLog4J.java:41)
at net.htmlparser.jericho.Source.newLogger(Source.java:1685)
at net.htmlparser.jericho.Source.(Source.java:119)
at net.htmlparser.jericho.Source.(Source.java:132)
at net.htmlparser.jericho.Source.(Source.java:174)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
... 51 more

@dsmiley
Copy link
Member

dsmiley commented Jul 26, 2018

@nageshgnn did you see my comment where I said "It appears it'd require a one-liner at the spot where we first reference Jericho to set it's logger to LoggerProvider.SLF4J" Does that help? What version of Solr are you using?

@nageshgnn
Copy link

nageshgnn commented Jul 30, 2018

Thanks @dsmiley for a resonse.
We have excluded the few Log method as below including org.slf4j in our pom.xml . Do you think this exclusion has caused the issue. If we remove this exclusion for org.slf4j , the issue should be resolved?.

Group ID: org.springframework.boot
ArtifactId : spring-boot-starter-web

		<exclusions>
			<exclusion>
				<artifactId>log4j-over-slf4j</artifactId>
				<groupId>org.slf4j</groupId>
			</exclusion>
			<exclusion>
				<artifactId>logback-classic</artifactId>
				<groupId>ch.qos.logback</groupId>
			</exclusion>
			<exclusion>
				<artifactId>logback-core</artifactId>
				<groupId>ch.qos.logback</groupId>
			</exclusion>
			<exclusion>
				<artifactId>tomcat-embed-el</artifactId>
				<groupId>org.apache.tomcat.embed</groupId>
			</exclusion>
			<exclusion>
				<artifactId>tomcat-embed-core</artifactId>
				<groupId>org.apache.tomcat.embed</groupId>
			</exclusion>
			<exclusion>
				<artifactId>tomcat-embed-websocket</artifactId>
				<groupId>org.apache.tomcat.embed</groupId>
			</exclusion>
		</

@dsmiley
Copy link
Member

dsmiley commented Jul 31, 2018

By showing me a Maven POM, I suspect the situation is a bit different than the start of the conversation/issue above. What does your Spring Boot app have to do with Solr? Is it the client of Solr? If so, it doesn't need the Solr Text Tagger, only SolrJ to communicate with Solr -- and in that case there you should communicate with the Apache Solr project mailing list or other support resources, not this plugin which runs inside Solr. Or maybe you are embedding Solr via EmbeddedSolrServer? In that case, especially with bringing in whatever other frameworks you have and their own logging dependencies, this becomes a general Java question of how to use Maven to include the right logging libraries while excluding the ones you don't want (sadly a common and annoying problem), and not so much an issue specific to this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants