Hi, 
I use Jboss 4.0.3 SP1 as Jms provider and  java 5 to send to a queue a text 
message and a object message and everything works. Unfortunately when I try to 
send to a topic the problem is that no error running the standalone java 
application appears but no message were sent, in fact  using jboss web-console 
I can't view no message in the topic (testTopic). How can I do? Can you help me 
I don't known what it's wrong or if there is a jboss configuration file to 
write. Here is the jndi.properties included in the java project classpath I 
wrote:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=jnp://localhost:1099


Here is the code (I found it in a book):
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.jms.*;
import javax.naming.*;


public class TopicSupplier
        {TopicConnectionFactory topicConnectionFactory;
        TopicConnection topicConnection;
        TopicSession topicSession;
        Topic topic;
        TopicPublisher topicPublisher;
        

                public TopicSupplier()
                        {
                                super();
                                // TODO Stub di costruttore generato 
automaticamente
                        }
public static void createATopicAndPublishOrder()
{InitialContext context;
try
        {
                context = new InitialContext();
                TopicSupplier topicSupplier;
                try
                        {
                                topicSupplier = new TopicSupplier(context);
                                topicSupplier.send();
                                topicSupplier.close();
                                context.close();
                        } catch (JMSException e)
                        {
                                e.printStackTrace();
                        }
                
        } catch (NamingException e )
        {
                e.printStackTrace();
        }


        
}
                
                
                
public TopicSupplier(InitialContext context) throws NamingException, 
JMSException

        {String jmsFactoryName="TopicConnectionFactory";
        
         topicConnectionFactory=(TopicConnectionFactory) 
context.lookup(jmsFactoryName);
         topicConnection=topicConnectionFactory.createTopicConnection();
         topicSession=topicConnection.createTopicSession(false, 
Session.AUTO_ACKNOWLEDGE);
         String topicName="topic/testTopic";
         try
                 {//determina se giĆ  esiste
                         topic=(Topic)context.lookup(topicName);
                         
                 }catch (NamingException namingException){
                         //se non esiste la crea
                         topic=topicSession.createTopic(topicName);
                         //colega la topic al nome
                         context.bind(topicName,topic);
                         
                 }
                 topicPublisher=topicSession.createPublisher(topic);
                 
         
                
        }

public void send() throws JMSException
        { TextMessage sendingMessage=topicSession.createTextMessage();
         topicConnection.start();       
         sendingMessage.setText("Prova");
         topicPublisher.publish(sendingMessage);
        }
                
public void close()
        {
                try
                        {
                                topicPublisher.close();
                                topicSession.close();
                                topicConnection.close();
                        } catch (JMSException e)
                        {
                                
                                e.printStackTrace();
                        }
                
        }
                
                public static void main(String[] args)
                        {
                        
            createATopicAndPublishOrder();
                                
                        }

        }



Thank you in advance for your attention, Leda 


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3932536#3932536

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3932536


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to