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.

quarkus-extensions should include its jandex index

See original GitHub issue

Describe the bug I start a quarkus-app with quarkus-extensions. It compiles and works, but I get this warning message:


[WARNING] [io.quarkus.deployment.steps.ReflectiveHierarchyStep] 
Unable to properly register the hierarchy of the following classes 
for reflection as they are not in the Jandex index:
	- com.github.benmanes.caffeine.cache.Cache
	- com.github.benmanes.caffeine.cache.Policy$Eviction
	- io.reactivex.Scheduler
	- io.reactivex.functions.Predicate
	- io.reactivex.internal.fuseable.SimplePlainQueue
	- javax.crypto.Cipher
	- javax.crypto.KeyAgreement
	- javax.crypto.SecretKey
	- javax.enterprise.context.spi.Contextual
	- javax.enterprise.context.spi.CreationalContext
	- javax.enterprise.event.Event
	- javax.management.MBeanAttributeInfo
	- javax.management.MBeanInfo
	- javax.management.MBeanOperationInfo
	- javax.management.MBeanServer
	- javax.management.ObjectName
	- javax.naming.directory.DirContext
	- javax.net.ssl.SSLContext
	- javax.net.ssl.SSLServerSocket
	- javax.persistence.EntityManager
	- javax.security.auth.Subject
	- javax.security.auth.callback.CallbackHandler
	- javax.security.sasl.SaslClient
	- javax.security.sasl.SaslClientFactory
	- javax.security.sasl.SaslServer
	- javax.security.sasl.SaslServerFactory
	- javax.sql.DataSource
	- javax.swing.JButton
	- javax.swing.JFrame
	- javax.swing.JLabel
	- javax.swing.JPanel
	- javax.swing.JTabbedPane
	- javax.swing.JTable
	- javax.swing.JTextArea
	- javax.swing.JTextField
	- javax.swing.table.AbstractTableModel
	- javax.transaction.RollbackException
	- javax.transaction.Synchronization
	- javax.transaction.Transaction
	- javax.transaction.TransactionManager
	- javax.transaction.TransactionSynchronizationRegistry
	- javax.transaction.UserTransaction
	- javax.transaction.xa.XAResource
	- javax.transaction.xa.Xid
	- javax.ws.rs.client.Client
	- javax.xml.namespace.QName
	- org.apache.logging.log4j.Logger
	- org.eclipse.microprofile.metrics.ConcurrentGauge
	- org.eclipse.microprofile.metrics.Counter
	- org.eclipse.microprofile.metrics.Gauge
	- org.eclipse.microprofile.metrics.Histogram
	- org.eclipse.microprofile.metrics.Metadata
	- org.eclipse.microprofile.metrics.Meter
	- org.eclipse.microprofile.metrics.Metered
	- org.eclipse.microprofile.metrics.Metric
	- org.eclipse.microprofile.metrics.MetricID
	- org.eclipse.microprofile.metrics.MetricRegistry
	- org.eclipse.microprofile.metrics.MetricType
	- org.eclipse.microprofile.metrics.Snapshot
	- org.eclipse.microprofile.metrics.Timer
	- org.eclipse.microprofile.metrics.Timer$Context
	- org.hibernate.Session
	- org.infinispan.protostream.BaseMarshaller
	- org.infinispan.protostream.FileDescriptorSource
	- org.infinispan.protostream.ImmutableSerializationContext
	- org.infinispan.protostream.SerializationContext
	- org.infinispan.protostream.SerializationContextInitializer
	- org.jboss.logging.DelegatingBasicLogger
	- org.jboss.logging.Logger
	- org.reactivestreams.Publisher
	- org.reactivestreams.Subscriber
	- org.slf4j.Logger
	- org.w3c.dom.Node

As you can see, I guess, the listed classes came all from quarkus-extensions or any 3rd party lib defined in pom.xml. Actually, 3rd party libs must be registered manually by application.properties, e.g.:

quarkus.index-dependency.otherlib.group-id = otherlib
quarkus.index-dependency.otherlib.artifact-id = otherlib-impl

I must do this for each included library, because currently, quarkus automatically indexes only the main module but not the 3rd party libraries. Even with the definition in application.properties, it could be possible that 3rd party libs need a META-INF/jandex.idx to be resolvable by quarkus. How should I do that?

For example, even if I include a dependency in my application by pom.xml and registering this dependency in application.properties:

quarkus.index-dependency.{otherlib}.group-id = ..
quarkus.index-dependency.{otherlib}.artifact-id = ..

few dependencies are still present in the list of Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:.. I dont know why, because I already registered it within application.properties.

Quarkus should also index all the dependencies defined in the lib-folder automatically on compile, without declaring it manually in application.properties. Why not generating a master-jandex.idx within my application on compile by scanning all dependencies and my application. With this, user does not need to include and struggle with jandex-maven-plugin, beans.xml or application.properties only to register these dependencies.

To Reproduce Steps to reproduce the behavior:

  1. compile quarkus app with some extensions or 3rd party lib.

Environment (please complete the following information):

  • Output of java -version: JDK12
  • Quarkus version or git rev: 1.0 FINAL

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
geoandcommented, Jul 28, 2021

It’s magic, because everyone knows that #5871=#6477

0reactions
nimo23commented, Jul 28, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add a bean to the Jandex index in an extension ...
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or...
Read more >
Contexts and Dependency Injection - Quarkus
A dependency with a Jandex index is automatically scanned for beans. To generate the index just add the following plugin to your build...
Read more >
java - How to create a Jandex index in Quarkus for classes in ...
Car are located in the api-library module. So I think I need to add them to the Jandex index-dependency in the application.properties. But...
Read more >
Quarkus Bean Discovery With Jandex Indexing - Baeldung
4. Conclusion. This article has determined that Quarkus needs a Jandex index to detect annotated classes at runtime. The index is generated ...
Read more >
Quarkus - Writing Your Own Extension
Quarkus extensions add a new developer focused behavior to the core offering, ... The build item which represents the Jandex index of the...
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