Getting rid of org.eclipse.osgi.internal.framework

2019-04-15 22:16发布

问题:

I have just run into the Apache Ivy bug java.lang.ClassCastException: org.eclipse.osgi.internal.framework.EquinoxConfiguration$1 cannot be cast to java.lang.String (link) when performing Ant task ivy:config

This morning I tried to install LibraryFolder ClasspathContainer plugin into my Eclipse (STS 3.6.1): installing it caused the above error every time I tried to perform ivy:retrieve.

Even worse, I tried to install IvyDE plugin from Eclipse Marketplace and Eclipse started to crash at a multitude of errors, including JVM crash. Uninstalling both plugins didn't fix. I tried with a new workspace and a blank Eclipse installation, but I eventually had to install my previous Eclipse plugins.

I spent the entire morning trying to fix the mess but I had to restore the previous uncommitted workspace and Eclipse installation, so now I get everything working except for the above error. Ivy worked fine until this morning.

Every Ant task of mine runs in the same JRE as Eclipse (C:\Program Files\Java\jdk1.7.0_60\jre\bin\server\jvm.dll as per sts.ini) because I use a lot the eclipse.refreshLocal task. While I can workaround the problem by removing/commenting eclipse.refreshLocal task and run Ant-Ivy tasks in a standard JRE, I'm asking if there is a workaround to get rid of the error, perhaps by deleting a key file in the workspace's metadata.

As I can read, an Ivy method is passed an object that, guessing from its name, is part of Eclipse configuration. While I'll be waiting for a bugfix, my question is how do I investigate more about the nature of this org.eclipse.osgi.internal.framework.EquinoxConfiguration$1 parameter?

回答1:

This looks related to Error at building model of new Gradle project for libgdx - which includes a workaround that works for Gradle IDE, so maybe it will work for you.

The relevant Eclipse bug is https://bugs.eclipse.org/bugs/show_bug.cgi?id=445122

[Edit by OP] to simplify life to people having the same problem I'll post the contents of the link and accept the answer

Just add the following lines to eclipse.ini

-Dorg.eclipse.swt.browser.IEVersion=10001
-Dosgi.configuration.area.default=null
-Dosgi.user.area.default=null
-Dosgi.user.area=@user.home
-Dosgi.instance.area.default=null