Hi,
To delete a "JMS Resource Groups" entry like the one you created, from
admin console, click Applications->J2EE connectors and click the
uninstall link next to your module (console.jms/mytest/1.0/rar).
Lin
On Thu, Aug 7, 2008 at 1:17 PM, zm <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm looking forward to put a simple web application to work with JMS
> messaging, but I can't seem to do it.
>
> I have not much experience doing it, so I'm getting a bit frustrated.
>
> First of all, my Java code that sends a message:
>
>
> String message = "Text Message to Send!";
> Connection connection = null;
> Session session = null;
>
> try {
> Context ctx = new InitialContext();
> ConnectionFactory connectionFactory =
> (ConnectionFactory) ctx.lookup(
> "java:comp/env/jms/mycon" );
> Queue myQueue = (Queue) ctx.lookup(
> "java:comp/env/jms/myqueue" );
>
> connection = connectionFactory.createConnection();
>
> session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>
> MessageProducer producer =
> session.createProducer(myQueue);
>
> Message jmsMessage = session.createTextMessage(
> message );
>
> producer.send( jmsMessage );
>
> } catch(Throwable t) {
> throw new Exception("Error found!", t);
> } finally {
> try {
> if(session!=null) session.commit();
> } catch(Throwable t) {
> }
> try {
> if(connection!=null) connection.close();
> } catch(Throwable t) {
> }
> }
>
>
> In the web.xml:
>
> <resource-ref>
> <description></description>
> <res-ref-name>jms/mycon</res-ref-name>
> <res-type>javax.jms.QueueConnectionFactory</res-type>
> <res-auth>Container</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
> <message-destination-ref>
>
> <message-destination-ref-name>jms/myqueue</message-destination-ref-name>
>
> <message-destination-type>javax.jms.Queue</message-destination-type>
> <message-destination-usage>Consumes</message-destination-usage>
> <message-destination-link>MyQueue</message-destination-link>
> </message-destination-ref>
>
>
> Now to configure the Geronimo, I created selecting "for ActiveMQ" option
> under the "JMS Resources", entered data that gave me the following deploy
> plan:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
> <dep:environment
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
> <dep:moduleId>
> <dep:groupId>console.jms</dep:groupId>
> <dep:artifactId>mytest</dep:artifactId>
> <dep:version>1.0</dep:version>
> <dep:type>rar</dep:type>
> </dep:moduleId>
> <dep:dependencies>
> <dep:dependency>
> <dep:groupId>org.apache.geronimo.configs</dep:groupId>
> <dep:artifactId>activemq-broker</dep:artifactId>
> <dep:type>car</dep:type>
> </dep:dependency>
> </dep:dependencies>
> </dep:environment>
> <resourceadapter>
> <resourceadapter-instance>
> <resourceadapter-name>mytest</resourceadapter-name>
> <nam:workmanager
> xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2">
> <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
> </nam:workmanager>
> </resourceadapter-instance>
> <outbound-resourceadapter>
> <connection-definition>
>
> <connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface>
> <connectiondefinition-instance>
> <name>jms/mycon</name>
> <connectionmanager>
> <xa-transaction>
> <transaction-caching/>
> </xa-transaction>
> <single-pool>
> <match-one/>
> </single-pool>
> </connectionmanager>
> </connectiondefinition-instance>
> </connection-definition>
> </outbound-resourceadapter>
> </resourceadapter>
> <adminobject>
> <adminobject-interface>javax.jms.Queue</adminobject-interface>
>
> <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
> <adminobject-instance>
> <message-destination-name>jms/myqueue</message-destination-name>
> <config-property-setting
> name="PhysicalName">jms/myqueue</config-property-setting>
> </adminobject-instance>
> </adminobject>
> <adminobject>
> <adminobject-interface>javax.jms.Topic</adminobject-interface>
>
> <adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
> </adminobject>
> </connector>
>
>
> In the "JMS Resources" list, I now have:
>
> mytest (console.jms/mytest/1.0/rar)
> Type Name Deployed As State Actions
> Connection Factory jms/mycon Server-wide running
> Queue jms/myqueue Server-wide running
>
> ( One question at this point, how can I delete a "JMS Resource Groups" entry
> like the one I created? )
>
>
> Running, I receive the following exception:
>
> Caused by: javax.naming.NotContextException: jms/mycon
> at
> org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContex
> t.java:167)
> at
> org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContex
> t.java:603)
> at javax.naming.InitialContext.lookup(InitialContext.java:351)
> at
> com.megasis.utils.jms.LoggingFacade.postMessage(LoggingFacade.java:17
> 6)
> ... 21 more
>
>
> I'm missing something, probably, and I can't find any good tutorials on how
> to setup JMS without using MDB ...
>
> Any help appreciated.
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/JMS-config-and-use-under-geronimo-tp18875397s134p18875397.html
> Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.
>
>