Skip to content

Jakarta Data Repository in Startup caused classloader error #25784

@hantsy

Description

@hantsy

GlassFish Version (and build number)

8.0.0-M14

JDK version

21

OS

Windows 10 Pro

Database

Built-in Derby

Problem Description

I tried to use CDI Startup event observation or EJB @Singleton/Startup with a @PostConstruct method to initialize some Sample Data, failed.

After digging into the Glassfish server.log, there are some class loading exception when deploying the archive.

A sample DataInitializer written with CDI, like this.

@Transactional
@ApplicationScoped
//@Singleton
//@Startup
public class DataInitializer {

    @Inject
    PostRepository postRepository;

    @Inject
    CommentRepository commentRepository;

    public void init(@Observes Startup event) {}

The test classes:
https://github.com/hantsy/jakartaee11-sandbox/blob/master/data/src/test/java/com/example/it/RepositoryWithDataInitializerTest.java

https://github.com/hantsy/jakartaee11-sandbox/blob/master/data/src/test/java/com/example/it/RepositoryWithEjbDataInitializerTest.java

Steps to reproduce

  1. Clone https://github.com/hantsy/jakartaee11-sandbox/blob/master/data
  2. Run the above two tests.

The Glassfish server.log uploaded on Github actions.

https://github.com/hantsy/jakartaee11-sandbox/actions/runs/19353316149/artifacts/4564248729

Impact of Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions