Bug #11266
Filename of extension too long in Windows during import
0%
History
#1 Updated by Dănuț Filimon 5 months ago
I got the following error while running and import.db in hotel_gui, Windows, java 17:
create.db.h2:
BUILD FAILED
C:\gcd\hotel_gui\build.xml:1114: The following error occurred while executing this line:
C:\gcd\hotel_gui\build.xml:1046: The following error occurred while executing this line:
C:\gcd\hotel_gui\build.xml:1092: The following error occurred while executing this line:
C:\gcd\hotel_gui\build_db.xml:53: java.io.IOException: Cannot run program "C:\tools\java\java17\bin\java.exe" (in directory "C:\gcd\hotel_gui"): CreateProcess error=206, The filename or extension is too long
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
at java.base/java.lang.Runtime.exec(Runtime.java:594)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:424)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:438)
at org.apache.tools.ant.taskdefs.Java.fork(Java.java:912)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:229)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:136)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:109)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at java.base/java.util.Vector.forEach(Vector.java:1365)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:67)
at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:217)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:155)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at java.base/java.util.Vector.forEach(Vector.java:1365)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:67)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:391)
at net.sf.antcontrib.logic.ForTask.doSequentialIteration(ForTask.java:259)
at net.sf.antcontrib.logic.ForTask.doToken(ForTask.java:268)
at net.sf.antcontrib.logic.ForTask.doTheTasks(ForTask.java:299)
at net.sf.antcontrib.logic.ForTask.execute(ForTask.java:244)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:106)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
at org.apache.tools.ant.Main.runBuild(Main.java:818)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
... 84 more
The workaround is to place hotel_gui directly in C:\, but there should not be a limit on the filename length in the first place.
#2 Updated by Ovidiu Maxiniuc 5 months ago
I think the problem here is the classpath, not the size of filename / extension. Moving the project directly into root will have the indirect effect that the paths to the jars are all shorter and the final command will fit into 8Ki limit imposed by Windows.
To fix this we need to:- clean the old versions of jars in the
build/libordeploy/lib; - reduce the number of dependencies as possible;
- using the manifest method instead of
classpath; - JDK9 supports argument files, like:
java @args.txt ....
I think we already have third implemented so the classpath does not really need all jars, just the 'top-level' jars (p2j, spi and application, I guess). This should work on Linux as well. But the first two should also used periodically.
If the first 3 are not enough, writing the argument to a temporary file and then passing it to java executable (aka 4th solution) instead of passing them directly will definitely solve the issue.
#3 Updated by Greg Shah 5 months ago
Item 3 is the most important. We need to fix our scripting to not be stupid.
But the first two should also used periodically.
Agreed.
writing the argument to a temporary file and then passing it to java executable (aka 4th solution)
I really want to avoid this. Creating temp files is nasty business because it requires write permissions and cleanup of files and it is just a poor design.
#4 Updated by Ovidiu Maxiniuc 5 months ago
I know we recently dropped ant as a tool for building FWD. But in this case, ant is used to do in database import. I think we should use gradle for all these tasks and drop the dependency on ant completely. In addition, some customers use import scripts, similar to the one we provide.
#5 Updated by Dănuț Filimon 5 months ago
I did try to use the 4th option after also discovering that the classpath is the issue, the ScriptRUnner class could nto be found. In the end I moved hotel_gui to C:\ instead of C:\gcd
#6 Updated by Ovidiu Maxiniuc 5 months ago
For ScriptRunner I think the classpath only need to contain fwd, fwdspi (H2 only) and the db-specific driver jar. Try to alter app.classpath, or better define a specific import.classpath to verify my assumption.