Java 用户在 WebLogic 中无法通过身份验证

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20061264/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 22:46:17  来源:igfitidea点击:

User failed to be authenticated in WebLogic

javaweb-servicesweblogic11gweblogic12c

提问by DreamBigAlvin

I'm having problem with authenticating my weblogic server, i assigned correct username and password, what went wrong with my project? Is there any configuration that i need to be configure with my web logic server that causes this error authentication and what it would be? I already added wlfullclient.jar file.

我在验证我的 weblogic 服务器时遇到问题,我分配了正确的用户名和密码,我的项目出了什么问题?是否有任何配置需要使用我的 Web 逻辑服务器进行配置,从而导致此错误身份验证以及它会是什么?我已经添加了 wlfullclient.jar 文件。

Exception in thread "main" javax.naming.AuthenticationException [Root exception is java.lang.SecurityException: User: webogic, failed to be authenticated.]
    at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:42)
    at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:808)
    at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:697)
    at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:485)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:373)
    at weblogic.jndi.Environment.getContext(Environment.java:319)
    at weblogic.jndi.Environment.getContext(Environment.java:288)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:117)
    at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
    at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
    at javax.naming.InitialContext.init(Unknown Source)
    at javax.naming.InitialContext.<init>(Unknown Source)
    at com.rest.client.Type4Conn.main(Type4Conn.java:23)
Caused by: java.lang.SecurityException: User: webogic, failed to be authenticated.
    at weblogic.common.internal.RMIBootServiceImpl.authenticate(RMIBootServiceImpl.java:116)
    at weblogic.common.internal.RMIBootServiceImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:693)
    at weblogic.rmi.internal.BasicServerRef.run(BasicServerRef.java:519)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:515)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)

Here is my code:

这是我的代码:

 public static void main(String ar[])throws Exception{
        String username="weblogic";
        String password="weblogic";

        Properties p=new Properties();
        p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
        p.put(Context.PROVIDER_URL,"t3://192.168.1.188:7001");        
        p.put(Context.SECURITY_PRINCIPAL, username);        
        p.put(Context.SECURITY_CREDENTIALS, password);        
        InitialContext ctx=new InitialContext(p);
        DataSource ds=(DataSource)ctx.lookup("ds_orclmrcos");    
        System.out.println(ds);
        Connection con=ds.getConnection();
        Statement st=con.createStatement();

        st.executeUpdate("insert into TBL_CUSTOMER(CUST_ID, CUST_FNAME, CUST_MNAME, CUST_LNAME,CUST_ADDRESS,CUST_STATUS)"+
        "VALUES('C-002', 'ALVIN', 'C.','TEST','MANILA', 'PERMANENT')");

        System.out.println(" records inserted");


    }

回答by Alfred Xiao

WebLogic11g and 12c require passwords to include number or symbols - "[Security:099116]The number of numeric or special characters in a password can not be less than 1." - so I think your password 'weblogic' is not going to work.

WebLogic11g 和 12c 要求密码包含数字或符号 - “[Security:099116]密码中的数字或特殊字符的数量不能少于 1。” - 所以我认为你的密码“weblogic”是行不通的。

You can goto WebLogic Admin Console to reset the password: Admin Console >> Security Realms >> myrealm >> Users and Groups >> weblogic >> Passwords.

您可以转到 WebLogic 管理控制台重置密码:管理控制台 >> 安全领域 >> myrealm >> 用户和组 >> weblogic >> 密码。

EDIT: It works on my machine! And I hit below similar exception stack if I provide a wrong password:

编辑:它适用于我的机器!如果我提供了错误的密码,我就会遇到类似的异常堆栈:

Caused by: java.lang.SecurityException: User: weblogic, failed to be authenticated.
at weblogic.common.internal.RMIBootServiceImpl.authenticate(RMIBootServiceImpl.java:116)
at weblogic.common.internal.RMIBootServiceImpl_WLSkel.invoke(Unknown Source)

I used the same code as yours, and wlfullclient.jar (interesting though, it is from my DB installation folder: 11.2.0.3/dbhome_1/owb/lib/int/wlfullclient.jar).

我使用了与您相同的代码和 wlfullclient.jar(不过很有趣,它来自我的数据库安装文件夹:11.2.0.3/dbhome_1/owb/lib/int/wlfullclient.jar)。

回答by RVA

May you have lock your user account.. Try to unlock it : In WLS Console (you need to be log as admin) -> Security -> Unlock User Type your user to unlock here.

可能您锁定了您的用户帐户.. 尝试解锁它:在 WLS 控制台中(您需要以管理员身份登录)-> 安全性-> 解锁用户在此处键入要解锁的用户。

回答by user4311299

I also had similar problem and guess what while installing..the previous attempt I had put password not satisfying the criteriabut don't know why even if the script exited a process was running in background, after killing that process issue resolved. :D

我也遇到了类似的问题,并猜测在安装时发生了什么......我之前的尝试put password not satisfying the criteria但不知道为什么即使脚本退出了一个进程也在后台运行,在杀死该进程问题解决后。:D

回答by lungu

For anyone having this problem in IntelliJ, when you go to your WebLogic server configurations you might notice that the password field is blank. I solved this problem by entering the password, saving and then restarting the server. For some reason, IntelliJ loses the password to WebLogic. Hope this helps :)

对于在 IntelliJ 中遇到此问题的任何人,当您转到 WebLogic 服务器配置时,您可能会注意到密码字段为空。我通过输入密码,保存然后重新启动服务器解决了这个问题。出于某种原因,IntelliJ 丢失了 WebLogic 的密码。希望这可以帮助 :)

回答by Caio Cesar Fantini

  1. Access the weblogic console.
  2. Open the security realms.
  3. In the Users And Groups tab create a user.
  4. In your code use the same username and password.
  1. 访问 weblogic 控制台。
  2. 打开安全领域。
  3. 在用户和组选项卡中创建一个用户。
  4. 在您的代码中使用相同的用户名和密码。