issue SLF4J + OWL API Scala Eclipse - eclipse

I have a problem with slf4j while programming in scala with Eclipse (Maven project):
I try to import an ontology with owl API.
Particularly, I try to use the command loadOntologyFromOntologyDocument to load an owl file and I get the following error:
SLF4J: Class path contains multiple SLF4J bindings.
I've already tried to delete useless dependencies and reload project. But it seems that dependencies are installed again everytime I run the code.
Does anyone has encountered this issue ?

Related

Eclipse running SpringBoot: SLF4J: Class path contains multiple SLF4J bindings

Whenever I fire up a SpringBoot-based application (run as Maven build / goal spring-boot:run) I get the infamous SLF4J Warning:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/U:/eclipse/eclipse-jee/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/U:/eclipse/eclipse-jee/configuration/org.eclipse.osgi/8/0/.cp/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.SimpleLoggerFactory]
That warning annoys me greatly because when demoing an application from Eclipse the first thing the potential customers or users are seeing is a big red superfluous warning. I HATE that! It looks so unprofessional!
Now - in principle the warning is clear: there are two SLF4J bindings and one should get rid of one of them. I found misc. descriptions of the same error some of which also explain how to locate the (usually transitive) dependency and then exclude one of them from the dependencies in the pom.
I tried that and non of these suggestions worked for me! Also the solution proposed in
Eclipse Maven: SLF4J: Class path contains multiple SLF4J bindings (namely to use an external Maven installation) did NOT work!
Looking closer at the paths listed in the warning I would claim, that there are already two bindings in eclipse itself (in the plugins org.eclipse.osgi... and in org.eclipse.m2e.maven.runtime.slf4j.simple_1.16.0.20200610-1735/jars/slf4j-simple-1.7.5.jar) and that probably explains why my attempts were fruitless: mangling the application's pom doesn't change anything regarding these Eclipse-internal bindings. The mentioned append comes to the same conclusion: it's a bug inside eclipse.
But does anyone have an idea what it would need to get rid of that warning? I am open to all kind of "hacks"! Could one e.g. "massage" the ...m2e.maven.runtime.'s jar to no longer contain the org/slf4j/impl/StaticLoggerBinder.class (or probably rather its containing jar)? Or are there better/safer ways?
What would be needed to get rid of that warning in Eclipse?
for me Eclipse Maven: SLF4J: Class path contains multiple SLF4J bindings work. In Debian Linux I add /usr/share/maven to Window/Preferences/Maven/Installations and these warnings disappeared.

Eclipse error - Cannot be resolved to type

Created a Maven Project and have set the dependencies in the pom.xml. The import statement (com.splunk.*) seems to recognize the library included in the Maven Dependencies, however when I refer to the class (for e.g. ResultsReaderXml) within that library, it shows the "error message cannot be resolved to type". Can some please explain why Spring Tool Suite (Eclipse) is doing that?
https://i.stack.imgur.com/enCRW.png

scala & intellij : difficulties to create a runnnable jar

I can't launch a scala jar; when I launch it I get the error "Exception in thread "main" java.lang.NoClassDefFoundError: scala/collection/immutable/List" which seems to mean the scala library is not loaded...
this is a screenshot showing a lot of informations on the artifact window.
here is the manifest:
Manifest-Version: 1.0
Class-Path: libs/scala-library-2.10.0.jar libs/commons-logging-1.1.1.j
ar libs/jcip-annotations-1.0.jar libs/jwnl-1.4_rc3.jar libs/laf-plugi
n-7.2.1.jar libs/laf-widget-7.2.1.jar libs/miglayout-core-4.2.jar lib
s/miglayout-swing-4.2.jar libs/scala-actors.jar libs/scala-library.ja
r libs/scala-swing.jar libs/slf4j-api-1.6.4.jar libs/slick_2.10-1.0.0
.jar libs/sqlite-jdbc-3.7.2.jar libs/substance-7.2.1.jar libs/trident
-7.2.1-swing.jar
Main-Class: Fenetre
and when I enter "java xf myJar.jar", there are extracted files in the directory:
- .class files
- in the libs folder, there are the libraries INCLUDING scala-library.jar & scala-library-2.10.0.jar(I specified only one of these two files in the manifest to avoid conflicts)
can you help me?
I'm new to Scala and don't know what the problem is however I've been compiling "fat jars" which include all the required libs.
I've been using https://github.com/sbt/sbt-assembly to do this successfully.
Despite what your manifest is telling you, when you run the application you either do not have the scala-library included in your class path or there's some confusion when you attempt to import List. Scala should automatically import the immutable collection classes in your project with the root Predef implementation.
Predef provides type aliases for types which are commonly used, such as the immutable collection types scala.collection.immutable.Map, scala.collection.immutable.Set, and the scala.collection.immutable.List constructors (scala.collection.immutable.:: and scala.collection.immutable.Nil). The types Pair (a scala.Tuple2) and Triple (a scala.Tuple3), with simple constructors, are also provided.
Predef in core Scaladocs
Try printing the classpath from within your app to confirm.
Although not pertinent to your question, I would recommend using SBT for dependency management now that IntelliJ IDEA 13 has full SBT integration support. Your collaborators not using IntelliJ will also be happier because SBT gives them more options for build technologies, editors, and other tooling when working on the project.

How do I find and eliminate an unwanted entry in my Eclipse classpath?

Our source code repository has an Eclipse run configuration in .settings/Program.launch, a classpath configuration in .classpath, and a set of user libraries we were all directed to import months ago by the Eclipse expert who used to be in our office. The user library set includes a defined user library named JBoss6.0.0.Final that points to all or most of the jars inside of JBoss, and the Program.launch run configuration includes this JBoss6.0.0.Final user library.
I'm now getting a conflict from slf4j telling me I need to remove one of the slf4j binding jars in my classpath:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/workspace/project/core/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/jboss-6.0.0.Final/client/slf4j-jboss-logging.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.Log4jLoggerFactory]
I understand why I'm getting this warning, and I want to fix the situation by taking slf4j-jboss-logging.jar out of the classpath for Program.launch . I went to Window -> Preferences -> Java -> Build Path -> User Libraries, I opened the JBoss6.0.0.Final user library, and I removed slf4j-jboss-logging.jar . But when I run, I still get the same warning.
What is including this jar in my classpath? I want to remove it.
I exported my user libraries to an XML file and searched through it and slf4j-jboss-logging.jar is not in there at all. I read the Project.launch file and it doesn't refer to this jar. The .classpath file does not reference this jar, but it does include the following line, which I think pulls in the JBoss6.0.0.Final user library:
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JBoss6.0.0.Final"/>
I looked at the classpath tab under the run configurations for Project.launch, and it appears to be showing everything defined by the .classpath file.
Where is this offending jar coming from in my classpath?
I'm running Eclipse Indigo.
Try using jboss-classloading.xml, this should allow you to isolate your jars from those in included in jboss.
See if this link helps.

Intellij idea unresolved symbol in grails + gwt project

I have a grails project and I use the gwt plugin 0.6.1. GWT version is configured using ivy.
I have a strange unresolved symbol error when I try to use a class in package com.google.web.*. When I use the complete class names inline idea reports that it cannot resolve the web package. If I import the same class no error ocurres.
I already tried to run grails clean and removed the idea system directory as well - nothing works.
Idea usally import the class when I use smart complete but in this case idea insert the complete classname instead of importing the class.
The web package is found in the gwt-users-2.4.0.jar and gwt-servlet-2.4.0.jar. Both jars are in the classpath but this how the grails gwt plugin organizes gwt dependency.
Error when using full inline claasnames:
No error when using same class in import statement:
Does anyone have an idea?
Fixed already http://youtrack.jetbrains.net/issue/IDEA-81056
Fix is included in the next IDEA 11.1 EAP
http://confluence.jetbrains.com/display/IDEADEV/IDEA+11.1+EAP
I also had similar issue with IntelliJ IDEA, I solved problem by invalidating the idea cache. After invalidating the cache it will reindex all your library and other files. check this answer as well. Grails and IntelliJ Cache Issues