Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Invalid destination name Exception when use createTopic()

4 views
Skip to first unread message

Wisen

unread,
Mar 15, 2004, 9:30:13 PM3/15/04
to
Folks:
I'm using the Weblogic8.1 with sp1 as my web server. And now I use a
temporary topic for MDB to send result to message producer, in my client I
use the following code:

Topic tempTopic = session.createTemporaryTopic();
TopicSubscriber subscriber = session.createSubscriber(tempTopic);
subscriber.setMessageListener(this);
TopicPublisher publisher = session.createPublisher(topic);
TextMessage tm = session.createTextMessage();
tm.setJMSType("log");
tm.setStringProperty("ReplyTo", tempTopic.getTopicName());

In the last line, I can't use JMSReplyTo as property's name, why? The
exception is :
weblogic.jms.common.MessageFormatException: Illegal property name,
'JMSReplyTo'
In my MDB's onMessage() method, I use the following code:

Topic topic = session.createTopic(tm.getStringProperty("ReplyTo"));
TopicPublisher publisher = session.createPublisher(topic);

and I got the following exception :
weblogic.jms.common.JMSException: Invalid destination name:
WSStoreForwardInternalJMSServermyserver.TemporaryTopic92
at weblogic.jms.frontend.FEManager.destinationCreate(FEManager.java:214)
at weblogic.jms.frontend.FEManager.invoke(FEManager.java:539)
at
weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.java:609)
at
weblogic.jms.dispatcher.DispatcherImpl.dispatchSyncNoTran(DispatcherImpl.jav
a:212)
at weblogic.jms.client.JMSSession.createDestination(JMSSession.java:1961)
at weblogic.jms.client.JMSSession.createTopic(JMSSession.java:1353)
at com.yinbo.test.LogBean.sendToken(LogBean.java:67)
at com.yinbo.test.LogBean.onMessage(LogBean.java:44)
at weblogic.ejb20.internal.MDListener.execute(MDListener.java:382)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

What should I do? Thanks!

Tom Barnes

unread,
Mar 16, 2004, 10:17:23 AM3/16/04
to Wisen
Hi,

(1) Any message property name that begins with "JMS_", "JMSX", or
that matches a message header field name is reserved. Thus
the "Invalid" exception.

(2) The createTopic() call takes a vendor specific format (each
vendor is different). This is the first time I've heard of someone
trying it with temp destinations given that there is a standard
approach to passing destination references directly
in the message header JMSReplyTo field (see (3) below).

It might work to use

"your-JMS-server-name/" + tempdestination.getName()

or even

"./" + tempdestination.getName().

which are the BEA documented formats for createTopic().

(The latter requires that the destination
is running on the same server as the client's
JMS connection host.)

(3) To pass a reference to a temporary topic, pass it as a "Destination"
object in the "JMSReplyTo" header field of the message of the message,
and then get it directly on the receiving end via "msg.getJMSReplyTo()".
This will work with any JMS vendor.

Tom

Wisen

unread,
Mar 18, 2004, 10:03:02 PM3/18/04
to
Tom,
Thank you for your reply.
This time, I follow your advice,using the tm.setJMSReplyTo(tempTopic) method
in my client.
And in my MDB, I use tm.getJMSReplyTo(), codes as following :
Context ctx = new InitialContext(System.getProperties());
TopicConnectionFactory factory = (TopicConnectionFactory)
ctx.lookup("javax.jms.TopicConnectionFactory");
TopicConnection connection = factory.createTopicConnection();
TopicSession session = connection.createTopicSession(false,
TopicSession.AUTO_ACKNOWLEDGE);
System.err.println("Message Reply To : [" + jmsReplyTo.toString() +
"]");
String replyTo = jmsReplyTo.toString();
System.err.println("replyTo = " + replyTo);
Topic topic = (Topic) ctx.lookup(replyTo);
TopicPublisher publisher = session.createPublisher(topic);
TextMessage text = session.createTextMessage();
text.setJMSType("token");
text.setText("Have got your message !");
publisher.publish(text);
System.err.println("Token sended!");
But I got the following Exception:
Message Reply To :
[WSStoreForwardInternalJMSServermyserver.TemporaryTopic119]
replyTo = WSStoreForwardInternalJMSServermyserver.TemporaryTopic119
javax.naming.NameNotFoundException: While trying to lookup
'WSStoreForwardInternalJMSServermyserver.TemporaryTopic119' didn't find
subcontext 'WSStoreForwardInternalJMSServermyserver' Resolved ; remaining
name 'WSStoreForwardInternalJMSServermyserver/TemporaryTopic119'
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:186)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:284)
at
weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java
:244)
at weblogic.jndi.internal.ServerNamingNode_811_WLStub.lookup(Unknown
Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.yinbo.test.LogBean.sendToken(LogBean.java:87)
at com.yinbo.test.LogBean.onMessage(LogBean.java:41)

at weblogic.ejb20.internal.MDListener.execute(MDListener.java:382)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

Want your help.Thanks!


"Tom Barnes"
<pleasereplyinnewsgroup.webl...@newsgroups.bea.com>
???? news:40571A83...@newsgroups.bea.com...

Tom Barnes

unread,
Mar 19, 2004, 10:43:05 AM3/19/04
to Wisen
Hi,

"jmsReplyTo.toString()" returns the JMX mbean name of
the temporary topic - not a JNDI name. This is similar to
the issue in the previous post of this thread. The returned
name simply will not work in a context lookup, (nor will
the returned name work directly in a call to "createTopic()"
-- although it might work in createTopic() if you prepend it with
jmservername + "/".)

Anyhow, There is no need to toString() the reply-to Topic,
or to call "getTopicName()" on it, or to use the String
name at all. You already have a direct reference to the
reply topic right where you need it.

Edit your code as below:

Tom

Wisen wrote:
> Tom,
> Thank you for your reply.
> This time, I follow your advice,using the tm.setJMSReplyTo(tempTopic) method
> in my client.
> And in my MDB, I use tm.getJMSReplyTo(), codes as following :
> Context ctx = new InitialContext(System.getProperties());
> TopicConnectionFactory factory = (TopicConnectionFactory)
> ctx.lookup("javax.jms.TopicConnectionFactory");
> TopicConnection connection = factory.createTopicConnection();
> TopicSession session = connection.createTopicSession(false,
> TopicSession.AUTO_ACKNOWLEDGE);
> System.err.println("Message Reply To : [" + jmsReplyTo.toString() +
> "]");

Remove the following lines:


> String replyTo = jmsReplyTo.toString();
> System.err.println("replyTo = " + replyTo);
> Topic topic = (Topic) ctx.lookup(replyTo);

Change "topic" to "tm.getJMSReplyTo()" in the following line:

0 new messages