Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2730

Not possible to instantiate org.infinispan.cdi.InfinispanExtension during startup of appserver

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 5.2.1.Final, 5.3.0.Final
    • 5.2.0.Final
    • CDI
    • None

      I have infinispan-cdi library in my appserver to be able to use JSR-107.
      During startup of application server it loads the InfinispanExtension because the service provider is declared in META-INF/services.

      During startup I get the exception

      Caused by: java.util.ServiceConfigurationError: javax.enterprise.inject.spi.Extension: Provider org.infinispan.cdi.InfinispanExtension could not be instantiated: java.lang.IllegalAccessException: Class java.util.ServiceLoader$LazyIterator can not access a member of class org.infinispan.cdi.InfinispanExtension with modifiers ""
      	at java.util.ServiceLoader.fail(ServiceLoader.java:207)
      	at java.util.ServiceLoader.access$100(ServiceLoader.java:164)
      	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)
      	at java.util.ServiceLoader$1.next(ServiceLoader.java:421)
      

      The reason is that the InfinispanExtension only provides a package scoped constructor.
      For sure the documentation of java.util.ServiceLoader is not very clear here. It just says:

      "The only requirement enforced by this facility is that provider classes must have a zero-argument constructor so that they can be instantiated during loading"

      But the implementation fails if the constructor is not public. Hence, we need a public constructor for InfinispanExtension.

              ttarrant@redhat.com Tristan Tarrant
              mellenthin_jira Michael Mellenthin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: