0

volks!

I have a problem. I want to read some messages from Weblogic 12c. This code is currently working with another server, which wasn't configured by me. So the problem may be in configuration of server.

The problem is when I use code:

public final static String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory";
public final static String JMS_FACTORY="QCF";
public final static String QUEUE="dizzyworldQueue";
public final static String USER_NAME="weblogic";
public final static String USER_PASSWORD="Welcome1";
public final static String URL="t3://localhost:8001";

private static InitialContext getInitialContext(String url) throws NamingException
{
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
    env.put(Context.PROVIDER_URL, url);
    env.put(Context.SECURITY_PRINCIPAL, USER_NAME);
    env.put(Context.SECURITY_CREDENTIALS, USER_PASSWORD);
    return new InitialContext(env);
}


    qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);
    qcon = qconFactory.createQueueConnection(); // here it falls

The error is:

Exception in thread "main" javax.naming.NameNotFoundException: Unable to resolve 'QCF'. Resolved '' [Root exception is javax.naming.NameNotFoundException: Unable to resolve 'QCF'. Resolved '']; remaining name 'QCF'

I have Queue and QueueConnection factory on my server. What can be the rison?

4

1 回答 1

1

该消息表明您的命名服务 (JNDI) 中没有绑定名称为“QCF”的连接工厂。

因此,您必须配置您的应用程序服务器以通过 JNDI 提供队列连接工厂。

如果情况已经如此,您必须在客户端代码中更改该名称以匹配 JNDI 中的名称。

您必须在管理控制台中添加连接工厂和队列。

寻找服务 - JMS 模块。可能添加一个 JMS 模块,并添加一个连接工厂和队列。

看看这个教程,它显示了配置它的步骤。

于 2013-07-03T08:45:31.080 回答