Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource adapters only deployed on uberjar mode / FISH-1217 #11

Open
ggam opened this issue Nov 11, 2018 · 3 comments
Open

Resource adapters only deployed on uberjar mode / FISH-1217 #11

ggam opened this issue Nov 11, 2018 · 3 comments
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect

Comments

@ggam
Copy link

ggam commented Nov 11, 2018

The following pom.xml doesn't deploy the Kafka resource adapter:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>eu.ggam</groupId>
    <artifactId>KafkaTest</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>KafkaTest</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <version.javaee>8.0</version.javaee>
        <version.concurrencyUtilities>1.0</version.concurrencyUtilities>
        <version.jca>1.7</version.jca>
        <version.jbatch>1.0.1</version.jbatch>
        <version.payara>5.183</version.payara>
        <version.microprofile>2.0.1</version.microprofile>
        <version.kafkaJca>0.4.0-SNAPSHOT</version.kafkaJca>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>${version.javaee}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.enterprise.concurrent</groupId>
            <artifactId>javax.enterprise.concurrent-api</artifactId>
            <version>${version.concurrencyUtilities}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.resource</groupId>
            <artifactId>javax.resource-api</artifactId>
            <version>${version.jca}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.batch</groupId>
            <artifactId>javax.batch-api</artifactId>
            <version>${version.jbatch}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.microprofile</groupId>
            <artifactId>microprofile</artifactId>
            <version>${version.microprofile}</version>
            <scope>provided</scope>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>fish.payara.cloud.connectors.kafka</groupId>
            <artifactId>kafka-jca-api</artifactId>
            <version>${version.kafkaJca}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>fish.payara.maven.plugins</groupId>
                <artifactId>payara-micro-maven-plugin</artifactId>
                <version>1.0.2</version>
                <configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>bundle</goal>
                            </goals>
                        </execution>
                    </executions>
                    <payaraVersion>${version.payara}</payaraVersion>
                    <javaPath>/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181.b15-6.fc29.x86_64/jre/bin/java</javaPath>
                    <deployWar>true</deployWar>
                    <commandLineOptions>
                        <option>
                            <key>--autoBindHttp</key>
                        </option>
                    </commandLineOptions>
                    <deployArtifacts>
                        <artifactItem>
                            <groupId>fish.payara.cloud.connectors.kafka</groupId>
                            <artifactId>kafka-rar</artifactId>
                            <version>0.4.0-SNAPSHOT</version>
                            <type>rar</type>
                        </artifactItem>                       
                    </deployArtifacts>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

My application only contains a @MessageDriven class and nothing more. I get some not very intuitive error message, along with a ClassNotFoundException for KafkaListener:

[2018-11-11T19:49:37.089+0100] [] [ADVERTENCIA] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1541962177089] [levelValue: 900] [[
  AS-DEPLOYMENT-00011
java.lang.NoClassDefFoundError: fish/payara/cloud/connectors/kafka/api/KafkaListener
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:1093)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1624)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
	at com.sun.enterprise.deployment.annotation.impl.ModuleScanner.getElements(ModuleScanner.java:296)
	at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:592)
	at org.glassfish.web.embed.impl.EmbeddedWebArchivist.processAnnotations(EmbeddedWebArchivist.java:144)
	at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:461)
	at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:445)
	at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:417)
	at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:394)
	at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:269)
	at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:278)
	at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:239)
	at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
	at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:199)
	at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:223)
	at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:91)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:933)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:873)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:383)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:540)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
	at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)
	at fish.payara.micro.impl.PayaraMicroImpl.deployAll(PayaraMicroImpl.java:1559)
	at fish.payara.micro.impl.PayaraMicroImpl.bootStrap(PayaraMicroImpl.java:1037)
	at fish.payara.micro.impl.PayaraMicroImpl.main(PayaraMicroImpl.java:200)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at fish.payara.micro.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
	at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:107)
	at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:70)
	at fish.payara.micro.boot.PayaraMicroLauncher.main(PayaraMicroLauncher.java:79)
	at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:397)
Caused by: java.lang.ClassNotFoundException: fish.payara.cloud.connectors.kafka.api.KafkaListener
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1659)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
	... 51 more
]]

[2018-11-11T19:49:37.094+0100] [] [ADVERTENCIA] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1541962177094] [levelValue: 900] [[
  AS-DEPLOYMENT-00011
java.lang.NoClassDefFoundError: fish/payara/cloud/connectors/kafka/api/KafkaListener
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:1093)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1624)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
	at com.sun.enterprise.deployment.annotation.impl.ModuleScanner.getElements(ModuleScanner.java:296)
	at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:592)
	at org.glassfish.web.embed.impl.EmbeddedWebArchivist.processAnnotations(EmbeddedWebArchivist.java:144)
	at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:484)
	at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:445)
	at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:417)
	at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:394)
	at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:269)
	at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:278)
	at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:239)
	at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
	at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:199)
	at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:223)
	at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:91)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:933)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:873)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:383)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:540)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
	at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)
	at fish.payara.micro.impl.PayaraMicroImpl.deployAll(PayaraMicroImpl.java:1559)
	at fish.payara.micro.impl.PayaraMicroImpl.bootStrap(PayaraMicroImpl.java:1037)
	at fish.payara.micro.impl.PayaraMicroImpl.main(PayaraMicroImpl.java:200)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at fish.payara.micro.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
	at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:107)
	at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:70)
	at fish.payara.micro.boot.PayaraMicroLauncher.main(PayaraMicroLauncher.java:79)
	at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:397)
Caused by: java.lang.ClassNotFoundException: fish.payara.cloud.connectors.kafka.api.KafkaListener
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1659)
	at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
	... 51 more
]]

[2018-11-11T19:49:37.299+0100] [] [GRAVE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1541962177299] [levelValue: 1000] Exception while invoking class org.glassfish.ejb.startup.EjbDeployer prepare method

[2018-11-11T19:49:37.300+0100] [] [GRAVE] [] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1541962177300] [levelValue: 1000] Exception while preparing the app

[2018-11-11T19:49:37.300+0100] [] [GRAVE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1541962177300] [levelValue: 1000] [[
  Exception during lifecycle processing
java.lang.RuntimeException: Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for /tmp/payaramicro-rt886404631608356480tmp/applications/KafkaTest-1.0-SNAPSHOT.
If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected
	at org.glassfish.ejb.startup.EjbDeployer.prepare(EjbDeployer.java:192)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:978)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:438)
	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:540)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:360)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
	at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:133)
	at fish.payara.micro.impl.PayaraMicroImpl.deployAll(PayaraMicroImpl.java:1559)
	at fish.payara.micro.impl.PayaraMicroImpl.bootStrap(PayaraMicroImpl.java:1037)
	at fish.payara.micro.impl.PayaraMicroImpl.main(PayaraMicroImpl.java:200)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at fish.payara.micro.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
	at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:107)
	at fish.payara.micro.boot.loader.Launcher.launch(Launcher.java:70)
	at fish.payara.micro.boot.PayaraMicroLauncher.main(PayaraMicroLauncher.java:79)
	at fish.payara.micro.PayaraMicro.main(PayaraMicro.java:397)
]]

However, it works when I add <useUberJar>true</useUberJar>.

@mulderbaba mulderbaba self-assigned this Nov 23, 2018
@OndroMih
Copy link

The problem with the bundle goal is that it doesn't deploy the kafka resource adapter before the app is deployed and therefore the app doesn't see the classes when deployed. We need to fix the order of deployments to fix this problem.

The option <useUberJar>true</useUberJar> probably changes the deployment order and the adapter is deployed before the app.

Alternatively, you can use the "start" goal of the plugin with the --outputUberJar argument, as used here: https://github.com/OndrejM-demonstrations/Reactive-and-Micro-with-MicroProfile-and-Payara/blob/f7e5c14858008339f0f623f23dbdca9e0914f1b8/BTCFrontend/pom.xml#L143

@sergitrujillo
Copy link

Trying to do: https://docs.payara.fish/documentation/user-guides/mdb-in-payara-micro.html with the bundle goal as this issue payara/ecosystem-maven#74 and I have the same error. Rar file was deployed after main project and this last fails on deploy time.

org.glassfish.deployment.common.DeploymentException: Resource Adapter not present: RA Name: [activemq-rar-5.14.5], Type: [AODD] (I skipped other stacktrace for brevity)

The option <useUberJar>true</useUberJar> hasn't been fine for me.

Deployment order configuration on pom.xml could be a good solution.

@jGauravGupta
Copy link
Contributor

Created internal ticket MP-71 to address the issue.

@fturizo fturizo transferred this issue from payara/ecosystem-maven Mar 18, 2021
@AlanRoth AlanRoth changed the title Resource adapters only deployed on uberjar mode Resource adapters only deployed on uberjar mode / ECOSYS-18 Mar 22, 2021
@AlanRoth AlanRoth added the Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev label Mar 22, 2021
@AlanRoth AlanRoth added the Type: Bug Label issue as a bug defect label Mar 22, 2021
@eliotmartin eliotmartin changed the title Resource adapters only deployed on uberjar mode / ECOSYS-18 Resource adapters only deployed on uberjar mode / FISH-1217 Mar 23, 2021
@fturizo fturizo assigned AlanRoth and unassigned jGauravGupta Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect
Projects
None yet
Development

No branches or pull requests

6 participants