uberJar creates app.jar with 0 Byte MANIFEST.MF

We did create a little application where the created app.jar is working perfectly.
Now we did create a second little application with the same settings and when we want to start java -jar app.jar we get the message, no main manifest attribute, in app.jar.
I see a MANIFEST.MF in the app.jar with 0 Bytes !
We have to deliver, so i added the MANIFEST.MF manually which is solving the above problem.
Now i am facing a lot of Exceptions.
19:36:50.178 ERROR c.h.c.c.s.AbstractWebAppContextLoader - Error initializing application
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [com/haulmont/cuba/spring.xml]; nested exception is java.lang.IllegalStateException: Unable to load NamespaceHandler mappings from location [META-INF/spring.handlers]
What can i do, so my jar gets builded correctly ( like in the first application ).
Thank you for your help !

Hi,
Most probably your UberJar jar file is corrupted because buildUberJar task has not in fact finished correctly.

E.g. we had similar bugs in the past: Uber Jar task goes to an infinite loop with OutOfMemory error · Issue #124 · cuba-platform/cuba-gradle-plugin · GitHub

Can you please add more information about your project?
Which CUBA platform version do you use?
Which Java version?
Are there any add-ons attached to your project?

Hi Alex
Thank you for your reply

It is a very simple basic project about data entry in a database with generated CRUD screens. I did change some table to datagrid without the editable feature, as the data is not written to the database.

Successfully i was creating several UberJar until it is now creating Jars with a 0 Byte Manifest.

It does not look like the task is not finished

10:43:22: Executing task ‘buildUberJar’…

Starting Gradle Daemon…
Gradle Daemon started in 1 s 603 ms

Task :app-core:assembleDbScripts UP-TO-DATE
Task :app-core:dbScriptsArchive UP-TO-DATE
Task :app-core:beansXml UP-TO-DATE
Task :app-global:beansXml UP-TO-DATE
Task :app-global:processResources UP-TO-DATE
Task :app-global:buildInfo UP-TO-DATE
Task :app-global:compileJava UP-TO-DATE
Task :app-global:classes UP-TO-DATE
Task :app-global:jar UP-TO-DATE
Task :app-core:compileJava NO-SOURCE
Task :app-core:processResources UP-TO-DATE
Task :app-core:classes UP-TO-DATE
Task :app-core:jar UP-TO-DATE
Task :app-core:sourceJar UP-TO-DATE
Task :app-core:assemble UP-TO-DATE
Task :app-web:buildScssThemes UP-TO-DATE
Task :app-web:beansXml UP-TO-DATE
Task :app-web:compileJava UP-TO-DATE
Task :app-web:processResources UP-TO-DATE
Task :app-web:classes UP-TO-DATE
Task :app-web:jar UP-TO-DATE
Task :app-web:sourceJar UP-TO-DATE
Task :app-web:themesJar UP-TO-DATE
Task :app-web:webArchive UP-TO-DATE
Task :app-web:assemble UP-TO-DATE
Task :buildUberJar UP-TO-DATE

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See Command-Line Interface

BUILD SUCCESSFUL in 10s
20 actionable tasks: 20 up-to-date
10:43:36: Task execution finished ‘buildUberJar’.

CUBA Platform version: 7.2.4
CUBA Studio plugin version: 13.2-191
IntelliJ version: IntelliJ IDEA 2020.1.1 (Ultimate Edition)

java version “1.8.0_251”
Java™ SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot™ 64-Bit Server VM (build 25.251-b08, mixed mode)

If you want, i can send you a copy of the project ( but not here in public )

Let me know what to do.

Thank you

Best regards

Felix

Hi Alex

This seems to be a BUG in the actual version. I made a try with the sample sessionplaner from your samples ( only the first part with the crud-screens ) and have the same problem.

This is very easy to reproduce. Just make the speaker / session definitons and try to produce a single UberJar. You get the same result as mentioned above, -> Manifest.mf with 0 Byte.

Let me know, if you can reproduce this.

Best regards

Felix

Hi,
I have managed to reproduce the bug with the sessionplanner sample project and OpenJDK 8.
Created ticket: buildUberJar create empty manifest file when using Java 8 · Issue #140 · cuba-platform/cuba-gradle-plugin · GitHub
Thanks for reporting about the problem.

As a workaround, you can switch to JDK 11.

Hello @AlexBudarov , I am having the same issue, is this bug gonna be fixed anytime soon? thank you.

Hi, I have this issue, too.

In addition i found that not only the Manifest file has 0 bytes.

Also 2 other files in LIB-INF/shared/META-INF:

spring.schemas
spring.handlers

have 0 bytes too.

A fix would be highly appreciated.

Regards
Steven

As you can see in the issue tracker, the bug will be fixed in the platform version 7.2.5. It will be released soon. Meanwhile you switch to JDK 11.

Hi Alex,

Thanks for your reply, we are currently weighing the option of upgrading from Java 8 to Java 11 or waiting for the release, is there an estimate on when the 7.2.5 will be available.

Plans are to release it within few weeks. Stay tuned :slight_smile:

Hi,
I’m having the same problem with platform 6.10.17 and 6.10.16. Is it related? Does a workaround exist?

Hi,
No, it’s not related. 6.10 branch of the code hasn’t been modified for a year. So please create a separate topic with detailed description of your problem if you have issues.