iotashan / cfsolrlib

ColdFusion library for advanced Solr integration
MIT License
30 stars 16 forks source link

log4j Error Under Lucee 4.5.1.022 #12

Open jamiejackson opened 8 years ago

jamiejackson commented 8 years ago

Using the latest master, there are errors on instantiation:

==> /opt/lucee/tomcat/logs/catalina.out <==
28-Oct-2015 08:28:49.806 INFO [http-nio-8888-exec-1] org.apache.solr.client.solrj.impl.HttpClientUtil.createClient Creating new http client, config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
log4j:ERROR A "org.apache.log4j.RollingFileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [com.compoundtheory.classloader.NetworkClassLoader@6ba96347] whereas object of type
log4j:ERROR "org.apache.log4j.RollingFileAppender" was loaded by [java.net.URLClassLoader@61e4705b].
log4j:ERROR Could not instantiate appender named "file".
28-Oct-2015 08:28:50.052 INFO [http-nio-8888-exec-1] org.apache.solr.client.solrj.impl.HttpClientUtil.createClient Creating new http client, config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false

If I go back to the libraries from before the logging libraries were downgraded for ACF 9, I have better results:

==> /opt/lucee/tomcat/logs/catalina.out <==
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/var/www/vmhost/apps/mysite/cfml/deployment_root/wwwroot/requirements/solrj/javalib/slf4j-jdk14-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/www/vmhost/apps/mysite/cfml/deployment_root/wwwroot/requirements/solrj/javalib/tika-app-1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
28-Oct-2015 09:27:53.336 INFO [http-nio-8888-exec-1] org.apache.solr.client.solrj.impl.HttpClientUtil.createClient Creating new http client, config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
28-Oct-2015 09:27:53.505 INFO [http-nio-8888-exec-1] org.apache.solr.client.solrj.impl.HttpClientUtil.createClient Creating new http client, config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false

It seems not completely clean (hence the "multiple bindings" message), so maybe there's still a tweak to be made, but I guess it's better than errors.

Is it time to branch for an old (ACF9-compatible) version and move on with upgrades?

For what it's worth, I haven't noticed any functional problems with either configuration, so far.

jamiejackson commented 8 years ago

I decided to try out a new batch of libraries, mostly based on the latest version of the 4.x solrj.

I used Maven to resolve dependencies:

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-solrj</artifactId>
            <version>4.10.4</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>1.7.12</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.12</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.12</version>
            <scope>runtime</scope>
        </dependency>
  </dependencies>

...which yields:

./commons-codec-1.10.jar
./commons-io-2.3.jar
./httpclient-4.3.1.jar
./httpcore-4.3.jar
./httpmime-4.3.1.jar
./jcl-over-slf4j-1.7.12.jar
./log4j-over-slf4j-1.7.12.jar
./noggit-0.5.jar
./slf4j-api-1.7.6.jar
./slf4j-jdk14-1.7.12.jar
./solr-solrj-4.10.4.jar
./wstx-asl-3.2.7.jar
./zookeeper-3.4.6.jar

Which appears to work, and I'm getting no errors in the logs. (Note, however, that I don't use Tika, so I didn't bother with it.)