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

CREATE DATABASE in console error on MacOs #8422

Closed
hrstoyanov opened this issue Jul 20, 2018 · 3 comments
Closed

CREATE DATABASE in console error on MacOs #8422

hrstoyanov opened this issue Jul 20, 2018 · 3 comments

Comments

@hrstoyanov
Copy link

OrientDB Version: 3.0.5-SNAPSHOT

Java Version: 1.8_172

OS: MacOs latest

The latest 3.0.5-SNAPSHOT produces the below strange error, which I only see on Mac, but not on Windows. Checking the JavaDocs for Java 8, I do see there is this method:

public final Buffer position(int newPosition)

but it returns Buffer, not ByteBuffer. In the child ByteBuffer class, there is no such method, which means it inherits it from Buffer.

That perhaps mean that some recent change to console code forcefully casts the return of the method to ByteBuffer, which fails on MacOs, but may works elsewhere (Windows/Linux) and compiles everywhere?

OrientDB console v.3.0.5-SNAPSHOT - Veloce (build 6832971a21364a31fd9c969f2be3c6954545485c, branch 3.0.x) https://www.orientdb.com
Type 'help' to display all the supported commands.
Creating database [plocal:../db/my.db] using the storage type [PLOCAL]...

Error: java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':recres-webapp:createSchema'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
@hrstoyanov
Copy link
Author

hrstoyanov commented Jul 20, 2018

@luigidellaquila this is a showstopper! It seems this is JDK9 vs JDK8 incompatibility.

Here are a few pointers on why it happens and how to fix it:

https://stackoverflow.com/questions/48693695/java-nio-buffer-not-loading-clear-method-on-runtime

plasma-umass/doppio#497

@hrstoyanov
Copy link
Author

@luigidellaquila , After clean build of 3.0.5-SNAPSHOT on my Mac with Java 8, here is what I see:

➜  recres git:(master) ✗ java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
➜  recres git:(master) ✗ console.sh   

OrientDB console v.3.0.5-SNAPSHOT - Veloce (build 479108d43e2e96ea7387f5857f3b76d16fe66ac9, branch 3.0.x) https://www.orientdb.com
Type 'help' to display all the supported commands.
orientdb> create database plocal:../db/test.db admin admin      

Creating database [plocal:../db/test.db] using the storage type [PLOCAL]...
Error: java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;

orientdb {server=plocal:../db/test.db}> 

A couple of notes:

  1. This only started happening recently with some change in the 3.0.5-SNAPSHOT branch. I had no problem like this a week ago.

  2. I don't see this on Windows

@hrstoyanov hrstoyanov changed the title Strange LOAD SCRIPT error on MacOs CREATE DATABASE in console error on MacOs Jul 21, 2018
@hrstoyanov
Copy link
Author

I figured out what was going on: On my Mac, I was using jEnv to switch between JDKs, and although Java 8 is my default environment, I was ending up compiling OrientDB with Java 10!

In case someone else faces this issue, the fix is to use this command when building OrientDB (assuming Java 8 is your current or default configuration):

jenv exec ./mvnw clean install -DskipTests

Note, the recommended way to work with Maven by jEnv, is to enable a Maven plug-in:

$ jenv enable-plugin maven
maven plugin activated

but I could not get it to work with the supplied mvnw maven wrapper in the OrientDB root folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant