Tag: glassfish的

如何从Java SE中的GlassFish服务器获取初始上下文?

我有一个类如下: public class Poligon { public static void main(String[] args) { try { Context ctx = new InitialContext(); ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup(“jms/javaee7/ConnectionFactory”); Destination destination = (Destination) ctx.lookup(“jms/javaee7/Topic”); JMSContext context = connectionFactory.createContext(); OrderDTO order = context.createConsumer(destination).receiveBody(OrderDTO.class); System.out.println(“Order received: ” + order); } catch (NamingException ex) { Logger.getLogger(Poligon.class.getName()).log(Level.SEVERE, null, ex); } } } 我想得到InitialContext()表单在localhost上运行的服务器(glassfish),但是我收到以下错误: SEVERE: null […]