EJB3.0 릴리즈 시 예외 javax가 발생했습니다.naming.NameNotFoundException: myqueue not bound

4888 단어 exception
Service:
 
package com.test.ejb;
 
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import javax.ejb.ActivationConfigProperty;
@MessageDriven(
 activationConfig ={
   @ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue"),
   @ActivationConfigProperty(propertyName="destination",propertyValue="queue/myqueue")
 }
)
 
public class MyQueueMDBBean implements MessageListener {
 
 public void onMessage(Message msg) {
  TextMessage textMessage =(TextMessage)msg;
  
  try {
   System.out.println("MyQueue MDBBean이 ["+text Message.getText()+"]로 호출됨);
   
  } catch (JMSException e) {
   //TODO Auto-generated catch block
   e.printStackTrace();
  }
  
  
 }
 
}
 
Client:
 
 
package com.test.ejb;
 
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.TextMessage;
import javax.naming.InitialContext;
import javax.naming.NamingException;
 
public class MyQueueMDBBeanClient {
 
 /**
  * @param args
  */
 public static void main(String[] args) {
 
  try {
//QueueConnectionFactory 객체 가져오기
   InitialContext context =new InitialContext();
   QueueConnectionFactory factory =(QueueConnectionFactory)context.lookup("ConnectionFactory");
   
//QueueConnection 만들기
   QueueConnection connnection =factory.createQueueConnection();
   
//QueueSession 만들기
   QueueSession session =connnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
   
//Destination 객체 가져오기
   Queue queue =(Queue)context.lookup("queue/myqueue");
   
//텍스트 정보 가져오기
   TextMessage msg =session.create Text Message("세상 안녕!");
   
//발송자 만들기
   QueueSender sender =session.createSender(queue);
   
//세션 닫기
   session.close();
   connnection.close();
//메시지 보내기
   sender.send(msg);
   
   System.out.println ("메시지 발송됨")
  } catch (NamingException e) {
   //TODO Auto-generated catch block
   e.printStackTrace();
  } catch (JMSException e) {
   //TODO Auto-generated catch block
   e.printStackTrace();
  }
 
 }
 
}
 
시작 JBoss를 게시하는 동안 예외가 발생했습니다.
javax.naming.NameNotFoundException: myqueue not bound
 at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
 at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
 at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
 at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
 at org.jnp.server.NamingServer.lookup(NamingServer.java:399)
 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
 at javax.naming.InitialContext.lookup(InitialContext.java:392)
 at org.jboss.util.naming.Util.lookup(Util.java:222)
 at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDestination(JmsActivation.java:464)
 at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:352)
 at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)
 at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
 at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619) 
 
 
해결 방법:
 
JBoss 루트 디렉터리에 있더라고요.
\server\default\deploy 의 mail-service.xml 파일에 다음과 같이 추가됩니다.
  queue/myqueue    jboss.mq:service=DestinationManager
JBoss 문제를 재부팅하면 해결됩니다.
 
토픽을 찾을 수 없습니다.
  <mbean code="org.jboss.mq.server.jmx.Topic" name="jboss.org.destination:server=Topic,name=mytopic" > 
     <!-- JNDI  -->
     <attribute name="JNDIName">topic/mytopic</attribute> 
     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends> 
   </mbean> 

좋은 웹페이지 즐겨찾기