Hi

Still without jdbc for JMS

:-(

then I've tried to use activeMQ own configuration file, following the
instructions at

http://tomee.apache.org/jms-resources-and-mdb-container.html

two things here (I am using WTP, sorry, I know you guys thinks this is
wrong) :-)

[1] the page is missing one dependency, it's the activemq-spring-5.8.0.jar
[2] so I've imported activemq.xml to the eclipse "server" and copied into
tomee conf dir, but BrokerXmlConfig =  xbean:file:conf/activemq.xml did not
work, so I had to use the absolute URI path

so now it still does not work, with message

Could not connect to broker URL: tcp://localhost:61616. Reason:
java.net.ConnectException: Connection refused

my tomee.xml looks like

    <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">

        BrokerXmlConfig =
xbean:file:/home/myuser/apache-tomee-plus-1.5.2/conf/activemq.xml
        ServerUrl       =  tcp://localhost:61616
    </Resource>

    <Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory">

        ResourceAdapter = MyJmsResourceAdapter
    </Resource>

    <Container id="MyJmsMdbContainer" ctype="MESSAGE">
        ResourceAdapter = MyJmsResourceAdapter
    </Container>


    <Resource id="FooQueue" type="javax.jms.Queue"/>

and activemq.xml looks like

        <transportConnectors>
            <!-- DOS protection, limit concurrent connections to 1000 and
frame size to 100MB -->
            <transportConnector name="openwire" uri="tcp://
0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600
"/>
            <transportConnector name="amqp" uri="amqp://
0.0.0.0:5672?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600
"/>
        </transportConnectors>

and the code seems right (since it's looking for the right address)

@Stateless
public class SampleQueue {

    @Resource(name="MyJmsConnectionFactory")
    private ConnectionFactory connectionFactory;

    @Resource(name="FooQueue")
    private Queue queue;

so I guess there's something to be done in order to start activeMQ to
listen localhost:61616.

TIA

Leo


On Tue, Jun 4, 2013 at 1:29 PM, Leonardo K. Shikida <[email protected]>wrote:

> But not any name, right?
>
>     @Resource(name="MyJmsConnectionFactory")
>     private ConnectionFactory connectionFactory;
>
> gives me
>
> INFO: Creating Resource(id=MyJMSDataSource)
> Jun 04, 2013 1:25:20 PM org.apache.openejb.util.OpenEJBErrorHandler
> handleUnknownError
> SEVERE: FATAL ERROR: Unknown error in Assembler.  Please send the
> following stack trace and this message to [email protected] :
>  org.apache.xbean.propertyeditor.PropertyEditorException: Unable to
> resolve class
>     at
> org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:43)
>     at
> org.apache.xbean.propertyeditor.AbstractConverter.toObject(AbstractConverter.java:86)
>     at
> org.apache.xbean.propertyeditor.PropertyEditors.getValue(PropertyEditors.java:284)
>     at org.apache.xbean.recipe.RecipeHelper.convert(RecipeHelper.java:172)
>     at
> org.apache.xbean.recipe.ObjectRecipe.extractConstructorArgs(ObjectRecipe.java:592)
>     at
> org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:275)
>     at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
>     at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
>     at
> org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:49)
>     at
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:1797)
>     at
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:434)
>     at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:353)
>     at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:147)
>     at org.apache.openejb.OpenEJB.init(OpenEJB.java:292)
>     at
> org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:233)
>     at org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:130)
>     at
> org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:121)
>     at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>     at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>     at
> org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
>     at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
>     at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
>     at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:76)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:602)
>     at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
>     at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
> Caused by: java.lang.ClassNotFoundException:
>     at java.lang.Class.forName(Class.java:219)
>     at
> org.apache.xbean.propertyeditor.ClassEditor.toObjectImpl(ClassEditor.java:40)
>     ... 28 more
>
> looks like I am missing something :-)
>
> TIA
>
> Leo
>
>
> On Tue, Jun 4, 2013 at 12:19 PM, Romain Manni-Bucau <[email protected]
> > wrote:
>
>> You can use a resource attribute called name to match the resource id of
>> tomee.xml
>> Le 4 juin 2013 16:11, "Leonardo K. Shikida" <[email protected]> a écrit :
>>
>> > Hi
>> >
>> > sorry for my ignorance :-)
>> >
>> > I am trying to put together
>> >
>> >
>> >
>> http://tomee.apache.org/examples-trunk/injection-of-connectionfactory/README.html
>> >
>> > with
>> >
>> > http://tomee.apache.org/jms-resources-and-mdb-container.html
>> >
>> > so, if I just add
>> >
>> >     <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
>> >         BrokerXmlConfig = broker:(tcp://localhost:61616)
>> >         ServerUrl = tcp://localhost:61616
>> >         DataSource = MyJMSDataSource
>> >     </Resource>
>> >
>> >     <Resource id="MyJMSDataSource" type="javax.sql.DataSource">
>> >         JdbcDriver = com.mysql.jdbc.Driver
>> >         JdbcUrl = jdbc:mysql://localhost:3306/jms
>> >         UserName = xxx
>> >         Password = xxx
>> >     </Resource>
>> >
>> > to my tomee.xml file, it's supposed to activeMQ automatically create a
>> > table into database "jms" and persist all the queue messages there, if I
>> > use
>> >
>> > producer.setDeliveryMode(DeliveryMode.PERSISTENT);
>> >
>> > ?
>> >
>> > will
>> >
>> > @Resource private ConnectionFactory connectionFactory
>> >
>> > automatically be binded to a impliict
>> >
>> >     <Resource id="MyJmsConnectionFactory"
>> > type="javax.jms.ConnectionFactory">
>> >         ResourceAdapter = MyJmsResourceAdapter
>> >     </Resource>
>> >
>> > ?
>> >
>> > and that's it? or am I missing something?
>> >
>> >
>> > TIA
>> >
>> > Leo
>> >
>>
>
>

Reply via email to