You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Emmanuel Touzery <em...@lit-transit.com> on 2017/03/23 09:27:23 UTC
registering a JMS MDB works through annotations, not through
ejb-jar.xml
Hello,
I'm having trouble registering an MDB through the ejb-jar.xml.
If I have the annotations on the MDB, like so:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "tmsAlertQueue")},
mappedName = "jms/tmsAlertQueue")
public class AlertMessageHandler extends
BaseMessageHandler<AlertBatchDto> implements MessageListener {
Everything works fine. But I'd rather have the annotations in the
ejb-jar.xml (so I can turn them on or off through config). I have this
(and those exact annotations worked on glassfish 3.1.2.2) =>
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee"
version = "3.1"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
<enterprise-beans>
<message-driven>
<display-name>AlertMessageHandler</display-name>
<ejb-name>AlertMessageHandler</ejb-name>
<mapped-name>jms/tmsAlertQueue</mapped-name>
<ejb-class>tms.tms_core.handlers.alerts.AlertMessageHandler</ejb-class>
<message-destination-type>javax.jms.Queue</message-destination-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>tmsAlertQueue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-property-name>
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
</activation-config>
</message-driven>
</ejb-jar>
But that doesn't work. I know tomee parses the ejb-jar.xml, because
if I put garbage in it, I get an error. I'm testing in arquillian right
now actually, and registering the ejb-jar through shrinkwrap like so:
.addAsWebInfResource("WEB-INF/ejb-jar.xml", "ejb-jar.xml")
I've tried modifying the ejb-jar root element for JEE7, like so:
<ejb-jar xmlns="http://xmlns.jcp.org/xml/ns/javaee"
version="3.2"
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/ejb-jar_3_2.xsd">
And also adding the metadata-complete attribute (both to true and
false), to no avail. The log file doesn't tell me much.
Any idea what I can do next?
Thank you!
emmanuel
Re: registering a JMS MDB works through annotations, not through
ejb-jar.xml
Posted by Emmanuel Touzery <em...@lit-transit.com>.
Hi,
yes I typed in the right class & package name, actually if I
introduce a typo on purpose the app doesn't start (which is nice):
org.apache.openejb.OpenEJBRuntimeException: <wrong class name>
at
org.apache.openejb.config.rules.CheckClasses.validate(CheckClasses.java:148)
at
org.apache.openejb.config.rules.ValidationBase.validate(ValidationBase.java:50)
at
org.apache.openejb.config.AppValidator.validate(AppValidator.java:102)
at
org.apache.openejb.config.ValidateModules.deploy(ValidateModules.java:38)
Ok, I'll see what I can do with regards to that, thanks for the tip...
emmanuel
On 23/03/17 11:56, Romain Manni-Bucau wrote:
> Hi
>
> Are you sure you matched the right ejb name?
>
> If you are not afraid by debugging tomee (it is really just like debugging
> your app once you got the sources ;)), you can put a breakpoint
> in org.apache.openejb.config.ActivationConfigPropertyOverride in the for
> loop
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> | Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2017-03-23 10:27 GMT+01:00 Emmanuel Touzery <
> emmanuel.touzery@lit-transit.com>:
>
>> Hello,
>>
>> I'm having trouble registering an MDB through the ejb-jar.xml.
>>
>> If I have the annotations on the MDB, like so:
>>
>> @MessageDriven(activationConfig = {
>> @ActivationConfigProperty(propertyName = "destinationType",
>> propertyValue = "javax.jms.Queue"),
>> @ActivationConfigProperty(propertyName = "destination", propertyValue
>> = "tmsAlertQueue")},
>> mappedName = "jms/tmsAlertQueue")
>> public class AlertMessageHandler extends BaseMessageHandler<AlertBatchDto>
>> implements MessageListener {
>>
>> Everything works fine. But I'd rather have the annotations in the
>> ejb-jar.xml (so I can turn them on or off through config). I have this (and
>> those exact annotations worked on glassfish 3.1.2.2) =>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee"
>> version = "3.1"
>> xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation = "http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
>> <enterprise-beans>
>> <message-driven>
>> <display-name>AlertMessageHandler</display-name>
>> <ejb-name>AlertMessageHandler</ejb-name>
>> <mapped-name>jms/tmsAlertQueue</mapped-name>
>> <ejb-class>tms.tms_core.handlers.alerts.AlertMessageHandler</ejb-class>
>> <message-destination-type>javax.jms.Queue</message-destination-type>
>> <activation-config>
>> <activation-config-property>
>> <activation-config-property-name>destination</activation-config-property-name>
>>
>> <activation-config-property-value>tmsAlertQueue</activation-config-property-value>
>>
>> </activation-config-property>
>> <activation-config-property>
>> <activation-config-property-name>destinationType</activation-config-property-name>
>>
>> <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
>>
>> </activation-config-property>
>> </activation-config>
>> </message-driven>
>> </ejb-jar>
>>
>> But that doesn't work. I know tomee parses the ejb-jar.xml, because if
>> I put garbage in it, I get an error. I'm testing in arquillian right now
>> actually, and registering the ejb-jar through shrinkwrap like so:
>>
>> .addAsWebInfResource("WEB-INF/ejb-jar.xml", "ejb-jar.xml")
>>
>> I've tried modifying the ejb-jar root element for JEE7, like so:
>>
>> <ejb-jar xmlns="http://xmlns.jcp.org/xml/ns/javaee"
>> version="3.2"
>> 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/ejb-jar_3_2.xsd">
>>
>> And also adding the metadata-complete attribute (both to true and
>> false), to no avail. The log file doesn't tell me much.
>>
>> Any idea what I can do next?
>>
>> Thank you!
>>
>> emmanuel
>>
>>
Re: registering a JMS MDB works through annotations, not through ejb-jar.xml
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
Are you sure you matched the right ejb name?
If you are not afraid by debugging tomee (it is really just like debugging
your app once you got the sources ;)), you can put a breakpoint
in org.apache.openejb.config.ActivationConfigPropertyOverride in the for
loop
Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> | Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>
2017-03-23 10:27 GMT+01:00 Emmanuel Touzery <
emmanuel.touzery@lit-transit.com>:
> Hello,
>
> I'm having trouble registering an MDB through the ejb-jar.xml.
>
> If I have the annotations on the MDB, like so:
>
> @MessageDriven(activationConfig = {
> @ActivationConfigProperty(propertyName = "destinationType",
> propertyValue = "javax.jms.Queue"),
> @ActivationConfigProperty(propertyName = "destination", propertyValue
> = "tmsAlertQueue")},
> mappedName = "jms/tmsAlertQueue")
> public class AlertMessageHandler extends BaseMessageHandler<AlertBatchDto>
> implements MessageListener {
>
> Everything works fine. But I'd rather have the annotations in the
> ejb-jar.xml (so I can turn them on or off through config). I have this (and
> those exact annotations worked on glassfish 3.1.2.2) =>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee"
> version = "3.1"
> xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation = "http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">
> <enterprise-beans>
> <message-driven>
> <display-name>AlertMessageHandler</display-name>
> <ejb-name>AlertMessageHandler</ejb-name>
> <mapped-name>jms/tmsAlertQueue</mapped-name>
> <ejb-class>tms.tms_core.handlers.alerts.AlertMessageHandler</ejb-class>
> <message-destination-type>javax.jms.Queue</message-destination-type>
> <activation-config>
> <activation-config-property>
> <activation-config-property-name>destination</activation-config-property-name>
>
> <activation-config-property-value>tmsAlertQueue</activation-config-property-value>
>
> </activation-config-property>
> <activation-config-property>
> <activation-config-property-name>destinationType</activation-config-property-name>
>
> <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
>
> </activation-config-property>
> </activation-config>
> </message-driven>
> </ejb-jar>
>
> But that doesn't work. I know tomee parses the ejb-jar.xml, because if
> I put garbage in it, I get an error. I'm testing in arquillian right now
> actually, and registering the ejb-jar through shrinkwrap like so:
>
> .addAsWebInfResource("WEB-INF/ejb-jar.xml", "ejb-jar.xml")
>
> I've tried modifying the ejb-jar root element for JEE7, like so:
>
> <ejb-jar xmlns="http://xmlns.jcp.org/xml/ns/javaee"
> version="3.2"
> 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/ejb-jar_3_2.xsd">
>
> And also adding the metadata-complete attribute (both to true and
> false), to no avail. The log file doesn't tell me much.
>
> Any idea what I can do next?
>
> Thank you!
>
> emmanuel
>
>