Yes.

A MDBContainer is bound to a resource adapter.

Default config binds it to Default JMS Resource Adapter

All other configs need to be explicit.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-03-13 15:22 GMT+01:00 Alex Soto <asot...@gmail.com>:

> yes so it seems that you need to define the container if you are using a
> custom connection.
>
> El dv., 13 març, 2015 a les 15:15, Romain Manni-Bucau (<
> rmannibu...@gmail.com>) va escriure:
>
> > No no seems what you see is fine if you dont use the default ra name.
> > Le 13 mars 2015 15:02, "Alex Soto" <asot...@gmail.com> a écrit :
> >
> > > Hi I have tried the same example in tomee2.0.0 SNAPSHOT and it happens
> > the
> > > same, if you want I can send you the war files and configuration file.
> > >
> > > El dv., 13 març, 2015 a les 11:24, Romain Manni-Bucau (<
> > > rmannibu...@gmail.com>) va escriure:
> > >
> > > > Not a requirement, just if you dont use default. Reusing default
> names
> > > > would make it smoother.
> > > > Le 13 mars 2015 09:52, "Alex Soto" <asot...@gmail.com> a écrit :
> > > >
> > > > > Hi we fixed yesterday by adding this line to tomee.xml
> > > > >
> > > > > <Container id="MyJmsMdbContainer" ctype="MESSAGE">
> > > > >     ResourceAdapter = senderResourceAdapter
> > > > >   </Container>
> > > > >
> > > > > Adding container definition is a requirement? Could it be self
> > > > discovered?
> > > > >
> > > > > Alex.
> > > > >
> > > > > El dj., 12 març, 2015 a les 23:02, Romain Manni-Bucau (<
> > > > > rmannibu...@gmail.com>) va escriure:
> > > > >
> > > > > > Would you care testing with a snapshot? Recall a bug with
> brokerxml
> > > not
> > > > > > being ignored.
> > > > > > Le 12 mars 2015 15:56, "Alex Soto" <asot...@gmail.com> a écrit :
> > > > > >
> > > > > > > Yes because in TomEE I have two war files, one that publish the
> > > > message
> > > > > > and
> > > > > > > the other one that consumes it. Both applications are sharing
> the
> > > > same
> > > > > > > tomee.xml configuration and so same ActiveMQ external instance.
> > > > > > > The message is published (we can see it in the console) but
> there
> > > is
> > > > no
> > > > > > > consumers because the second application is listening for
> > localhost
> > > > and
> > > > > > not
> > > > > > > the remote host.
> > > > > > >
> > > > > > > El dj., 12 març, 2015 a les 15:42, Romain Manni-Bucau (<
> > > > > > > rmannibu...@gmail.com>) va escriure:
> > > > > > >
> > > > > > > > Just to be sure can you use url tcp://foo:1245?
> > > > > > > > Le 12 mars 2015 15:34, "Alex Soto" <asot...@gmail.com> a
> > écrit :
> > > > > > > >
> > > > > > > > > Well I have fixed the problem of the use rpassword but now
> I
> > > have
> > > > > > > another
> > > > > > > > > problem look I have this tomee.xml
> > > > > > > > >
> > > > > > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > > > > > <tomee>
> > > > > > > > >   <!-- see
> > > http://tomee.apache.org/containers-and-resources.html
> > > > > -->
> > > > > > > > >
> > > > > > > > >   <!-- activate next line to be able to deploy applications
> > in
> > > > apps
> > > > > > -->
> > > > > > > > >   <!-- <Deployments dir="apps" /> -->
> > > > > > > > >   <Resource id="senderResourceAdapter"
> > > > > type="ActiveMQResourceAdapter"
> > > > > > >
> > > > > > > > >     BrokerXmlConfig =
> > > > > > > > >     ServerUrl       =  tcp://zoo1:61616
> > > > > > > > >     startupTimeout  = 10 seconds
> > > > > > > > >   </Resource>
> > > > > > > > >
> > > > > > > > >   <Resource id="senderConnectionFactory"
> > > > > > > > > type="javax.jms.ConnectionFactory">
> > > > > > > > >     ResourceAdapter = senderResourceAdapter
> > > > > > > > >   </Resource>
> > > > > > > > >
> > > > > > > > >   <Resource id="messageQueue" type="javax.jms.Queue"/>
> > > > > > > > > </tomee>
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > And in one war I have next MDB:
> > > > > > > > > @MessageDriven(mappedName="messageQueue",
> > name="messageQueue")
> > > > > > > > > public class ReceiverMessage implements MessageListener {
> > > > > > > > >
> > > > > > > > >     @Resource(name= "senderConnectionFactory")
> > > > > > > > >     private ConnectionFactory connectionFactory;
> > > > > > > > >
> > > > > > > > >     @Override
> > > > > > > > >     public void onMessage(Message message) {
> > > > > > > > >         final TextMessage textMessage = (TextMessage)
> > message;
> > > > > > > > >         String question;
> > > > > > > > >         try {
> > > > > > > > >             question = textMessage.getText();
> > > > > > > > >             Files.write(Paths.get("./msg.log"),
> > > > > > question.getBytes());
> > > > > > > > >             System.out.println("This is my MDB "+
> question);
> > > > > > > > >         } catch (JMSException | IOException e) {
> > > > > > > > >             throw new IllegalArgumentException(e);
> > > > > > > > >         }
> > > > > > > > >     }
> > > > > > > > >
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > But when the application is deployed I can see next line:
> > > > > > > > >
> > > > > > > > > INFO: Auto-deploying ejb messageQueue:
> > > > > > > > > EjbDeployment(deployment-id=messageQueue)
> > > > > > > > > Mar 12, 2015 3:29:00 PM org.apache.openejb.config.
> > > > > > ConfigurationFactory
> > > > > > > > > configureService
> > > > > > > > > INFO: Configuring Service(id=Default MDB Container,
> > > > type=Container,
> > > > > > > > > provider-id=Default MDB Container)
> > > > > > > > > Mar 12, 2015 3:29:00 PM
> org.apache.openejb.config.AutoConfig
> > > > > > > > > createContainer
> > > > > > > > > INFO: Auto-creating a container for bean messageQueue:
> > > > > > > > > Container(type=MESSAGE, id=Default MDB Container)
> > > > > > > > > Mar 12, 2015 3:29:00 PM org.apache.openejb.config.
> > > > > > ConfigurationFactory
> > > > > > > > > configureService
> > > > > > > > > INFO: Configuring Service(id=Default JMS Resource Adapter,
> > > > > > > type=Resource,
> > > > > > > > > provider-id=Default JMS Resource Adapter)
> > > > > > > > > Mar 12, 2015 3:29:00 PM org.apache.openejb.config.
> > > > > > ConfigurationFactory
> > > > > > > > > configureService
> > > > > > > > > INFO: Configuring Service(id=Default Unmanaged JDBC
> Database,
> > > > > > > > > type=Resource, provider-id=Default Unmanaged JDBC Database)
> > > > > > > > > Mar 12, 2015 3:29:00 PM org.apache.openejb.assembler.
> > > > > > classic.Assembler
> > > > > > > > > createRecipe
> > > > > > > > > INFO: Creating Resource(id=Default Unmanaged JDBC Database)
> > > > > > > > > Mar 12, 2015 3:29:00 PM
> > > > > > > > >
> org.apache.tomee.jdbc.TomEEDataSourceCreator$TomEEDataSource
> > > > > > readOnly
> > > > > > > > > INFO: Disabling testOnBorrow since no validation query is
> > > > provided
> > > > > > > > > Mar 12, 2015 3:29:00 PM org.apache.openejb.assembler.
> > > > > > classic.Assembler
> > > > > > > > > createRecipe
> > > > > > > > > INFO: Creating Resource(id=Default JMS Resource Adapter)
> > > > > > > > > Mar 12, 2015 3:29:00 PM org.apache.openejb.assembler.
> > > > > > classic.Assembler
> > > > > > > > > createResource
> > > > > > > > > INFO: Thread pool size for 'Default JMS Resource Adapter'
> is
> > > (30)
> > > > > > > > > Mar 12, 2015 3:29:00 PM
> > > > > > > > > org.apache.openejb.resource.activemq.ActiveMQ5Factory
> > > > createBroker
> > > > > > > > > INFO: ActiveMQ5Factory creating broker
> > > > > > > > > Mar 12, 2015 3:29:01 PM
> > > > > > > > > org.apache.openejb.resource.activemq.ActiveMQ5Factory
> > > > createBroker
> > > > > > > > > INFO: Using ActiveMQ startup timeout of 10000ms
> > > > > > > > > Mar 12, 2015 3:29:01 PM
> > > > > > > > > org.apache.openejb.resource.activemq.ActiveMQ5Factory$1 run
> > > > > > > > > INFO: Starting ActiveMQ BrokerService
> > > > > > > > > Mar 12, 2015 3:29:01 PM
> > > org.apache.activemq.broker.BrokerService
> > > > > > > > > doStartPersistenceAdapter
> > > > > > > > > INFO: Using Persistence Adapter: MemoryPersistenceAdapter
> > > > > > > > > Mar 12, 2015 3:29:01 PM
> > > org.apache.activemq.broker.BrokerService
> > > > > > > > > doStartBroker
> > > > > > > > > INFO: Apache ActiveMQ 5.10.0 (localhost,
> > > > > > > > > ID:BCNSWLL13ALSOTO-49637-1426170541059-0:1) is starting
> > > > > > > > > Mar 12, 2015 3:29:01 PM
> > > > > > > > > org.apache.activemq.transport.TransportServerThreadSupport
> > > > doStart
> > > > > > > > > INFO: Listening for connections at: tcp://localhost:61616
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > So as you can see it ignores the configuration for getting
> > host
> > > > and
> > > > > > > > > autocreates the connection. Is this normal?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > El dj., 12 març, 2015 a les 15:03, Romain Manni-Bucau (<
> > > > > > > > > rmannibu...@gmail.com>) va escriure:
> > > > > > > > >
> > > > > > > > > > Why not setting it on the resource adapter as explained
> on
> > > amq
> > > > > > site?
> > > > > > > > > > Le 12 mars 2015 14:54, "Alex Soto" <asot...@gmail.com> a
> > > > écrit :
> > > > > > > > > >
> > > > > > > > > > > it seems we need to configure logimodule or something
> > like
> > > > this
> > > > > > > > > > >
> > > > > > > > > > > Caused by: javax.security.auth.login.LoginException: No
> > > > > > > LoginModules
> > > > > > > > > > > configured for activemq-domain
> > > > > > > > > > > at javax.security.auth.login.LoginContext.init(
> > > > > > > > LoginContext.java:264)
> > > > > > > > > > > at javax.security.auth.login.LoginContext.<init>(
> > > > > > > > LoginContext.java:417)
> > > > > > > > > > > at
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > >
> > > org.apache.activemq.security.JaasAuthenticationBroker.addConnection(
> > > > > > > > > > JaasAuthenticationBroker.java:72)
> > > > > > > > > > >
> > > > > > > > > > > But not sure if configuring tomee.xml parameters it
> > should
> > > be
> > > > > > > enough
> > > > > > > > or
> > > > > > > > > > > not.
> > > > > > > > > > >
> > > > > > > > > > > El dj., 12 març, 2015 a les 14:35, Alex Soto (<
> > > > > asot...@gmail.com
> > > > > > >)
> > > > > > > > va
> > > > > > > > > > > escriure:
> > > > > > > > > > >
> > > > > > > > > > > > Hi I am trying to deploy an application on Apache
> TomEE
> > > > that
> > > > > > uses
> > > > > > > > an
> > > > > > > > > > > > external ActiveMQ instance.
> > > > > > > > > > > >
> > > > > > > > > > > > I have configured in tomee.xml in this way:
> > > > > > > > > > > >
> > > > > > > > > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > > > > > > > > <tomee>
> > > > > > > > > > > >   <!-- see http://tomee.apache.org/
> > > > > > containers-and-resources.html
> > > > > > > > -->
> > > > > > > > > > > >
> > > > > > > > > > > >   <!-- activate next line to be able to deploy
> > > applications
> > > > > in
> > > > > > > apps
> > > > > > > > > -->
> > > > > > > > > > > >   <!-- <Deployments dir="apps" /> -->
> > > > > > > > > > > >   <Resource id="senderResourceAdapter"
> > > > > > > > > type="ActiveMQResourceAdapter">
> > > > > > > > > > > >     BrokerXmlConfig =
> > > > > > > > > > > >     ServerUrl       =  tcp://host:61616
> > > > > > > > > > > >     startupTimeout  = 10 seconds
> > > > > > > > > > > >   </Resource>
> > > > > > > > > > > >
> > > > > > > > > > > >   <Resource id="senderConnectionFactory"
> > > > > > > > > > > > type="javax.jms.ConnectionFactory">
> > > > > > > > > > > >     ResourceAdapter = senderResourceAdapter
> > > > > > > > > > > >     userName = user
> > > > > > > > > > > >     password = user
> > > > > > > > > > > >   </Resource>
> > > > > > > > > > > > </tomee>
> > > > > > > > > > > >
> > > > > > > > > > > > Also I have tried to put the username and password to
> > > > > > > > > > > > ACtiveMQResourceAdapter but in both cases I receive
> the
> > > > next
> > > > > > > > > exception:
> > > > > > > > > > > >
> > > > > > > > > > > > WARNING: Unable to enlist XAResource
> > > > > > > > > > > > org.apache.geronimo.transaction.manager.
> > > > > > WrapperNamedXAResource@
> > > > > > > > > > 5849b991,
> > > > > > > > > > > > errorCode: -7
> > > > > > > > > > > > javax.transaction.xa.XAException: User name [null] or
> > > > > > password is
> > > > > > > > > > > invalid.
> > > > > > > > > > > >
> > > > > > > > > > > > The external instance is a docker container (
> > > > > > > > > > > >
> https://registry.hub.docker.com/u/webcenter/activemq/)
> > > > which
> > > > > > > says
> > > > > > > > > that
> > > > > > > > > > > > default user login and password is user. So is it
> > > correctly
> > > > > > > > > configured?
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Reply via email to