Weblogic 12.1.3未找到PrivilegedActions类 [英] Weblogic 12.1.3 PrivilegedActions class not found

查看:288
本文介绍了Weblogic 12.1.3未找到PrivilegedActions类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个简单的项目,调用一个jms队列并输入一条消息。

i create a simple we project that call a jms queue and put in a message.

这里代码:

public class QueueSend
{
 // Defines the JNDI context factory.
 public final static String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory";

 // Defines the JMS context factory.
 public final static String JMS_FACTORY="jms/MyConnectionFactory";

 // Defines the queue.
 public final static String QUEUE="jms/MyTestQueue";

 private QueueConnectionFactory qconFactory;
 private QueueConnection qcon;
 private QueueSession qsession;
 private QueueSender qsender;
 private Queue queue;
 private TextMessage msg;

 /**
  * Creates all the necessary objects for sending
  * messages to a JMS queue.
  *
  * @param ctx JNDI initial context
  * @param queueName name of queue
  * @exception NamingException if operation cannot be performed
  * @exception JMSException if JMS fails to initialize due to internal error
  */
 public void init(Context ctx, String queueName)
    throws NamingException, JMSException
 {
    qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);
    qcon = qconFactory.createQueueConnection();
    qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    queue = (Queue) ctx.lookup(queueName);
    qsender = qsession.createSender(queue);
    msg = qsession.createTextMessage();
    qcon.start();
 }

 /**
  * Sends a message to a JMS queue.
  *
  * @param message  message to be sent
  * @exception JMSException if JMS fails to send message due to internal error
  */
 public void send(String message) throws JMSException {
    msg.setText(message);
    qsender.send(msg);
 }

 /**
  * Closes JMS objects.
  * @exception JMSException if JMS fails to close objects due to internal error
  */
 public void close() throws JMSException {
    qsender.close();
    qsession.close();
    qcon.close();
 }
/** main() method.
 *
 * @param args WebLogic Server URL
 * @exception Exception if operation fails
 */
 public static void main(String[] args) throws Exception {

    Context ic = getInitialContext("t3://localhost:7001");
    QueueSend qs = new QueueSend();
    qs.init(ic, QUEUE);
    readAndSend(qs);
    qs.close();
 }

 private static void readAndSend(QueueSend qs)
    throws IOException, JMSException
 {

       qs.send("ciao");
       System.out.println("JMS Message Sent: ciao \n");


 }

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

当我启动main时,我有这个错误:

When i launch the main, i have this error:

Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/security/service/PrivilegedActions
    at weblogic.jndi.WLSJNDIEnvironmentImpl.<clinit>(WLSJNDIEnvironmentImpl.java:57)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at weblogic.jndi.internal.JNDIEnvironment.getJNDIEnvironment(JNDIEnvironment.java:37)
    at weblogic.jndi.Environment.<clinit>(Environment.java:92)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
    at javax.naming.InitialContext.init(InitialContext.java:244)
    at javax.naming.InitialContext.<init>(InitialContext.java:216)
    at test.QueueSend.getInitialContext(QueueSend.java:109)
    at test.QueueSend.main(QueueSend.java:86)

我与谷歌一起创建了 PrivilegedActions 在weblogic.security.service( weblogic-api。罐;我已经在我的项目中包含了这个jar但在内部它没有这个类)但只是12.1.3版本的问题?

I have founded, with google, that the PrivilegedActions is in the weblogic.security.service (weblogic-api.jar; i have included this jar in my project but internally it has not this class) but is only a problem of the 12.1.3 version?

感谢您的回复

推荐答案

我找到了解决方案。

我已更新至12.2.1并生成了 wlfullclient.jar 。我已将其添加到Build Library Path并删除了WebLogic Libraries。

I have updated to 12.2.1 and generated a wlfullclient.jar. I have added it to Build Library Path and removed the WebLogic Libraries.

这篇关于Weblogic 12.1.3未找到PrivilegedActions类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆