Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在JNDI上下文中找不到Glassfish JMS队列_Java_Glassfish_Jms_Jndi_Glassfish 4 - Fatal编程技术网

Java 在JNDI上下文中找不到Glassfish JMS队列

Java 在JNDI上下文中找不到Glassfish JMS队列,java,glassfish,jms,jndi,glassfish-4,Java,Glassfish,Jms,Jndi,Glassfish 4,我需要帮助 下面的Glassfish管理控制台屏幕显示我已经设置了三个JMS目标资源。除了名字之外,所有的都是一样的。但是我从本地java客户机(Glassfish也是本地的)进行的JNDI查找只能看到前两个。客户端代码和控制台输出在屏幕截图下方 我甚至不知道该从哪里开始找出为什么一个和两个有效,而三个无效。有人能提出什么建议吗。这应该是最基本的。这三个都是相同的设置。没有设置任何其他属性。我真的需要帮助或指导 代码: 公共类SrackOverflow1{ public static vo

我需要帮助

下面的Glassfish管理控制台屏幕显示我已经设置了三个JMS目标资源。除了名字之外,所有的都是一样的。但是我从本地java客户机(Glassfish也是本地的)进行的JNDI查找只能看到前两个。客户端代码和控制台输出在屏幕截图下方

我甚至不知道该从哪里开始找出为什么一个和两个有效,而三个无效。有人能提出什么建议吗。这应该是最基本的。这三个都是相同的设置。没有设置任何其他属性。我真的需要帮助或指导

代码:

公共类SrackOverflow1{

  public static void main(String[] args) {
    Properties env = new Properties();
    env.put ("java.naming.factory.initial", "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put ("java.naming.provider.url","file:///C:/glassfish4/mq/opt/java/my_broker");
    try {
      Context jndiContext = (Context) new InitialContext(env);

      Queue queueOne   = (Queue) jndiContext.lookup("jms/goSendQueue");
      System.out.println("queueOne ok:\n" + queueOne);

      Queue queueTwo   = (Queue) jndiContext.lookup("jms/goReceiveQueue");
      System.out.println("\nqueueTwo ok:\n" + queueTwo);

      Queue queueThree = (Queue) jndiContext.lookup("jms/goTestQueue");
      System.out.println("\nqueueThree ok:\n" + queueThree);

    } catch (NamingException e) {
      System.out.println("\nThrew Naming Exception\nerror msg: " + e.getMessage() +"\n");
      e.printStackTrace();
    }
  }
控制台:

queueOne ok:
Sun Java System MQ Destination
getName():      goSendQueuq
Class:          com.sun.messaging.Queue
getVERSION():       3.0
isReadonly():       false
getProperties():    {imqDestinationName=goSendQueuq, imqDestinationDescription=A Description for the Destination 
Object}

queueTwo ok:
Sun Java System MQ Destination
getName():      goReceiveQueue
Class:          com.sun.messaging.Queue
getVERSION():       3.0
isReadonly():       false
getProperties():    {imqDestinationName=goReceiveQueue, imqDestinationDescription=A Description for the Destinati
on Object}

Threw Naming Exception
error msg: jms/goTestQueue

javax.naming.NameNotFoundException: jms/goTestQueue
    at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
    at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
    at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
    at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.america3.testclasses.SrackOverflow1.main(SrackOverflow1.java:21)

别大喊大叫了!为什么你问题的标题是大写的?其他问题的标题是大写的吗?通过例子学习。好的。这很有帮助。你知道关于这个主题的任何可能也有帮助的东西吗?