Illegal char <:> at index 2: /D:/kotlintworkspace解决办法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Illegal char <:> at index 2: /D:/kotlintworkspace解决办法相关的知识,希望对你有一定的参考价值。


fun findRiOrders(): List<PlatformRiOrder> 
val riPath = ClassLoaderUtils.getDefaultClassLoader().getResource("NewBillTestDataRiOrders.json")!!.path
return objectMapper.readValue(Path(riPath).toFile())

IDEA报错信息

<:> at index 2: /D:/kotlintworkspace/fastone-billing/services/billing-mgr/build/resources/test/NewBillTestDataRiOrders.json
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /D:/kotlintworkspace/fastone-billing/services/billing-mgr/build/resources/test/NewBillTestDataRiOrders.json
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at com.fastonetech.billing.bill.domain.NewBillTestKt.findRiOrders(NewBillTest.kt:89)
at com.fastonetech.billing.bill.domain.NewBillTest$1$3.invokeSuspend(NewBillTest.kt:71)
at com.fastonetech.billing.bill.domain.NewBillTest$1$3.invoke(NewBillTest.kt)
at com.fastonetech.billing.bill.domain.NewBillTest$1$3.invoke(NewBillTest.kt)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invokeSuspend(executions.kt:13)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2$1.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt.wrapTestWithGlobalAssert(executions.kt:39)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invokeSuspend(executions.kt:12)
at io.kotest.core.internal.ExecutionsKt$executeWithBehaviours$2.invoke(executions.kt)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invokeSuspend(executions.kt:25)
at io.kotest.core.internal.ExecutionsKt$wrapTestWithAssertionModeCheck$2.invoke(executions.kt)
at io.kotest.core.internal.AssertionsCheckKt.executeWithAssertionsCheck(assertionsCheck.kt:25)
at io.kotest.core.internal.ExecutionsKt.wrapTestWithAssertionModeCheck(executions.kt:24)
at io.kotest.core.internal.ExecutionsKt.executeWithBehaviours(executions.kt:11)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invokeSuspend(TestCaseExecutor.kt:266)
at io.kotest.core.internal.TestCaseExecutor$executeInScope$2.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at io.kotest.core.internal.TestCaseExecutor.executeInScope(TestCaseExecutor.kt:260)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1$3$1$1.invokeSuspend(TestCaseExecutor.kt:232)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1$3$1$1.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100)
at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:44)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1$3$1.invokeSuspend(TestCaseExecutor.kt:231)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1$3$1.invoke(TestCaseExecutor.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$3.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$3.invoke(ExecutorExecutionContext.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at io.kotest.engine.ExecutorExecutionContext.executeWithTimeoutInterruption(ExecutorExecutionContext.kt:75)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1$3.invokeSuspend(TestCaseExecutor.kt:230)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1$3.invoke(TestCaseExecutor.kt)
at io.kotest.mpp.ReplayKt.replay(replay.kt:18)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1.invokeSuspend(TestCaseExecutor.kt:225)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$3.invokeSuspend(ExecutorExecutionContext.kt:77)
at io.kotest.engine.ExecutorExecutionContext$executeWithTimeoutInterruption$3.invoke(ExecutorExecutionContext.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:165)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at io.kotest.engine.ExecutorExecutionContext.executeWithTimeoutInterruption(ExecutorExecutionContext.kt:75)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1.invokeSuspend(TestCaseExecutor.kt:218)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2$1.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100)
at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:148)
at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:44)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2.invokeSuspend(TestCaseExecutor.kt:217)
at io.kotest.core.internal.TestCaseExecutor$executeAndWait$2.invoke(TestCaseExecutor.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.SupervisorKt.supervisorScope(Supervisor.kt:61)
at io.kotest.core.internal.TestCaseExecutor.executeAndWait(TestCaseExecutor.kt:213)
at io.kotest.core.internal.TestCaseExecutor.invokeTestCase(TestCaseExecutor.kt:182)
at io.kotest.core.internal.TestCaseExecutor.executeActiveTest(TestCaseExecutor.kt:151)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor.executeIfActive(TestCaseExecutor.kt:115)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invokeSuspend(TestCaseExecutor.kt:89)
at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invoke(TestCaseExecutor.kt)
at io.kotest.core.internal.TestCaseExecutor.intercept(TestCaseExecutor.kt:103)
at io.kotest.core.internal.TestCaseExecutor.execute(TestCaseExecutor.kt:69)
at io.kotest.engine.spec.runners.InstancePerTestSpecRunner$run$2.invokeSuspend(InstancePerTestSpecRunner.kt:155)
at io.kotest.engine.spec.runners.InstancePerTestSpecRunner$run$2.invoke(InstancePerTestSpecRunner.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at io.kotest.engine.spec.runners.InstancePerTestSpecRunner.run(InstancePerTestSpecRunner.kt:119)
at io.kotest.engine.spec.runners.InstancePerTestSpecRunner.interceptAndRun(InstancePerTestSpecRunner.kt:113)
at io.kotest.engine.spec.runners.InstancePerTestSpecRunner.executeInCleanSpec(InstancePerTestSpecRunner.kt:104)
at io.kotest.engine.spec.runners.InstancePerTestSpecRunner$execute$$inlined$invoke$lambda$2.invokeSuspend(InstancePerTestSpecRunner.kt:82)
at io.kotest.engine.spec.runners.InstancePerTestSpecRunner$execute$$inlined$invoke$lambda$2.invoke(InstancePerTestSpecRunner.kt)
at io.kotest.engine.launchers.SequentialTestLauncher$launch$$inlined$forEach$lambda$1$1.invokeSuspend(SequentialTestLauncher.kt:22)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

修改后的代码:

fun findRiOrders(): List<PlatformRiOrder> 
val riPath = ClassLoaderUtils.getDefaultClassLoader().getResource("NewBillTestDataRiOrders.json")!!.toURI()
return objectMapper.readValue(Paths.get(riPath).toFile())


以上是关于Illegal char <:> at index 2: /D:/kotlintworkspace解决办法的主要内容,如果未能解决你的问题,请参考以下文章

java.lang.IllegalArgumentException: Illegal character in query at index

调用Http get 接口报错:java.lang.IllegalArgumentException: Illegal character in query at index 解决办法

HTTP错误:java.lang.IllegalArgumentException: Illegal character in scheme at index 0: ?http://xxxxxx(代码

调用Http get 接口报错:java.lang.IllegalArgumentException: Illegal character in query at index 解决办法

使用httpclient调用url出现错误Illegal character in scheme name at index 0解决方案

链路追踪 Zipkin+Sleuth 解决 Illegal character in scheme name at index 0: 192.168.100.130:9411/xxx/xx