wildfly / wildfly-glow

Galleon Layers Output from War: Automatic discover of WildFly provisioning information from an application.
Apache License 2.0
7 stars 7 forks source link

Resource adapter is not recognized. #84

Closed torsten-liermann closed 2 months ago

torsten-liermann commented 3 months ago

Hello,

I like the idea behind Glow.
However, I can't use this tool in the CI pipeline yet because glow doesn't take into account resource adapter archives in EAR archives. The entry `

<include name="resource-adapters"/>

is missing in the provisioning.xml.
This leads to an error when starting the server in version 33.0.0.Final in standalone mode:

java.lang.NullPointerException: Cannot invoke "org.jboss.as.connector.subsystems.resourceadapters.ResourceAdaptersSubsystemService.getAdapters()" because the return value of "org.jboss.as.server.deployment.DeploymentUnit.getAttachment(org.jboss.as.server.deployment.AttachmentKey)" is null
at org.jboss.a...@33.0.0.Final//org.jboss.as.connector.deployers.ra.processors.RaXmlDependencyProcessor.deploy(RaXmlDependencyProcessor.java:35)
at org.jboss...@25.0.0.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)

The workaround is clear to me.

The application.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_8.xsd" version="8">
  <description>This application demonstrates the definition of a datasource and a resource adapter.  
The datasource is referenced by another EAR.</description>
  <display-name>Application-1 Main</display-name>
  <initialize-in-order>true</initialize-in-order>
  <module>
    <ejb>demo.setup.datasource-embedded-ejb-1-1.0.0.jar</ejb>
  </module>
  <module>
    <connector>demo.setup.datasource-embedded-ra-1-1.0.0.rar</connector>
  </module>
</application>

and the ra.xml:

<connector xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
           http://java.sun.com/xml/ns/j2ee/connector_1_6.xsd"
           version="1.6" metadata-complete="true">

    <vendor-name>Demo Factory Inc</vendor-name>
    <eis-type>Test RA</eis-type>
    <resourceadapter-version>0.1</resourceadapter-version>

    <resourceadapter>
        <resourceadapter-class>com.example.MyResourceAdapter</resourceadapter-class>
        <config-property>

Thanks.

jfdenise commented 2 months ago

@torsten-liermann , you can look in the glow documentation: http://docs.wildfly.org/wildfly-galleon-feature-packs/#_galleon_layers_and_associated_discovery_rules That the resource-adapters layer will be provisioned if the file META-INF/ra.xml or META-INF/ironjacamar.xml exist in the deployment. Does your deployment contains it?

torsten-liermann commented 2 months ago

Is the shown ra.xml not valid? The displayed application.xml was also generated by Maven, and all components are included in the EAR as shown.

jfdenise commented 2 months ago

Where does the ra.xml located in the ear?

torsten-liermann commented 2 months ago
ear-1-1.0.0
|-- META-INF
|   `-- application.xml
|-- demo.setup.datasource-embedded-ejb-1-1.0.0.jar
`-- demo.setup.datasource-embedded-ra-1-1.0.0.rar
     (contains)
     |____ ra.xml
torsten-liermann commented 2 months ago

If the ra.xml file is located under META-INF in the RAR file, glow recognizes the resource adapter:

wildfly-glow.jar scan ./target/ra-1-1.0.0.rar --provision=PROVISIONING_XML
Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
galleon discovery
- feature-packs
   org.wildfly:wildfly-galleon-pack:33.0.1.Final
- layers
   ee-core-profile-server
   resource-adapters

I haven't deployed the example yet.

jfdenise commented 2 months ago

@torsten-liermann , you are going to put the ra.xml in the META-INF directory? Should we close this issue?

torsten-liermann commented 2 months ago

Thank you very much! The ticket can be closed.

jfdenise commented 2 months ago

Thank-you for your analysis! Closing it.