1

I missed configured JBoss AS 7.1.1 standlone.xml for JMS queues service.

<subsystem xmlns="urn:jboss:domain:messaging:1.1">
    <hornetq-server>
        <persistence-enabled>true</persistence-enabled>
        <journal-file-size>102400</journal-file-size>
        <journal-min-files>2</journal-min-files>
        <security-enabled>false</security-enabled>
        <connectors>
            <netty-connector name="netty" socket-binding="messaging"/>
            <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
                <param key="batch-delay" value="50"/>
            </netty-connector>
            <in-vm-connector name="in-vm" server-id="0"/>
        </connectors>
        <acceptors>
            <netty-acceptor name="netty" socket-binding="messaging"/>
            <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
                <param key="batch-delay" value="50"/>
                <param key="direct-deliver" value="false"/>
            </netty-acceptor>
            <in-vm-acceptor name="in-vm" server-id="0"/>
        </acceptors>
        <security-settings>
            <security-setting match="#">
                <permission type="send" roles="guest"/>
                <permission type="consume" roles="guest"/>
                <permission type="createNonDurableQueue" roles="guest"/>
                <permission type="deleteNonDurableQueue" roles="guest"/>
            </security-setting>
        </security-settings>
        <address-settings>
            <address-setting match="#">
                <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                <redelivery-delay>0</redelivery-delay>
                <max-size-bytes>10485760</max-size-bytes>
                <address-full-policy>BLOCK</address-full-policy>
                <message-counter-history-day-limit>10</message-counter-history-day-limit>
            </address-setting>
        </address-settings>
        <jms-connection-factories>
            <connection-factory name="InVmConnectionFactory">
                <connectors>
                    <connector-ref connector-name="in-vm"/>
                </connectors>
                <entries>
                    <entry name="java:/ConnectionFactory"/>
                </entries>
            </connection-factory>
            <connection-factory name="RemoteConnectionFactory">
                <connectors>
                    <connector-ref connector-name="netty"/>
                </connectors>
                <entries>
                    <entry name="RemoteConnectionFactory"/>
                    <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                </entries>
            </connection-factory>
            <pooled-connection-factory name="hornetq-ra">
                <transaction mode="xa"/>
                <connectors>
                    <connector-ref connector-name="in-vm"/>
                </connectors>
                <entries>
                    <entry name="java:/JmsXA"/>
                </entries>
            </pooled-connection-factory>
        </jms-connection-factories>
        <jms-destinations>
            <jms-queue name="testQueue">
                <entry name="queue/MyQueue"/>
            </jms-queue>
            <jms-topic name="testTopic">
                <entry name="topic/MyTopic"/>
            </jms-topic>
        </jms-destinations>
    </hornetq-server>
</subsystem>

My properties code used in Java for sending queue message

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "remote://localhost:4447");
props.put(Context.SECURITY_PRINCIPAL, "user");
props.put(Context.SECURITY_CREDENTIALS, "pass");

// user/pass is ManagementRealm's usrname/passwords

I used Java code for send message of queue and before coding I testing for properties JNDI lookup connections.

InitialContext initialContext = new InitialContext(props);
// Context initialContext=new InitialContext(props);
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("jms/RemoteConnectionFactory");
System.out.println("connection success");

I did not get connection i did not get any errors also.

If i used below properties then i did get error is

Exception in thread "main" javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]........etc
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
props.setProperty("java.naming.provider.url", "remote://localhost:4447");

Any suggestions or any other ideas am Googleing also. Please save my days or any mi stacks in my code.and am using spring 3.0.1.

James R. Perkins
  • 16,800
  • 44
  • 60
user3599212
  • 429
  • 2
  • 6
  • 18
  • Have you [read the doc](http://docs.jboss.org/hornetq/2.2.5.Final/user-manual/en/html/using-jms.html#d0e1227)? what is this `remote://`? configure your jndi properties according to the link and check again. – Stephane Nicoll May 21 '14 at 01:55

1 Answers1

1

if you are using spring 3.1 then why will go for properties.read this http://docs.spring.io/spring/docs/2.5.6/reference/jms.html

ravi
  • 161
  • 10