MDB in payara micro

136 views
Skip to first unread message

Sergi Trujillo-

unread,
Nov 30, 2018, 9:40:32 AM11/30/18
to Payara Forum

Hello,

I'm trying to send messages to activemq as like https://docs.payara.fish/documentation/user-guides/mdb-in-payara-micro.html.

I need to package in one .jar file to deploy as a microservice and for it i trying to use payara-micro-maven-plugin to create uberjar.

<plugin>
<groupId>fish.payara.maven.plugins</groupId>
<artifactId>payara-micro-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<payaraVersion>5.183</payaraVersion>
<appendSystemProperties>false</appendSystemProperties>
<deployArtifacts>
<artifactItem>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-rar</artifactId>
<version>5.14.5</version>
<type>rar</type>
</artifactItem>
</deployArtifacts>
</configuration>
</plugin>

I put the anotations on top of class to configure connection to activemq:
@ConnectionFactoryDefinition( name = "java:app/activemq/factory",
interfaceName = "javax.jms.ConnectionFactory",
resourceAdapter = "activemq-rar-5.14.5",
properties = {"UserName=xxxx","Password=yyyyy","ServerUrl=tcp://X.X.X:X:61616"})

@AdministeredObjectDefinition( resourceAdapter = "activemq-rar-5.14.5",
interfaceName = "javax.jms.Queue",
className = "org.apache.activemq.command.ActiveMQQueue",
name = "java:app/activemq/queue",
properties = {"PhysicalName=XXXXXXX"})


The problems is when I start generated jar that it say: org.glassfish.deployment.common.DeploymentException: Resource Adapter not present: RA Name: [activemq-rar-5.14.5], Type: [AODD]  (I skipped other stacktrace for brevity)

I think that it is because my root project is deployed before than activemq-rar. In documentation deploy applicacion by args otherwise maven configuration. It this?

Somebody can say me if is possible configure deployment order on payara-micro?.

Thank's all.




Ondro Mihályi

unread,
Nov 30, 2018, 11:01:50 AM11/30/18
to sergi.t...@bonarea.com, Payara Forum
Hi, Sergi,

You're right, the bundle goal of the maven plugin doesn't ensure any order of deployments, which causes problems when adapters should be deployed before apps that need them. This is a known issue raised here: https://github.com/payara/ecosystem-maven/issues/74

To have full control over the order of deployments, you can use the "start" goal of the maven plugin with the "--outputUberJar" argument of Payara Micro, which creates a JAR bundle similar to the one created by the "bundle" maven goal, but preserves the order of deployments. Here's an example how I used in a demo project: https://github.com/OndrejM-demonstrations/Reactive-and-Micro-with-MicroProfile-and-Payara/blob/f7e5c14858008339f0f623f23dbdca9e0914f1b8/BTCFrontend/pom.xml#L143. That project uses Kafka JCA connector instead of ActiveMQ RAR, but the approach is the same.

Ondro

pi 30. 11. 2018 o 15:40 Sergi Trujillo- <sergi.t...@bonarea.com> napísal(a):
--
You received this message because you are subscribed to the Google Groups "Payara Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to payara-forum...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/payara-forum/6d93c95c-907a-401a-9264-5277f2f31438%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sergi Trujillo-

unread,
Nov 30, 2018, 12:44:17 PM11/30/18
to Payara Forum
Hi, Ondro,

At this time, i can't use start goal because i have an specific automatic deployment for maven without permissions to run cli orders. It's necessary to generate one unique jar.

I hope in the future the deployment order could be configured. I will be following this issue.

Thanks a lot.




El divendres, 30 novembre de 2018 17:01:50 UTC+1, Ondro Mihályi va escriure:
Reply all
Reply to author
Forward
0 new messages