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

IllegalAccessException trying to run Mango using Java 9 #1112

Closed
jazdw opened this Issue Oct 5, 2017 · 14 comments

Comments

Projects
3 participants
@jazdw
Contributor

jazdw commented Oct 5, 2017

Java 9 has been released, we should update Mango to work with it. This is due to using a jdk.internal class. It can be fixed by either

ERROR 2017-10-05T17:34:32,406 (com.serotonin.m2m2.rt.RuntimeManager.initializeDataSourceStartup:368) - Failed to start data point DP_279767
java.lang.RuntimeException: java.lang.IllegalAccessException: class com.infiniteautomation.tsdb.impl.IasTsdbUtils cannot access class jdk.internal.ref.Cleaner (in module java.base) because module java.base does not export jdk.internal.ref to unnamed module @59ae1544
        at com.infiniteautomation.tsdb.impl.IasTsdbUtils.clean(IasTsdbUtils.java:563) ~[ias-tsdb-1.3.4.jar:?]
        at com.infiniteautomation.tsdb.impl.ChecksumMappedByteBufferInputStream.close(ChecksumMappedByteBufferInputStream.java:210) ~[ias-tsdb-1.3.4.jar:?]
        at com.infiniteautomation.tsdb.impl.IasTsdbUtils.closeQuietly(IasTsdbUtils.java:138) ~[ias-tsdb-1.3.4.jar:?]
        at com.infiniteautomation.tsdb.impl.ReversibleShard.queryReverse(ReversibleShard.java:79) ~[ias-tsdb-1.3.4.jar:?]
        at com.infiniteautomation.tsdb.impl.CompressibleShard.queryReverse(CompressibleShard.java:387) ~[ias-tsdb-1.3.4.jar:?]
        at com.infiniteautomation.tsdb.impl.Series.query(Series.java:473) ~[ias-tsdb-1.3.4.jar:?]
        at com.infiniteautomation.tsdb.impl.IasTsdbImpl.query(IasTsdbImpl.java:458) ~[ias-tsdb-1.3.4.jar:?]
        at com.infiniteautomation.nosql.InternalGenericDao.getLatestItem(InternalGenericDao.java:124) ~[mangoNoSqlDatabase-3.2.2.jar:?]
        at com.infiniteautomation.nosql.MangoNoSqlPointValueDao.getLatestPointValue(MangoNoSqlPointValueDao.java:166) ~[mangoNoSqlDatabase-3.2.2.jar:?]
        at com.serotonin.m2m2.rt.dataImage.PointValueCache.refreshCache(PointValueCache.java:185) ~[mango-3.2.1.jar:?]
        at com.serotonin.m2m2.rt.dataImage.PointValueCache.<init>(PointValueCache.java:45) ~[mango-3.2.1.jar:?]
        at com.serotonin.m2m2.rt.dataImage.DataPointRT.<init>(DataPointRT.java:84) ~[mango-3.2.1.jar:?]
        at com.serotonin.m2m2.rt.RuntimeManager.startDataPointStartup(RuntimeManager.java:482) ~[mango-3.2.1.jar:?]
        at com.serotonin.m2m2.rt.RuntimeManager.initializeDataSourceStartup(RuntimeManager.java:366) [mango-3.2.1.jar:?]
        at com.serotonin.m2m2.rt.DataSourceGroupInitializer$DataSourceSubGroupInitializer.run(DataSourceGroupInitializer.java:152) [mango-3.2.1.jar:?]
        at com.serotonin.timer.Task.runTask(Task.java:179) [mango-3.2.1.jar:?]
        at com.serotonin.timer.TaskWrapper.run(TaskWrapper.java:23) [mango-3.2.1.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) [?:?]
        at java.lang.Thread.run(Thread.java:844) [?:?]
@jazdw

This comment has been minimized.

Contributor

jazdw commented Oct 5, 2017

Command line options to workaround this particular exception -
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED

@jazdw

This comment has been minimized.

Contributor

jazdw commented Oct 5, 2017

Also related:

INFO  2017-10-05T17:47:33,358 (com.serotonin.m2m2.Lifecycle.initialize:192) - Initializing Spring Object Mapper
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.eclipse.jetty.util.BufferUtil (file:/C:/Users/Jared/test-mango/lib/jetty-util-9.3.11.v20160721.jar) to field java.nio.MappedByteBuffer.fd
WARNING: Please consider reporting this to the maintainers of org.eclipse.jetty.util.BufferUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
@jazdw

This comment has been minimized.

Contributor

jazdw commented Oct 5, 2017

There are also issues with JSP pages as discussed at spring-projects/spring-boot#10456

org.apache.jasper.JasperException: /WEB-INF/jsp/dataSourceProperties.jsp (line: 6, column: 0) The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
        at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:275) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:91) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:335) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:368) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:471) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1435) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Parser.parse(Parser.java:139) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) ~[apache-jsp-8.0.33.jar:2.3]
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) ~[apache-jsp-8.0.33.jar:2.3]
        at org.eclipse.jetty.jsp.JettyJspServlet.service(JettyJspServlet.java:108) ~[apache-jsp-9.3.11.v20160721.jar:9.3.11.v20160721]
...snip
@jazdw

This comment has been minimized.

Contributor

jazdw commented Oct 6, 2017

Also launching Mango using a Java 9 runtime from Eclipse is broken (on Windows at least)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=522333

edit. The issue I linked to is actually talking about running Maven from within Eclipse, the m2e plugin v1.8.2.20171005-1844 does fix this but I still can't launch Mango from within Eclipse using Java 9.

@Puckfist

This comment has been minimized.

Contributor

Puckfist commented Oct 6, 2017

For dodging the cleaner issue you can use a different database stream type. Only MappedByteBuffer requires the cleaner

@Puckfist

This comment has been minimized.

Contributor

Puckfist commented Mar 19, 2018

@terrypacker terrypacker removed this from To do in Mango Current Release Apr 4, 2018

@jazdw

This comment has been minimized.

Contributor

jazdw commented Apr 12, 2018

I've updated Jetty to the latest 9.3.x release which should support Java 9.

6722453

@jazdw

This comment has been minimized.

Contributor

jazdw commented Apr 12, 2018

@terrypacker any reason were not going to fix this issue for Mango 3.4? It really should be fixed ASAP given that Java 10 has now been released.

@terrypacker

This comment has been minimized.

Contributor

terrypacker commented Apr 12, 2018

I'm happy to put it on the list for 3.4

@terrypacker terrypacker added this to To do in Mango Current Release via automation Apr 12, 2018

@terrypacker terrypacker moved this from To do to In progress in Mango Current Release Apr 16, 2018

@terrypacker

This comment has been minimized.

Contributor

terrypacker commented Apr 17, 2018

After fixing the Database Cleaner problem and using the latest Eclipse I could launch Mango in Eclipse. However we still have some outstanding problems:

  • [jetty-alpn-agent] Could not find a matching alpn-boot JAR for Java version: 9.0.4
  • WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1

Looks like our version of Spring needs to be updated to 5+ and the Jetty ALPN agent only works for Java 7 and 8.

@terrypacker

This comment has been minimized.

Contributor

terrypacker commented Apr 17, 2018

When we move to Spring 5 we will need at least Jetty 9.4

@Puckfist

This comment has been minimized.

Contributor

Puckfist commented Apr 17, 2018

I think we're going to see more of those illegal reflective access messages mayhaps. I saw this one building the UI module:
WARNING: Illegal reflective access by com.thoughtworks.xstream.converters.collections.TreeMapConverter (file:/C:/Users/Phillip/.m2/repository/com/thoughtworks/xstream/xstream/1.4.4/xstream-1.4.4.jar) to field java.util.TreeMap.comparator

@Puckfist

This comment has been minimized.

Contributor

Puckfist commented Apr 17, 2018

The cleaner works!

@terrypacker terrypacker moved this from In progress to To do in Mango Current Release Apr 17, 2018

@terrypacker terrypacker moved this from To do to Future in Mango Current Release Apr 18, 2018

@terrypacker terrypacker added this to To do in Mango 3.5.3 Oct 15, 2018

@terrypacker terrypacker closed this Nov 6, 2018

Mango Current Release automation moved this from Future to Done Nov 6, 2018

Mango 3.5.3 automation moved this from To do to Done Nov 6, 2018

@jazdw

This comment has been minimized.

Contributor

jazdw commented Nov 7, 2018

@Puckfist re "The cleaner works!", does this mean we can use db.nosql.shardStreamType=MAPPED_BYTE_BUFFER on Windows with JDK >=9? We should document the supported modes on each OS and JDK.

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