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

fix(dist): start server with java 11 #2020

Merged
merged 8 commits into from
Nov 20, 2022
Merged

fix(dist): start server with java 11 #2020

merged 8 commits into from
Nov 20, 2022

Conversation

imbajin
Copy link
Member

@imbajin imbajin commented Nov 18, 2022

fixed #1957

  1. use a better way to get the java version
  2. don't use float in shell directly (refer https://github.com/koalaman/shellcheck/wiki/SC2072)
    image
  3. we shall use shell-check plugin to avoid these problems (improvement)

@imbajin imbajin requested review from javeme and zyxxoo November 18, 2022 12:06
@imbajin imbajin self-assigned this Nov 18, 2022
@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Merging #2020 (ae7b918) into master (57462b0) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #2020      +/-   ##
============================================
- Coverage     66.36%   66.34%   -0.02%     
+ Complexity      978      976       -2     
============================================
  Files           482      482              
  Lines         41462    41462              
  Branches       5890     5890              
============================================
- Hits          27515    27508       -7     
- Misses        11247    11255       +8     
+ Partials       2700     2699       -1     
Impacted Files Coverage Δ
.../hugegraph/backend/store/rocksdb/RocksDBTable.java 67.11% <0.00%> (-2.02%) ⬇️
...ugegraph/backend/store/raft/StoreStateMachine.java 64.86% <0.00%> (-0.91%) ⬇️
...va/com/baidu/hugegraph/backend/cache/RamCache.java 72.92% <0.00%> (-0.56%) ⬇️
...hugegraph/backend/store/raft/rpc/RaftRequests.java 18.78% <0.00%> (-0.24%) ⬇️
...hugegraph/backend/store/raft/rpc/RpcForwarder.java 69.49% <0.00%> (ø)
...om/baidu/hugegraph/backend/store/BackendTable.java 85.11% <0.00%> (+0.59%) ⬆️
...in/java/com/baidu/hugegraph/schema/IndexLabel.java 77.27% <0.00%> (+1.13%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@javeme
Copy link
Contributor

javeme commented Nov 18, 2022

java11 ci error:

Error: -18 12:24:06 [main] [ERROR] c.b.h.d.HugeGraphServer - HugeRestServer start error: 
java.lang.ExceptionInInitializerError: null
	at java.lang.Class.forName0(Native Method) ~[?:?]
	at java.lang.Class.forName(Class.java:315) ~[?:?]
	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:63) ~[gremlin-core-3.5.1.jar:3.5.1]
	at com.baidu.hugegraph.auth.StandardAuthenticator.setup(StandardAuthenticator.java:131) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	at com.baidu.hugegraph.auth.HugeAuthenticator.loadAuthenticator(HugeAuthenticator.java:146) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	at com.baidu.hugegraph.core.GraphManager.<init>(GraphManager.java:96) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	at com.baidu.hugegraph.server.ApplicationConfig$GraphManagerFactory$1.onEvent(ApplicationConfig.java:130) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	at org.glassfish.jersey.server.internal.monitoring.CompositeApplicationEventListener.onEvent(CompositeApplicationEventListener.java:49) ~[jersey-server-3.0.3.jar:?]
	at org.glassfish.jersey.server.internal.monitoring.MonitoringContainerListener.onStartup(MonitoringContainerListener.java:56) ~[jersey-server-3.0.3.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.onStartup(ApplicationHandler.java:711) ~[jersey-server-3.0.3.jar:?]
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.start(GrizzlyHttpContainer.java:330) ~[jersey-container-grizzly2-http-3.0.3.jar:?]
	at org.glassfish.grizzly.http.server.HttpHandlerChain.start(HttpHandlerChain.java:376) ~[grizzly-http-server-3.0.1.jar:3.0.1]
	at org.glassfish.grizzly.http.server.HttpServer.setupHttpHandler(HttpServer.java:268) ~[grizzly-http-server-3.0.1.jar:3.0.1]
	at org.glassfish.grizzly.http.server.HttpServer.start(HttpServer.java:245) ~[grizzly-http-server-3.0.1.jar:3.0.1]
	at com.baidu.hugegraph.server.RestServer.start(RestServer.java:73) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	at com.baidu.hugegraph.server.RestServer.start(RestServer.java:180) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	at com.baidu.hugegraph.dist.HugeRestServer.start(HugeRestServer.java:34) ~[hugegraph-dist-0.13.0.jar:?]
	at com.baidu.hugegraph.dist.HugeGraphServer.<init>(HugeGraphServer.java:62) ~[hugegraph-dist-0.13.0.jar:?]
	at com.baidu.hugegraph.dist.HugeGraphServer.main(HugeGraphServer.java:122) ~[hugegraph-dist-0.13.0.jar:?]
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make public static synchronized void jdk.internal.reflect.Reflection.registerFieldsToFilter(java.lang.Class,java.lang.String[]) accessible: module java.base does not "exports jdk.internal.reflect" to unnamed module @49070868
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340) ~[?:?]
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280) ~[?:?]
	at java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) ~[?:?]
	at java.lang.reflect.Method.setAccessible(Method.java:192) ~[?:?]
	at com.baidu.hugegraph.util.Reflection.registerFieldsToFilter(Reflection.java:89) ~[hugegraph-core-0.13.0.jar:2.1.2.0]
	at com.baidu.hugegraph.auth.HugeFactoryAuthProxy.registerPrivateActions(HugeFactoryAuthProxy.java:94) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	at com.baidu.hugegraph.auth.HugeFactoryAuthProxy.<clinit>(HugeFactoryAuthProxy.java:75) ~[hugegraph-api-0.13.0.jar:0.69.0.0]
	... 19 more

@imbajin
Copy link
Member Author

imbajin commented Nov 18, 2022

it's not easy to handle 1.7.xxx_xxx & 10.xx.xxx or 11.03.233

One way is we truncate the num before the 2nd . & trans it to int number (avoid using float)

  • 1.7.xxx_xxx --> 1.7 --> 7
  • 1.8.xxx_xxx --> 1.8 --> 8
  • 11.1.233 --> 11.1 --> 11

try this command: (check the logic)

java -version 2>&1 | head -1 | cut -d'"' -f2 | sed 's/^1\.//' | cut -d'.' -f1, it replace 1.7.xxx --> 7.xxx so that we could cut the first num to compare directly

@imbajin
Copy link
Member Author

imbajin commented Nov 18, 2022

@zyxxoo start with java11, the log alert the warning:
image

@imbajin imbajin mentioned this pull request Nov 18, 2022
15 tasks
@zyxxoo zyxxoo merged commit aa0d8da into master Nov 20, 2022
@zyxxoo zyxxoo deleted the fix-java11 branch November 20, 2022 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Bug] can't start using java11
3 participants