WildFly Glow CLI Exclude Layers

61 views
Skip to first unread message

Fabricio Gregorio

unread,
Jun 13, 2024, 2:47:21 PMJun 13
to WildFly
Is there a way to manually exclude layers with WildFly Glow CLI?

I think it might have detected a layer that is not used as for example JPA and Micrometer.

Thanks

Scott Marlow

unread,
Jun 13, 2024, 3:41:45 PMJun 13
to Fabricio Gregorio, WildFly


On 6/13/24 2:47 PM, Fabricio Gregorio wrote:
Is there a way to manually exclude layers with WildFly Glow CLI?

I think it might have detected a layer that is not used as for example JPA and Micrometer.

I'm not really sure but just ran "./wildfly-glow scan --help" and see some options that might be helpful:

"
--add-layers-for-jndi=<layer>[,<layer>...]
                          List of layers. In the case some layers are missing, consider adding them manually with this option.

--disable-deployers=<add-on>[,<add-on>...]
                          A comma separated list of deployer names to disable. To retrieve all the deployer names call the show-configuration operation. To disable them all, use ALL value. Can only be used with OPENSHIFT kind of provisioning.

--input-feature-packs-file=<provisioning file path>
                          Galleon feature-packs used by wildfly-glow are retrieved from an online registry. To override the set of feature-packs you can specify a path to a Galleon provisioning XML file containing the set of Galleon feature-packs to be used by wildfly-glow.

"

Try the "wildfly-glow show-configuration" command to see the different feature packs and deployers.  I think you would have to use the --input-feature-packs-file option with "jpa" not specified in the "Galleon provisioning XML file containing the set of Galleon feature-packs to be used by wildfly-glow" file that you pass in, where you choose which feature packs to include.  

Hope that helps.

Scott


Thanks --
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/a37a516e-3340-4777-a1c0-c8073485a82bn%40googlegroups.com.

Jean Francois Denise

unread,
Jun 14, 2024, 3:49:18 AMJun 14
to Scott Marlow, Fabricio Gregorio, WildFly
Hi Fabricio,
if WildFly Glow reports a layer that is not used, it seems a bug in the CLI. Would you mind log an Issue with some details allowing us to reproduce: https://github.com/wildfly/wildfly-glow/issues
Ideally if you could share a war that highlights the problem? Possible root cause, if the deployment packages dependencies that depend on those API. There is an option to exclude some bundled dependencies.
Thank-you.
JF


Fabricio Gregorio

unread,
Jun 14, 2024, 9:31:51 AMJun 14
to WildFly
Hello Jean.

I tracked down the issue to the following libraries:

Micrometer is being added because of 

        <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-cdi-embedded-jakarta</artifactId>
            <version>14.0.27.Final</version>
        </dependency>

It seems that micrometer might be referenced in some internal class, although I am not explicitly using it. 
  • I dont know if I need the micrometer classes in the server for this library to run. 
  • I know that I dont need the micrometer subsystem declared in the standalone.xml.

JPA is being added because of

        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>13.0.10</version>
            <classifier>jakarta</classifier>
        </dependency>

This one is really weird. Might be a bug on primefaces?

Thanks

Brian Stansberry

unread,
Jun 14, 2024, 6:01:08 PMJun 14
to WildFly
Primefaces has this:

primefaces/src/main/java/org/primefaces/model/JpaLazyDataModel.java:import javax.persistence.EntityManager;

primefaces/src/main/java/org/primefaces/model/JpaLazyDataModel.java:import javax.persistence.TypedQuery;

primefaces/src/main/java/org/primefaces/model/JpaLazyDataModel.java:import javax.persistence.criteria.*;


Their build has some shading stuff going on that I believe ends up converting those imports from javax.persistence to jakarta.persistence.


Jean Francois Denise

unread,
Jun 17, 2024, 7:01:07 AMJun 17
to WildFly
Hi Fabricio, 
so your app requires the dependency infinispan-cdi-embedded-jakarta that in turns requires micrometer. That is an interesting use-case that seems to show that scanning the dependencies can discover un-needed layers. In your case the server configuration will include the micrometer subsystem although your application doesn't need it.

Could you exclude the infinispan-cdi-embedded-jakarta bundled library (you can exclude multiple archives BTW) and see what are the discovered Galleon layers? Knowing what is missing would be interesting.
For now, if some layers are missing, you could use the --add-layers-or-jndi to add back the missing layers.
Thank-you.
JF




Fabricio Gregorio

unread,
Jun 17, 2024, 1:12:04 PMJun 17
to WildFly
./wildfly-glow scan --provision=SERVER --add-ons=metrics examples/custom.war
Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
config stability: community
galleon discovery
- feature-packs
   org.wildfly:wildfly-galleon-pack:32.0.1.Final
- layers
   ee-core-profile-server
   microprofile-health
   jaxrs
   microprofile-rest-client
   jsf
   jpa
   micrometer
   metrics
   microprofile-telemetry

---------------


 ./wildfly-glow scan --provision=SERVER --add-ons=metrics --exclude-archives-from-scan=primefaces-*.jar examples/custom.war
Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
config stability: community
galleon discovery
- feature-packs
   org.wildfly:wildfly-galleon-pack:32.0.1.Final
- layers
   ee-core-profile-server
   microprofile-health
   jaxrs
   microprofile-rest-client
   jsf
   datasources --> Notice that JPA is gone but now datasources is detected.
   micrometer
   metrics
   microprofile-telemetry

---------------

./wildfly-glow scan --provision=SERVER --add-ons=metrics --exclude-archives-from-scan=primefaces-*.jar,infinispan-*.jar examples/custom.war
Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
config stability: community
galleon discovery
- feature-packs
   org.wildfly:wildfly-galleon-pack:32.0.1.Final
- layers
   ee-core-profile-server
   microprofile-health
   jaxrs
   microprofile-rest-client
   jsf
   datasources
   metrics
   microprofile-telemetry

Now micrometer is out.

----------------

As an additional thought:
In some cases, it can be difficult to diagnose which dependency is adding the layer.
If you know that your code does not use certain layers, it will be beneficial to have a way to remove them manually.

Jean Francois Denise

unread,
Jun 17, 2024, 3:19:59 PMJun 17
to Fabricio Gregorio, WildFly
Hi Fabricio,
the fact that datasources is now in is a side effect of the JPA removal. JPA depends on datasources so datasources was not shown in what Glow discovered, but were there. We are not showing all layers, but only the "top level" ones. I suspect that your deployment requires datasources so that is fine.

For your RFE to be able to exclude a layer, feel free to log an issue in the project, we can see if there is traction for it.
Your use-case as been very interesting, adding your last reply content to the logged issue would be great!
Thank-you!
JF

Jean Francois Denise

unread,
Jun 18, 2024, 8:03:14 AM (14 days ago) Jun 18
to Fabricio Gregorio, WildFly
Something that I should have mentioned that will help you understand why a layer is present. We have documentation for the latest WildFly version that covers the rules WildFly Glow relies on to identify layers.
In this documentation: https://docs.wildfly.org/wildfly-galleon-feature-packs/  you will find the existing rules (generic description), all the supported galleon feature-packs for a given WildFly version, and for each defined layer, the actual rules that are in use.
For example, for datasources we can see: org.wildfly.rule.class=java.sql,javax.sql
This means that if a class from these 2 packages is referenced, then datasources layer is added.
Reply all
Reply to author
Forward
0 new messages