Symptoms
User attempts to run a query in the JPA console and encounters the error:
CreateProcess error=206, The filename or extension is too long
The error persists across multiple versions of IntelliJ IDEA and affects users on the Windows operating system.
Detailed stacktrace:
java.io.IOException: Cannot run program "C:\dev\jdk8\jre\bin\java" (in directory "C:\dev\idea\bin"): CreateProcess error=206, Nom de fichier ou extension trop long
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:379)
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:365)
at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:45)
at com.intellij.execution.configurations.SimpleJavaParameters.createOSProcessHandler(SimpleJavaParameters.java:156)
at com.intellij.database.run.ConsoleRunConfiguration$3.startProcess(ConsoleRunConfiguration.java:158)
at com.intellij.database.run.ConsoleRunConfiguration$3.execute(ConsoleRunConfiguration.java:151)
at com.intellij.execution.rmi.RemoteProcessSupport.a(RemoteProcessSupport.java:209)
at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:136)
at com.intellij.jpa.engine.JpaConnectionManagerImpl.getConnection(JpaConnectionManagerImpl.java:55)
at com.intellij.jpa.engine.JpaEngine.createConnection(JpaEngine.java:96)
at com.intellij.jpa.engine.JpaEngine.ensureInitialized(JpaEngine.java:89)
at com.intellij.jpa.engine.JpaEngine.createQuery(JpaEngine.java:103)
at com.intellij.jpa.engine.JpaEngineBase.executeQueryInner(JpaEngineBase.java:149)
at com.intellij.jpa.engine.JpaEngineBase.lambda$queryData$0(JpaEngineBase.java:116)
at com.intellij.database.console.AbstractEngine.lambda$submitRequest$3(AbstractEngine.java:171)
at com.intellij.database.console.AbstractEngine.lambda$submitRunnable$2(AbstractEngine.java:148)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: CreateProcess error=206, Nom de fichier ou extension trop long
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 21 more
Cause
This error arises when the command line length exceeds the limits of the operating system. In Windows, this limit is 8191 characters for cmd.exe. In this case, the command that starts the JPA console exceeds this limit, thereby leading to the issue.
Resolution
The issue can be resolved by enabling the "dynamic classpath" feature in IntelliJ IDEA. This is achieved by modifying the .idea/workspace.xml file in your project. To do this, add the following JSON formatted line:
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"dynamic.classpath": "true"
...
}
}]]></component>
This modification tells IntelliJ IDEA to use a dynamic classpath, thus reducing the length of the command line, ultimately resolving the issue.
However, please note that this is considered a workaround.
Ref: JPA console over Hibernate and Maven fails with CreateProcess error=206 on Windows
Comments
0 comments
Please sign in to leave a comment.