Re: Classpath 4082 char limit and jars directories not classloading

Miguel <[email protected]> Mon, 10 Mar 2025 10:43:07 -0700
Newsgroups gmane.comp.jakarta.commons.user
Message-ID <[email protected]>
Hi Mandas,

Indeed a very good point. It was my first attempt: put only the main on 
Commons Daemon Classpath and let java find the other jars listed in 
manifest.
The main jar already has the Class-Path in the META-INF/MANIFEST.mf 
(done by maven-dependency-plugin and maven-jar-plugin) but the jars were 
not found, so I resorted to list the full jar list on Commons Daemon 
Classpath.
Thinking about that, the jars have a directory prefix. Will retest after 
deleting the directory prefix and report the result.


Regards,

Miguel Ruiz Velasco Sobrino
Director de Investigación y Desarrollo
FCM Computacion Mexicana SAPI de CV
http://fcm.com.mx   (55)5682-0041
.

On 09/03/25 12:38, Mantas Gridinas wrote:
> Seems tangental, but why not write the classpath into your main jar's
> manifest classpath entry instead?
>
> On Sun, Mar 9, 2025 at 7:32 PM Gary D. Gregory <[email protected]> wrote:
>
>> A possible proposal would be to 4x the following:
>>
>> #define SIZ_RESLEN         256
>> #define SIZ_BUFLEN         512
>> #define SIZ_DESLEN         1024
>> #define SIZ_HUGLEN         8192
>> #define SIZ_PATHLEN        4096
>>
>> Gary
>>
>> On 2025/03/09 19:12:06 "Gary D. Gregory" wrote:
>>> Hello Miguel,
>>>
>>> Looking at Git master, I see that all of our path buffers are 4096 bytes.
>>>
>>> We could double or quadruple that limit for the next release 1.4.2.
>>>
>>> You can make and test this change locally by cloning the git repository
>> and follow the readme file in src\native\windows (or src\native\unix).
>>> In the meantime I would update to 1.4.1 to make sure all is well there.
>>>
>>> Gary
>>>
>>> On 2025/03/07 18:43:40 Miguel Ruiz Velasco Sobrino wrote:
>>>> Hi,
>>>>
>>>> While using Apache Commons Daemon 1.3.4 (on Windows 7) in JVM mode to
>>>> lauch an spring boot application, I found the following 2 issues:
>>>>
>>>> #1 only finds the classes if the jars at Classpath are located at
>>>> StartPath directory (a very workarround-able issue).
>>>>
>>>> #2 Also classpath has a 4082 (undocumented) char limit (harder problem
>>>> with springboot that adds lots of transitive (potentially unused)
>>>> dependencies), had luck this time with 122 jars.
>>>>
>>>> What options do I have to solve this? (specially #2).
>>>>
>>>> Please find below evidence of
>>>>
>>>> * All .jar in the StartPath directory (works):
>>>>
>>>> prunsrv.exe //IS//cfdifacturar --Classpath=* ... --StartPath=%BASE%
>>>> --StartMode=jvm -->
>>>>
>>>> [2025-03-06 13:41:53] [debug] ( javajni.c:822
>>>> :apxJavaInitialize          ) [12892] JVM Option[1]
>>>>
>> -Djava.class.path=camel-api-4.10.0.jar;...;spring-tx-5.3.31.jar;txw2-2.3.9.jar
>>>> * Jars inside directory under --StartPath (does Not work)
>>>>
>>>> prunsrv.exe //IS//cfdifacturar
>>>> --Classpath=file-integration-0.0.1-SNAPSHOT.jar;i\* --StartPath=%BASE%
>>>> --StartMode=jvm  -->
>>>>
>>>> [2025-03-07 10:59:57] [debug] ( javajni.c:822
>>>> :apxJavaInitialize          ) [11108] JVM Option[1]
>>>>
>> -Djava.class.path=file-integration-0.0.1-SNAPSHOT.jar;i\camel-api-4.10.0.jar;i\camel-attachments-4.10.0.jar;
>>
>>>> ...
>>>>
>> ;i\spring-expression-5.3.31.jar;i\spring-jcl-5.3.31.jar;i\spring-tx-5.3.31.jar;i\txw2-2.3.9.jar
>>>> It does not find any jar in directory (i/)
>>>>
>>>>
>>>> * This truncates the classpath to 4082 chars (even does not find any
>> jar):
>>>> prunsrv.exe //IS//cfdifacturar
>>>> --Classpath=file-integration-0.0.1-SNAPSHOT.jar;i\*  ...
>>>> --StartPath=%BASE% --StartMode=jvm -->  -->
>>>>
>>>> [2025-03-07 10:55:12] [debug] ( javajni.c:822
>>>> :apxJavaInitialize          ) [10772] JVM Option[1]
>>>>
>> -Djava.class.path=file-integration-0.0.1-SNAPSHOT.jar;import_lib\camel-api-4.10.0.jar;import_lib\camel-attachments-4.10.0.jar;
>>
>>>> ... ;import_lib\spring-boot-starter-2.7.18.j
>>>>
>>>> prunsrv.exe //IS//cfdifacturar
>>>>
>> --Classpath=file-%BASE%\file-integration-0.0.1-SNAPSHOT.jar;%BASE%\import_lib\*
>>
>>>> ...  --StartPath=%BASE% --StartMode=jvm -->  -->
>>>>
>>>> [2025-03-07 10:42:25] [debug] ( javajni.c:822
>>>> :apxJavaInitialize          ) [ 5664] JVM Option[1]
>>>>
>> -Djava.class.path=file-C:\eclipsework\abis-oracle\file-integration\target\file-integration-0.0.1-SNAPSHOT.jar;C:\eclipsework\abis-oracle\file-integration\target\import_lib\camel-api-4.10.0.jar;
>>
>>>> ... ;C:\eclipsework\abis-oracle\file-integra
>>>>
>>>> Thanks for any pointer on the above issues.
>>>>
>>>> Regards,
>>>>
>>>> --
>>>> Miguel Ruiz Velasco Sobrino
>>>> FCM Computación Mexicana
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>