Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application in Helidon MP JPA Guide fails with java.lang.ClassNotFoundException: javax.transaction.SystemException #4154

Closed
david-guzman opened this issue Apr 24, 2022 · 1 comment · Fixed by #4170
Assignees
Milestone

Comments

@david-guzman
Copy link

Environment Details

  • Helidon Version: 2.5.0
  • Helidon MP
  • JDK version: 11.0.14.1
  • OS: Linux (Ubuntu 21.10)
  • Docker version (if applicable): Not used
  • Maven: 3.6.3

Problem Description

Following the steps in the Helidon MP JPA Guide https://helidon.io/docs/v2/#/mp/guides/09_jpa
generates an error when running the application with java -jar target/helidon-mp.jar

$ java -jar target/helidon-jpa.jar 
2022.04.24 18:29:07 INFO io.helidon.common.LogConfig Thread[main,5,main]: Logging at initialization configured using classpath: /logging.properties
Exception in thread "main" java.util.ServiceConfigurationError: Error instantiating :io.helidon.integrations.jta.cdi.NarayanaExtension
	at org.jboss.weld.util.ServiceLoader.createInstance(ServiceLoader.java:315)
	at org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:247)
	at org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:215)
	at org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:185)
	at org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:165)
	at org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:289)
	at org.jboss.weld.util.collections.Iterables.addAll(Iterables.java:45)
	at org.jboss.weld.environment.se.Weld.getExtensions(Weld.java:1058)
	at org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:947)
	at io.helidon.microprofile.cdi.HelidonContainerImpl.init(HelidonContainerImpl.java:180)
	at io.helidon.common.context.Contexts.runInContext(Contexts.java:137)
	at io.helidon.microprofile.cdi.HelidonContainerImpl.initInContext(HelidonContainerImpl.java:136)
	at io.helidon.microprofile.cdi.HelidonContainerImpl.create(HelidonContainerImpl.java:128)
	at io.helidon.microprofile.cdi.BuildTimeInitializer.createContainer(BuildTimeInitializer.java:51)
	at io.helidon.microprofile.cdi.BuildTimeInitializer.<clinit>(BuildTimeInitializer.java:31)
	at io.helidon.microprofile.cdi.ContainerInstanceHolder.fromBuildTimeInitializer(ContainerInstanceHolder.java:58)
	at io.helidon.microprofile.cdi.ContainerInstanceHolder.get(ContainerInstanceHolder.java:50)
	at io.helidon.microprofile.cdi.Main.<clinit>(Main.java:55)
Caused by: java.lang.NoClassDefFoundError: javax/transaction/SystemException
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
	at java.base/java.lang.Class.getConstructor0(Class.java:3342)
	at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2553)
	at org.jboss.weld.util.ServiceLoader.createInstance(ServiceLoader.java:311)
	... 17 more
Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 22 more

The guide has this configuration for the JPA and JTA dependencies:

<dependency>
    <groupId>jakarta.persistence</groupId>
    <artifactId>jakarta.persistence-api</artifactId>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>jakarta.transaction</groupId>
    <artifactId>jakarta.transaction-api</artifactId>
    <scope>provided</scope>
</dependency>

Removing the provided scope for JTA allows the application to run

Steps to reproduce

Follow the Helidon MP JPA Guide step by step https://helidon.io/docs/v2/#/mp/guides/09_jpa
Starting with a clean project

mvn -U archetype:generate \
    -DinteractiveMode=false \
    -DarchetypeGroupId=io.helidon.archetypes \
    -DarchetypeArtifactId=helidon-bare-mp \
    -DarchetypeVersion=2.5.0 \
    -DgroupId=io.helidon.example \
    -DartifactId=helidon-jpa \
    -Dpackage=io.helidon.example.jpa
@m0mus m0mus added this to the 2.5.1 milestone Apr 28, 2022
@dalexandrov
Copy link
Contributor

dalexandrov commented May 1, 2022

Fixed example for Helidon 3.x with #4132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants