Eclipse Maven/Eclipse ClassLoader Reihenfolge

mephi

Bekanntes Mitglied
Hi,

ich habe ein kleines Problem was vermutlich mit dem ClassLoader zutun hat. Und zwar habe ich ein Mavenprojekt welches neben anderen Libs auch eine jar von IBM und commons-lang enthält.
So das Problem ist nun dass die jar von IBM die Klassen von commons-lang enthält, aber einer älteren Version. Maven baut das Projekt anständig aber Eclipse sagt mir dass StringUtils.startsWith(..) undefined ist, da Eclipse wohl die Klasse aus dem IBM jar nimmt und Maven die richtige aus commons-lang. Und es scheint auch willkürlich aufzutreten. Ein Kollege hat das selbe Projekt ausgecheckt und bei ihm gibts das Problem nicht. Kann man hier irgendwas ausrichten?

Grüße
mephi
 

mvitz

Top Contributor
In Eclipse selber kann man in den Build-Path Settings die Reihenfolge festlegen, da hätte man also die Chance, dafür zu sorgen das common-lang vor dem IBM JAR genutzt wird.

Jedoch bin ich mir beim ausführen später nicht sicher, wie genau die Reihenfolge vom Javainterpreter genutzt wird.
 

mephi

Bekanntes Mitglied
Die Maven Dependencies sind leider nur ein Punkt unter "Order and Export" man kann sie also nur als gesamtes in der Reihenfolge verschieben.
 

mephi

Bekanntes Mitglied
Ok danke, das hat fürs erste geholfen. Mich wundert dann nur wieso der Fehler bei meinem Kollege nicht auftrat. Der Unterschied ist, er hat den Rational Application Developer 7.5 benutzt und ich Eclipse 3.6.
Daher hab ich angenommen dass die Reihenfolge wie Eclipse die jars dann lädt willkürlich ist(der maven build funktionierte ja). Hmm..
 
Zuletzt bearbeitet:

mvitz

Top Contributor
Keine Ahnung, aber genau das Problem zeigt, wieso man externe Bibliotheken NICHT mit in sein JAR verpacken sollte (was hier immer mal wieder Leute möchten).

Lustig wird es dann evtl. noch, wenn ihr euer Projekt/Produkt deployt. Denn wenn es auf einem Application Server laufen soll, dann kann es euch durchaus passieren, dass dieser wiederum die IBM zuerst lädt und schon habt ihr ein Problem (vor allem ist im AS dann die Reihenfolge zu ändern sehr schwer). Evtl. wäre es noch eine Möglichkeit, die common-lang Klassen aus dem IBM Jar zu entfernen oder (vorausgesetzt ihr nutzt Java6) einfach commons-lang 3 zu benutzen (da haben die aus Kompatibitätsgründen anderen Packages genutzt und ihr kämt mit den commons-lang 2.x Klassen nicht in Konflikt).
 

mephi

Bekanntes Mitglied
Ja, warum IBM sowas macht ist mir echt nicht klar. "Rebundlen" war eine Überlegung. Man kann jetzt von Glück sagen dass es sich bei dem Projekt nur um ein Beispiel Projekt handelt und nichts das produktiv gehen soll. Problem früh erkannt :)
Danke
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
Robertop Maven Warnung "'version' contains an expression but should be a constant" in Eclipse verstecken IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
K Maven + GWT (+ Eclipse)? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
J Eclipse Eclipse mit Maven mit Abhängigkeiten IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
L Eclipse Eclipse - Projekte "mischen" Dynamisches Web Projekt + Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
thet1983 Eclipse Eclipse - Maven - Wildfly - archetype:generate IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
G eclipse und Webprojekte mit Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
D Eclipse Eclipse deployment assmebly + Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
P Eclipse Maven Support IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
I Maven, Eclipse, building workspace loop IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
S Eclipse Java + Shellscript mit Maven und Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 11
Gregorrr Eclipse Best Practice: Multi-Projekt mit Eclipse + EGit (Git) + m2e (Maven) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
J Eclipse Checkout/Import Maven Projekt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
C Eclipse Verständnisfrage Eclipse+Maven+Resources IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
C Eclipse Verständnisfrage Eclipse+Maven+Dependencies IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
F Maven plugin für Eclipse: tld dependencies in jars IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
doopexxx Add an maven project to an existing maven project IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 23
MiMa Netbeans zu IntelliJ mit Maven konvertieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 14
MiMa IntelliJ Maven Projekt erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 15
Y IDEA IntelliJ Warum findet IntelliJ die maven property nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
O NetBeans Java Projekt OHNE Maven erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
O NetBeans Java Projekt OHNE Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
P Maven für Intellij IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
mrBrown IntelliJ 2020.1 - Maven Projekte nicht ausführbar IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
A Wie sind Multi-POM Maven Projects zu verwalten/releasen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 12
J Maven in Gradle builden? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 11
D Jenkins/Gradle maven-publish Problem IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
U Ich kann ein Plugin anhand von Maven nicht builden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 14
C Ändern der Hauptklasse und dependencys in maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
C maven startet jetty, netbeans "run" startet glassfish IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
J Eclipse Nach Maven Einstellung -> Ordner /target im Arbeitsverzeichnis IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
D Gradle - DSL und Repositories von Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
K Eclipse Seltsames Maven Compiler Verhalten mit OpenCV IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
K Netbeans + Maven: default pom Inhalt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
E Maven-Installation für Intellij IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
M Eclipse import eines maven projects "missing artifact" IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
D Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
N Maven dependencies Informationen finden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
F [Maven] cannot find plugins IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
G Maven - lokales Repository erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
D NetBeans Maven Projekt in Netbeans => WEKA wirft (java.lang.OutOfMemoryError: Java heap space) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
A IDEA IntelliJ IntelliJ Maven oder Webprojekt, kann keine normalen Java Klassen erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
Tarrew Problem mit Maven und der Erkennung von generierten Antlr Files. IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 0
M [Maven] Depencies mit in jar übernehmen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
N Eclipse Maven , Javafx , SceneBuilder IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
H Maven realer Classpath? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
R Eclipse Maven package mit dependencies IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
E Maven - *.jars landen nicht im lokalen Repository IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
B Versionierung mit Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
DEvent [maven] property als parameter IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
B Maven - Angeben welche Klassen/Packes für build benutzen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
H maven-javadoc-plugin: package does not exist IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
P Eclipse Maven integration IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
K Maven: Reporting zu einer bestimmten Revision IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
S Maven und Native-Libs IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 14
T Eclipse Maven-Plugin IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
S Maven: Abhängigkeiten + target in [b]eine[/b] Jar IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
G NetBeans Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
MQue Maven und SVN IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
S Maven / Javadoc als jar deployen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
Kessi Maven assembly vergisst eigene Klassen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
D Einzelnen Unit-Test mit Maven ausführen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
J Ant-Tasks in Maven einbinden IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 13
M MyLyn und Maven installieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 12
D Maven vs. Ivy IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
J Konfigurationsdateien und Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
M Maven 2, XDoclet ejbdoclet und Java 1.5 IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
E Maven mit WSDL2Java IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
Y Maven und JUnit IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
Y Maven und myEclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
B Maven IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
R Eclipse beim Ausführen zur Eingabe in die Konsole springen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
T Eclipse Java Projekt funktioniert in Eclipse, aber nach export kein Dateizugriff IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
M Eclipse oder IntelliJ? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
JonasM Gibt es eine Libary in Eclipse mit der ich Daten per USB an einen Microkontroller Senden kann? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
N Erstellen einer ausführbaren jar Datei in Eclipse (Linux Mint) IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 17
O Eclipse stürzt beim Autovervollständigen ab IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 17
C In Eclipse Einrückung im Java-Editor einstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
Avalon html ist nicht html in eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 1
A Docker im Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
Robertop Eclipse resolved Target-Platform nicht wegen automatischem HTTPS IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
C Eclipse englisch, deutsche Kommentare leider rot unterkringelt IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
T Eclipse von Java 1.8 auf 17 IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
S [Eclipse] Zwei verschiedene Konfigurationen erstellen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
A Eclipse Projekt-Umzug mit Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 8
D Eclipse Eclipse und OpenGL IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 3
M Ausführbares Programm aus Eclipse exportieren IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
Java00User00 Eclipse Theme IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
F Eclipse für Java 1.8 ARM einrichten IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 6
D Crawler funktioniert in intellij aber in Eclipse nicht IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
U Problem mit Eclipse - WindowBuilder - memoryLeak? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 15
F Eclipse - Änderung am Code ohne Applikation Neustart IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
E Hilfe mit Eclipse IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 2
B Eclipse version control System das ohne Internet funktioniert/nur lokal auf Computer? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 5
B Eclipse Problem mit jar Datei? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 4
N Eclipse erzeugt plötzlich keine (default package) mehr IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 24
F alle Eclipse Projekte auf git hochladen IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 7
O Java Eclipse Umlaute werden nicht richtig dargestellt in Konsole IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 10
B .exe Datei für Eclipse Java Programm erstellen? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 9
Eclipse Build path duplication entry IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 11
B Wie nicht-java Datei mit Eclipse benutzen (Excel Datei einlesen)? IDEs - Eclipse, IntelliJ IDEA, BlueJ & mehr 16

Ähnliche Java Themen

Neue Themen


Oben