payara / ecosystem-support

Placeholder repository to handle community requests for the Payara Platform ecosystem tools
3 stars 2 forks source link

Bug Report: [Payara Cloud Connector / AWS SQS] @ConnectionFactory issues when integrating into existing microservice #36

Closed springfan closed 2 years ago

springfan commented 2 years ago

Versions: PAYARAMICRO_VERSION=5.2020.4

<dependency>
    <groupId>fish.payara.cloud.connectors.amazonsqs</groupId>
    <artifactId>amazon-sqs-rar</artifactId>
    <version>0.6.0</version>
    <type>rar</type>
</dependency>
<dependency>
    <groupId>fish.payara.cloud.connectors.amazonsqs</groupId>
    <artifactId>amazon-sqs-jca-api</artifactId>
    <version>1.11.1024</version>
    <scope>provided</scope>
</dependency>

We have implemented a SQS Sender occording the "official" Payara Dokumentation (https://github.com/payara/Cloud-Connectors/tree/master/AmazonSQS) using the given example from Steve Millidge (https://github.com/payara/Cloud-Connectors/blob/master/AmazonSQS/AmazonSQSExample/src/main/java/fish/payara/cloud/connectors/amazonsqs/example/NewTimerSessionBean.java). We have replaced the method annotated with @Schedule by a method "public void sendMessage(String message)"

Problem: If we deploy the given example class within a simple PoC project, which contains only a handful classes, the deployment succeeds. If we deploy our adapted implementation within a production application, the deployment fails with an AS-DEPLOYMENT-00026 error:`

[2021-09-16T16:37:34.297+0200] [] [[1;91mSEVERE[0m] [] [[1;94mjavax.enterprise.system.tools.deployment.dol[0m] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1631803054297] [levelValue: 1000] AS-DEPLOYMENT-00026 [2021-09-16T16:37:34.299+0200] [] 
[[1;91mSEVERE[0m] [] [[1;94mjavax.enterprise.system.core[0m] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1631803054299] [levelValue: 1000] JNDI lookup failed for the resource: Name: [java:module/env/com.bmw.cc.am.vas.integration.casa.vehicle.control.SqsVehicleSenderEmea/factory], Lookup: [java:comp/env/SQSConnectionFactoryVehicleEmea], Type: [fish.payara.cloud.connectors.amazonsqs.api.AmazonSQSConnectionFactory] -- Lookup failed for 'java:comp/env/SQSConnectionFactoryVehicleEmea' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl}

As workaround we have removed the @Resource annotation and instead do a manual JNDI look within @PostConstruct.

Question: Does Payara Micro have an issue with deploying connection factories that are defined with @ConnectionFactory annotation and not in domain.xml? Since manual JNDI lookups cannot be the solution, what is the suggested configuration for connection factories, if configuration by @ConnectionFactory annotation does not work in all cases?

shub8968 commented 2 years ago

Closing this issue as it was already addressed as part of Enterprise support.