javax.jms.TopicConnectionFactory not bound的問題?
在JBOSS\jboss-3.0.4_tomcat-4.0.6環境下做一個最簡單的JMS
Exception in thread "main" javax.naming.NameNotFoundException: javax.jms.TopicConnectionFactory not bound
執行以下的就報這個錯。
這個包有啊,怎麼才能繫結這個啊???
E:\ejbstudy\jms\classes>java -Djava.security.policy=../java.policy -Djava.naming
.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.provider.
url=localhost examples.Client
examples.Client
__
package examples;
import javax.naming.*;
import javax.jms.*;
import java.util.*;
public class Client {
public static void main (String[] args) throws Exception {
// Initialize JNDI
Context ctx = new InitialContext(System.getProperties());
// 1: Lookup ConnectionFactory via JNDI
TopicConnectionFactory factory =
(TopicConnectionFactory)
ctx.lookup("javax.jms.TopicConnectionFactory");
// 2: Use ConnectionFactory to create JMS connection
TopicConnection connection =
factory.createTopicConnection();
// 3: Use Connection to create session
TopicSession session = connection.createTopicSession(
false, Session.AUTO_ACKNOWLEDGE);
// 4: Lookup Desintation (topic) via JNDI
Topic topic = (Topic) ctx.lookup("testtopic");
// 5: Create a Message Producer
TopicPublisher publisher = session.createPublisher(topic);
// 6: Create a text message, and publish it
TextMessage msg = session.createTextMessage();
msg.setText("This is a test message.");
publisher.publish(msg);
}
}--
Exception in thread "main" javax.naming.NameNotFoundException: javax.jms.TopicConnectionFactory not bound
執行以下的就報這個錯。
這個包有啊,怎麼才能繫結這個啊???
E:\ejbstudy\jms\classes>java -Djava.security.policy=../java.policy -Djava.naming
.factory.initial=org.jnp.interfaces.NamingContextFactory -Djava.naming.provider.
url=localhost examples.Client
examples.Client
__
package examples;
import javax.naming.*;
import javax.jms.*;
import java.util.*;
public class Client {
public static void main (String[] args) throws Exception {
// Initialize JNDI
Context ctx = new InitialContext(System.getProperties());
// 1: Lookup ConnectionFactory via JNDI
TopicConnectionFactory factory =
(TopicConnectionFactory)
ctx.lookup("javax.jms.TopicConnectionFactory");
// 2: Use ConnectionFactory to create JMS connection
TopicConnection connection =
factory.createTopicConnection();
// 3: Use Connection to create session
TopicSession session = connection.createTopicSession(
false, Session.AUTO_ACKNOWLEDGE);
// 4: Lookup Desintation (topic) via JNDI
Topic topic = (Topic) ctx.lookup("testtopic");
// 5: Create a Message Producer
TopicPublisher publisher = session.createPublisher(topic);
// 6: Create a text message, and publish it
TextMessage msg = session.createTextMessage();
msg.setText("This is a test message.");
publisher.publish(msg);
}
}--
相關文章
- unity GPU bound or CPU boundUnityGPU
- C++ lower_bound upper_boundC++
- Branch and Bound AlgorithmGo
- Straightforward Lower BoundAIForward
- function和bound method的區別Function
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)的問題處理方式之一ApacheBATException
- js: get event handler bound to the elementJS
- No Hibernate Session bound to threadSessionthread
- CPU-bound(計算密集型) 和I/O bound(I/O密集型)
- mybatis3:Invalid bound statement (not found)MyBatisS3
- MyBatis 錯誤:Invalid bound statement (not found)MyBatis
- mybatis 報錯: Invalid bound statement (not found)MyBatis
- UVA 11020 multiset、lower_bound、 upper_bound STL裡面的排序二叉樹排序二叉樹
- 關於org.apache.ibatis.binding.BindingException: Invalid bound statement (not found),找不到mapper檔案問題解決ApacheBATExceptionAPP
- ABAP關鍵字 IS BOUND, IS NOT INITIAL和IS ASSIGNED的用法辨析
- Scala是世界上最好的語言(一):Type Bound
- A Univariate Bound of Area Under ROC 論文小結
- Invalid bound statement (not found)錯誤解決
- 《扶蘇的問題》題解
- 一個非技術問題的問題
- Spring的問題,還是Tomcat的問題SpringTomcat
- iptables的問題
- sqlldr的問題SQL
- ServerSocket的問題Server
- 問題的核心
- jbuilderx的問題!!!UI
- localhost的問題???localhost
- Bitmap的問題
- CUDA的問題
- 專案中常問的問題
- 【問題解決】單機搭建dataguard的問題
- 密碼學系列之:memory-bound函式密碼學函式
- 記錄一個Elasticsearch的坑 “doc_count_error_upper_bound“ : -1ElasticsearchError
- 解決Redmine建立&更新問題時很慢的問題
- 解決問題的方法和途徑-問題管理
- 請教個問題執行 httprunner 遇到的問題HTTP
- 揹包問題的一道經典問題
- 詢問面試官的面試問題面試