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

Protege and Java 9 #732

Closed
ghxiao opened this issue Nov 5, 2017 · 5 comments
Closed

Protege and Java 9 #732

ghxiao opened this issue Nov 5, 2017 · 5 comments

Comments

@ghxiao
Copy link

ghxiao commented Nov 5, 2017

Hi, I am trying to run Protege on Java 9 over MacOS and got many error messages like below:

org.osgi.framework.BundleException: Unresolved constraint in bundle org.protege.common [1]: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.7.0)(!(version>=2.0.0))) [caused by: Unable to resolve 10.0: missing requirement [10.0] osgi.ee; (&(osgi.ee=JavaSE)(version=1.5.0))]

The complete log is also attached.

protege-java9.log

Any idea on how to run Protege on Java 9?

Thanks!

@ykazakov
Copy link
Contributor

ykazakov commented Dec 8, 2017

I can confirm this problem on my machine:

  • MacOS 10.13.2, J
  • Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode))

There are several problems that take place with Java 9.

First, the OSGi errors like missing requirement [10.0] osgi.ee; (&(osgi.ee=JavaSE)(version=1.5.0)) can be resolved by switching to a newer version of apache felix:

		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.main</artifactId>
			<version>5.6.10</version>
		</dependency>

After that, I have an error about the missing osgi.wiring.package=javax.xml.bind
As explained here this package is not included in Java 9 SE by default (modularity!), and it can be loaded, e.g., by adding the following java argument to run.sh:

--add-modules java.xml.bind

Next Protege starts, but there is an exception:

An error occurred during OS X settings initialization. 
java.lang.NoSuchMethodException: com.apple.eawt.Application.addApplicationListener(com.apple.eawt.ApplicationListener)
	at java.base/java.lang.Class.getMethod(Class.java:2065) ~[na:na]
	at org.protege.editor.core.platform.apple.AbstractAppleApplicationWrapper.getClassesAndInterfaces(AbstractAppleApplicationWrapper.java:91) ~[protege-editor-core.jar:na]
	at org.protege.editor.core.platform.apple.AbstractAppleApplicationWrapper.<init>(AbstractAppleApplicationWrapper.java:67) ~[protege-editor-core.jar:na]
	at org.protege.editor.core.platform.apple.ProtegeAppleApplication.<init>(ProtegeAppleApplication.java:46) [protege-editor-core.jar:na]
	at org.protege.editor.core.platform.apple.ProtegeAppleApplication.getInstance(ProtegeAppleApplication.java:40) [protege-editor-core.jar:na]
	at org.protege.editor.core.ProtegeApplication.reallyStart(ProtegeApplication.java:105) [protege-editor-core.jar:na]
	at org.protege.editor.core.ProtegeApplication.lambda$start$0(ProtegeApplication.java:90) [protege-editor-core.jar:na]
	at org.apache.felix.framework.EventDispatcher.invokeFrameworkListenerCallback(EventDispatcher.java:881) ~[org.apache.felix.main.jar:na]
	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:830) ~[org.apache.felix.main.jar:na]
	at org.apache.felix.framework.EventDispatcher.run(EventDispatcher.java:1147) ~[org.apache.felix.main.jar:na]
	at org.apache.felix.framework.EventDispatcher.access$000(EventDispatcher.java:54) ~[org.apache.felix.main.jar:na]
	at org.apache.felix.framework.EventDispatcher$1.run(EventDispatcher.java:102) ~[org.apache.felix.main.jar:na]
	at java.base/java.lang.Thread.run(Thread.java:844) ~[na:na]

This happens because Protege was using (by reflection) some deprecated APIs from com.apple.eawt.Application that have now been removed. This APIs are responsible for Mac UI (like opening preferences) and I did not investigate any workaround.

@ykazakov
Copy link
Contributor

ykazakov commented Dec 8, 2017

Here I did some quick changes for java 9:

https://github.com/liveontologies/protege/tree/feature/java9

Protege seems to run on MacOS but I did not test it much. It will not work with java 8 due to some incompatibilities in com.apple.eawt.Application and java.awt.Desktop.

@ghxiao
Copy link
Author

ghxiao commented Dec 11, 2017

@ykazakov

I tested your fork and it works well on OSX/Java 9. Our ontop plugin for Protege also works. Thanks!

@wismill
Copy link

wismill commented Apr 24, 2018

I have compiled and run Protégé (git HEAD) using Java 10.

My modifications are almost the same as the ones of @ykazakov.

However, after some search it turns out that the trick with --add-modules java.xml.bind is not a good idea (see the end of the answer). It is not compatible with Java 8.

Sadly I am no Java wizard to propose a better solution. But maybe requiring Java ≤ 8 and adding a warning about latter Java versions would be good, meanwhile.
FYI, public updates of Java will stop in January 2019.

@matthewhorridge
Copy link
Contributor

Closing this issue as it will be dealt with by #822

All the the pointers are really useful.

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