Run Vaadin 8.1 app under Java 9 prerelease in IntelliJ 2017.2.2
Asked Answered
Y

1

3

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?
Yiyid answered 18/8, 2017 at 23:2 Comment(5)
Could you please share the code you're using for trying this out.Unstopped
@nullpointer After my own project failed with settings described above, I tried a brand-new project generated from the first Maven archetype listed here. I never touched the Java code, did not even open the Java files.Yiyid
Seems like sadly the answer to the question could be NO yet. Tried creating a project using Jetty instead of Tomcat. Was able to package war. But neither does the .war works in tomcat(getting 404 even after the war is placed in webapps) and on the other hand with jetty ended up with another issue!Unstopped
finally a solution to this was found. Have updated the answer.Unstopped
See Vaadin blog post: More on Java 9 compatibilityYiyid
U
2

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:

Vaadin default application

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

Unstopped answered 21/8, 2017 at 19:0 Comment(2)
Thanks for your efforts and updates. Since Tomcat 9 is not yet recommended, the answer is still "No" for running the mainstream Tomcat 8.5.x. As for your first sentence, my case is not specific at all. I simply ran the initial app created automatically be the Vaadin.com-provided Maven archetype documented in Question. No code of my own at all.Yiyid
FYI: See Vaadin blog post: More on Java 9 compatibilityYiyid

© 2022 - 2024 — McMap. All rights reserved.