Run Vaadin 8.1 app under Java 9 prerelease in IntelliJ 2017.2.2

放肆的年华 提交于 2019-11-26 21:55:10

问题


In IntelliJ 2017.2.2 I am able to run a Vaadin 8.1.2 app (brand-new vaadin-archetype-application archetype) with Tomcat 8.5.20 under Java 9+181 if the Project Structure > Project SDK is set to Java 1.8.

If Project Structure > Project SDK is set to Java 9 I get this compiler error around FillIn with assertion error about filling something to do with Vaadin MouseEvents. I have tried googling but found no clues.

Information:java: An exception has occurred in the compiler (9). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
Information:java:   at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:340)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:285)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1314)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:1248)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:405)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.isAccessible(Resolve.java:389)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.findImmediateMemberType(Resolve.java:2170)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMemberType(Resolve.java:2225)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Resolve.findIdentInType(Resolve.java:2403)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3588)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3453)
Information:java:   at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2104)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:713)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribType(Attr.java:706)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribBase(Attr.java:859)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$AbstractHeaderPhase.attribSuperTypes(TypeEnter.java:669)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$HierarchyPhase.runPhase(TypeEnter.java:742)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.doCompleteEnvs(TypeEnter.java:270)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$HierarchyPhase.complete(TypeEnter.java:785)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$HierarchyPhase.doCompleteEnvs(TypeEnter.java:730)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:245)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter$Phase.completeEnvs(TypeEnter.java:254)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.TypeEnter.complete(TypeEnter.java:195)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.Symbol.isInterface(Symbol.java:393)
Information:java:   at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readMethod(ClassReader.java:2353)
Information:java:   at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:2641)
Information:java:   at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2706)
Information:java:   at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2719)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:348)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1139)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1065)
Information:java:   at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.isErroneous(Type.java:1095)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclicInternal(Check.java:2316)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclicInternal(Check.java:2327)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclicInternal(Check.java:2330)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclicInternal(Check.java:2323)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Check.checkNonCyclic(Check.java:2277)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.checkBase(Attr.java:901)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Attr.attribBase(Attr.java:860)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:577)
Information:java:   at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:554)
Information:java:   at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1052)
Information:java:   at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:923)
Information:java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
Information:java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
Information:java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
Information:java:   at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
Information:java:   at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:190)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:473)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:328)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:255)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:208)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1260)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:937)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1009)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:900)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:733)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:385)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:192)
Information:java:   at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
Information:java:   at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295)
Information:java:   at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
Information:java:   at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236)
Information:java:   at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
Information:java:   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
Information:java:   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
Information:java:   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
Information:java:   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
Information:java:   at java.base/java.lang.Thread.run(Thread.java:844)
Information:java: Errors occurred while compiling module 'vnine'
Information:javac 9 was used to compile java sources
Information:Module "vnine" was fully rebuilt due to project configuration/dependencies changes
Information:2017-08-18, 15:40 - Compilation completed with 2 errors and 0 warnings in 1s 866ms
Error:java: java.lang.AssertionError: Filling jar:file:///Users/basilbourque/.m2/repository/com/vaadin/vaadin-server/8.1.2/vaadin-server-8.1.2.jar!/com/vaadin/ui/Component$Event.class during JarFileObject[/Users/basilbourque/.m2/repository/com/vaadin/vaadin-server/8.1.2/vaadin-server-8.1.2.jar:/com/vaadin/event/MouseEvents$ClickEvent.class]
Error:java:     at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)

So, two questions:

  • Can IntelliJ + Vaadin + Tomcat be made to work under Java 9 yet? (that is, running as a Java 9 project – does indeed run on Java 9 but only as a Java 8 project)
  • If so, what might be the problem in my case using a brand-new unmodified Vaadin application Maven archetype?

回答1:


Inlined as timeline

  • What might be the problem in my case using a brand-new unmodified Vaadin application Maven archetype?

To get to the root cause for your case specifically, we would surely need more details to what you've tried in terms of code definitions.

  • Can IntelliJ + Vaadin + Tomcat be made to work under Java 9 yet?*

On 22 August 2017

Yes.You can make this specific combination work. After solving the problem where I was Unable to process file module-info.class within a Java9 project results in ClassFormatException I could get the war created using mvn package to run with tomcat finally.

Details: You need to use a Java 9 compatible version of Tomcat. (apache-tomcat-9.0.0.M26 in my case) and configure it to start with

Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/

Once the server is started, you can access the application @ localhost:8080/vaadinjavanine/ where vaadinjavanine is the war file name within my tomcat's webapps folder.

On 21 August 2017

The answer specific to the combination sadly is still No. I believe it's not yet possible to make this combination work.

Jetty Server

Here's a sample application updated by me which works with IntelliJ + Vaadin + Jetty on my localhost:8080 using Jetty server, irrespective of my Project SDK being set to Java1.8 or Java9. It works something like this:

This was attained after overcoming the #jetty.project/1758 by upgrading to the 6.0_BETA of asm and asm-commons libraries and using the custom 9.4.7-SNAPSHOT built on my local used in the project(commit - #e34415.)

Tomcat Server

  1. Following the recommended way of creating a war, I 've created the application war(in my case <finalName>vaadinjavanine</finalName>) using the command:

    mvn package
    
  2. Made sure that the CATALINA_HOME/webapps included this file. Copied it basically.

  3. Started tomcat on the default port to access the url for the application: localhost:8080/vaadinjavanine/

But have ended up finding another issue in the current chain: Unable to process file module-info.class within a Java9 project results in ClassFormatException


On 20 August 2017

The answer to the question is No. What I did was, tried out creating a maven based vaadin application from scratch based out of java9, following the getting started guide. Using the following configurations:

apache-tomcat-8.0.22 

intelliJ-IDEA 2017.2.2

<vaadin.version>8.1.2</vaadin.version>

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T01:09:06+05:30)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 9, vendor: Oracle Corporation (jdk-9+181)

Created a maven module using the vaadin-archetype-application as shared in the guide shared. Updated

  1. pom.xml with

    <maven.compiler.source>1.9</maven.compiler.source>
    <maven.compiler.target>1.9</maven.compiler.target>
    
  2. Added a module-info.java to the module under development.

I was able to execute mvn package on the same but running mvn jetty:run to run the application ended up achieving MultiException | java.lang.RuntimeException: Error scanning UI and Servlet class



来源:https://stackoverflow.com/questions/45766064/run-vaadin-8-1-app-under-java-9-prerelease-in-intellij-2017-2-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!