question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uber Jar created from maven-shade-plugin failed on application startup

See original GitHub issue

Environment Details

  • Helidon Version: 1.4.1
  • Helidon MP
  • JDK version: Open JDK 8
  • OS: Window 10

Problem Description

Plugin :

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-shade-plugin</artifactId>
	<executions>
		<execution>
			<phase>package</phase>
			<goals>
				<goal>shade</goal>
			</goals>
			<configuration>
				<transformers>
					<transformer
						implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
						<mainClass>${mainClass}</mainClass>
					</transformer>
					<transformer
						implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
						<resource>META-INF/beans.xml</resource>
					</transformer>
				</transformers>
			</configuration>
		</execution>
	</executions>
</plugin>

Console output

Feb 06, 2020 6:08:13 PM io.helidon.microprofile.server.Main configureLogging
INFO: Logging configured using defaults
Feb 06, 2020 6:08:13 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 3.1.1 (Final)
Feb 06, 2020 6:08:14 PM org.jboss.weld.environment.deployment.discovery.DiscoveryStrategyFactory create
INFO: WELD-ENV-000020: Using jandex for bean discovery
Feb 06, 2020 6:08:18 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: Exception List with 2 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type double with qualifiers @ConfigProperty
  at injection point [BackedAnnotatedParameter] Parameter 2 of [BackedAnnotatedConstructor] @Inject io.helidon.health.checks.DiskSpaceHealthCheck(@ConfigProperty File, @ConfigProperty double)
  at io.helidon.health.checks.DiskSpaceHealthCheck.<init>(DiskSpaceHealthCheck.java:0)

        at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:378)
        at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:290)
        at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:143)
        at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
        at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:526)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:64)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:62)
        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
        at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
        at org.jboss.weld.executor.CommonForkJoinPoolExecutorServices.lambda$wrap$0(CommonForkJoinPoolExecutorServices.java:70)
        at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Steps to reproduce

mvn clean package java -jar target\microservice-starter-helidon.jar

https://github.com/ERS-HCL/microservice-starter/tree/master/microservice-starter-helidon

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tomas-langercommented, Feb 6, 2020

You can run your application, but you need to exclude some features from Helidon (as these depend on the beans.xml not being present in their jar file). Change your dependency on Helidon as follows:

<dependency>
    <groupId>io.helidon.microprofile.bundles</groupId>
    <artifactId>helidon-microprofile</artifactId>
    <exclusions>
        <exclusion>
            <groupId>io.helidon.microprofile.tracing</groupId>
            <artifactId>helidon-microprofile-tracing</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.helidon.microprofile.metrics</groupId>
            <artifactId>helidon-microprofile-metrics2</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.helidon.microprofile.jwt</groupId>
            <artifactId>helidon-microprofile-jwt-auth-cdi</artifactId>
        </exclusion>
        <exclusion>
            <groupId>io.helidon.microprofile</groupId>
            <artifactId>helidon-microprofile-fault-tolerance</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Modify your shade plugin configuration as follows:

<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
0reactions
tomas-langercommented, Feb 6, 2020

Closing this issue as

  • the application now works (even though some Helidon features are not available)
  • we have a follow up issue to fix the remaining features
Read more comments on GitHub >

github_iconTop Results From Across the Web

Uber Jar created from maven-shade-plugin failed on ... - GitHub
Hello, in general we prefer (and support) deployment with multiple jars (as is created with our quickstarts), due to issues with resources in...
Read more >
Jersey fails when creating uber jar with maven-assembly-plugin
The problem this poses when creating an uber jar is that there may be multiple jars with the same file, as different jars...
Read more >
Building and running Drools in a fat jar not working starting 7.45
At runtime, we see the error message "There already exists an implementation for service org.kie.api.KieServices with same priority 0".
Read more >
How to create executable JAR for camel-main project
You need to use maven-shade-plugin to create executable JAR. Be aware that uber jar is not fully tested feature and it is Your...
Read more >
Java Deployment Options | Cloud Functions Documentation
An uber JAR is a JAR file that contains the function classes as well as all of its dependencies. You can build an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found