Closed timothynode closed 5 years ago
This seems to be the affected function: https://github.com/fwcd/KotlinLanguageServer/blob/322594f491369f51fdda33295101098d81d5bf3d/src/main/kotlin/org/javacs/kt/classpath/FindClassPath.kt#L149-L157
Could you provide a sample (Maven) project that has this bug? Which JDK version do you use?
jdk version: 1.8.0_191-b12 maven version: 3.6.0
a brief maven dep list:
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<kotlin.version>1.2.50</kotlin.version>
<dubbo.version>2.6.3</dubbo.version>
<spring-boot.version>1.5.6.RELEASE</spring-boot.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<log4j.version>2.8.1</log4j.version>
</properties>
<dependencies>
<!-- Kotlin -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>${kotlin.version}</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>Brussels-SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<!-- DB -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.43</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<!-- Log -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- other -->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.alibaba.boot</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo.version}</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
It seems I have a very similar issue with our project.
[Info - 2:21:14 PM] main Connected to client
[Info - 2:21:14 PM] client Adding workspace file:///home/user/Documenten/project/project-api to source path
[Info - 2:21:14 PM] client Adding 127 files under /home/user/Documenten/project/project-api to source path
[Info - 2:21:14 PM] client Searching for dependencies in workspace root /home/user/Documenten/project/project-api
[Info - 2:21:14 PM] client Found mvn at /opt/maven/bin/mvn
[Info - 2:21:14 PM] client Run /opt/maven/bin/mvn dependency:list -DincludeScope=test -DoutputFile=/tmp/deps4094638676465211670.txt in /home/user/Documenten/project/project-api
[Info - 2:21:15 PM] client Maven: [INFO] Scanning for projects...
[Info - 2:21:16 PM] client Maven: [INFO]
[Info - 2:21:16 PM] client Maven: [INFO] ---------------------< com.xxx.xxx.xxx:api >---------------------
[Info - 2:21:16 PM] client Maven: [INFO] Building api 0.0.1-SNAPSHOT
[Info - 2:21:16 PM] client Maven: [INFO] --------------------------------[ jar ]---------------------------------
[Info - 2:21:17 PM] client Maven: [INFO]
[Info - 2:21:17 PM] client Maven: [INFO] --- maven-dependency-plugin:3.1.1:list (default-cli) @ api ---
[Info - 2:21:18 PM] client Maven: [INFO] ------------------------------------------------------------------------
[Info - 2:21:18 PM] client Maven: [INFO] BUILD SUCCESS
[Info - 2:21:18 PM] client Maven: [INFO] ------------------------------------------------------------------------
[Info - 2:21:18 PM] client Maven: [INFO] Total time: 2.115 s
[Info - 2:21:18 PM] client Maven: [INFO] Finished at: 2019-06-20T14:21:18+02:00
[Info - 2:21:18 PM] client Maven: [INFO] ------------------------------------------------------------------------
Jun 20, 2019 2:21:18 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
SEVERE: Internal error: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:99)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 11 more
Caused by: java.lang.IllegalArgumentException: io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.36.Final:compile is not a properly formed Maven/Gradle artifact
at org.javacs.kt.classpath.FindClassPathKt.parseArtifact(FindClassPath.kt:155)
at org.javacs.kt.classpath.FindClassPathKt.parseArtifact$default(FindClassPath.kt:149)
at org.javacs.kt.classpath.FindClassPathKt.readMavenDependencyList(FindClassPath.kt:146)
at org.javacs.kt.classpath.FindClassPathKt.readPom(FindClassPath.kt:109)
at org.javacs.kt.classpath.FindClassPathKt.readProjectFile(FindClassPath.kt:94)
at org.javacs.kt.classpath.FindClassPathKt.findClassPath(FindClassPath.kt:25)
at org.javacs.kt.CompilerClassPath.refresh(CompilerClassPath.kt:13)
at org.javacs.kt.CompilerClassPath.addWorkspaceRoot(CompilerClassPath.kt:33)
at org.javacs.kt.KotlinLanguageServer.initialize(KotlinLanguageServer.kt:65)
... 16 more
[Error - 2:21:18 PM] client Internal error: java.lang.reflect.InvocationTargetException
[Error - 2:21:18 PM] Server initialization failed.
Message: Internal error.
Code: -32603
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:99)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 11 more
Caused by: java.lang.IllegalArgumentException: io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.36.Final:compile is not a properly formed Maven/Gradle artifact
at org.javacs.kt.classpath.FindClassPathKt.parseArtifact(FindClassPath.kt:155)
at org.javacs.kt.classpath.FindClassPathKt.parseArtifact$default(FindClassPath.kt:149)
at org.javacs.kt.classpath.FindClassPathKt.readMavenDependencyList(FindClassPath.kt:146)
at org.javacs.kt.classpath.FindClassPathKt.readPom(FindClassPath.kt:109)
at org.javacs.kt.classpath.FindClassPathKt.readProjectFile(FindClassPath.kt:94)
at org.javacs.kt.classpath.FindClassPathKt.findClassPath(FindClassPath.kt:25)
at org.javacs.kt.CompilerClassPath.refresh(CompilerClassPath.kt:13)
at org.javacs.kt.CompilerClassPath.addWorkspaceRoot(CompilerClassPath.kt:33)
at org.javacs.kt.KotlinLanguageServer.initialize(KotlinLanguageServer.kt:65)
... 16 more
Our pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xxx.xxx.xxx</groupId>
<artifactId>api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>api</name>
<description>Text</description>
<properties>
<java.version>1.8</java.version>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
<kotlin.version>1.3.30</kotlin.version>
<nimbus-jose-jwt.version>6.1.1</nimbus-jose-jwt.version>
<javax.servlet-api.version>3.1.0</javax.servlet-api.version>
<aws-java-sdk.version>1.11.428</aws-java-sdk.version>
<springfox-swagger2.version>2.9.2</springfox-swagger2.version>
<jacoco-maven-plugin.version>0.8.3</jacoco-maven-plugin.version>
<!--JACOCO COVERAGE SETTINGS-->
<jacoco.line>0.85</jacoco.line>
<jacoco.branch>0.66</jacoco.branch>
<jacoco.instruction>0.75</jacoco.instruction>
<jacoco.missed-classes>0</jacoco.missed-classes>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-swagger2.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus-jose-jwt.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>${aws-java-sdk.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<!--JACOCO-->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<configuration>
<excludes>
<exclude>
com/pon/project/**/*Application.class
</exclude>
<exclude>
com/pon/project/**/*ApplicationKt.class
</exclude>
<exclude>
com/pon/project/**/*DTO.class
</exclude>
<exclude>
com/pon/project/**/common/models/*.class
</exclude>
<exclude>
com/pon/project/**/auth/UserDetails.class
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>CLASS</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.line}</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.branch}</minimum>
</limit>
</limits>
</rule>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.instruction}</minimum>
</limit>
<limit implementation="org.jacoco.report.check.Limit">
<counter>CLASS</counter>
<value>MISSEDCOUNT</value>
<maximum>${jacoco.missed-classes}</maximum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSource```javascriptDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>code-quality</id>
<build>
<plugins>
</plugins>
</build>
</profile>
</profiles>
</project>
Any updates on this issue?
@ronplanken The issue seems to be that the dependency io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.36.Final:compile
contains one colon too much at the end, thus the language server does not know how to parse the artifact.
Fixed by c65b415.
Cause
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:99) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65) ... 11 more Caused by: java.lang.IllegalArgumentException: net.sf.json-lib:json-lib:jar:jdk15:2.4:compile is not a properly formed Maven/Gradle artifact at org.javacs.kt.classpath.FindClassPathKt.parseArtifact(FindClassPath.kt:155) at org.javacs.kt.classpath.FindClassPathKt.parseArtifact$default(FindClassPath.kt:149) at org.javacs.kt.classpath.FindClassPathKt.readMavenDependencyList(FindClassPath.kt:146) at org.javacs.kt.classpath.FindClassPathKt.readPom(FindClassPath.kt:109) at org.javacs.kt.classpath.FindClassPathKt.readProjectFile(FindClassPath.kt:94) at org.javacs.kt.classpath.FindClassPathKt.findClassPath(FindClassPath.kt:25) at org.javacs.kt.CompilerClassPath.refresh(CompilerClassPath.kt:13) at org.javacs.kt.CompilerClassPath.addWorkspaceRoot(CompilerClassPath.kt:33) at org.javacs.kt.KotlinLanguageServer.initialize(KotlinLanguageServer.kt:65) ... 16 more