问题描述
我有独立的Java客户端(从eclipse中运行),我希望连接到外部服务器。如果服务器是localhost,那么我根本看不到任何问题。但是,无论何时我尝试连接到外部服务器,我总是收到以下异常。
- JBREM000200:远程连接失败:javax。 security.sasl.SaslException:验证失败:所有可用的身份验证机制失败
- 无法注册连接到远程的EJB接收器://10.160.148.61:4447
java.lang.RuntimeException:javax.security .sasl.SaslException:验证失败:所有可用的验证机制失败
我已经尝试按照上述步骤
异常告诉我,与身份验证相关的配置文件有问题。这是我的ejb_client_properties文件
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED = false
remote.connections =默认
remote.connection.default.host = 10.160.148.61
remote.connection.default.port = 4447
remote.connection.default 。连接方式code>
注意:用户tan被添加到我的服务器上的mgt.user.properties文件中。我使用add-user.bat在服务器中添加一个用户。我还添加了一个应用程序用户。我使用相同的凭据传递给服务器。我不能想到别的什么
我的ejb调用如下:
final Hashtable jndiProperties =新的Hashtable();
jndiProperties.put(Context.URL_PKG_PREFIXES,org.jboss.ejb.client.naming);
InitialContext aJNDI = new InitialContext(jndiProperties);
Ppi handle =(Ppi)aJNDI
.lookup(ejb:PPIEAR / PService / PConnect!com.gem.p.PConnection?stateful);
我看到与异常有关的许多线程,但无法修复(有人可以帮助。 p>
我还有一个合法的SSL证书安装在服务器上,我需要做一些额外的事情来照顾吗?
另请注意:我的服务器以独立模式运行。
确定我已经能够找出问题。
这是在服务器端正在添加的应用程序用户的情况,具体见下文。
[userone @ localhost bin] $ ./add-user.sh
您要添加什么类型的用户?
a)管理用户(mgmt-users.properties)
b)应用程序用户(application-users.properties)
(a):b
输入要添加的新用户的详细信息。
领域(ApplicationRealm):ApplicationRealm ---->>在这里小心您需要键入这个或将其留空。我在这里填补了错误的价值,事情从那里出了问题。
用户名:testuser
密码:testpassword
重新输入密码:testpassword
您希望此用户属于哪些角色? (请输入逗号分隔的列表,或留空为空):testrole
关于为域ApplicationRealm添加用户'testuser'
这是正确的是/否?是
将用户'testuser'添加到文件'/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-users.properties'
将用户'testuser'添加到文件'/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-users.properties'
已添加用户'testuser'与角色testrole到文件'/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-roles.properties'
添加用户'testuser'与角色testrole文件'/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-roles.properties'
。
。
我花了很长时间来弄清楚这一点。有用的链接: http://middlewaremagic.com/jboss/?p=1466
I have standalone Java client(Running from within eclipse ) that I wish to connect to an external server . If the server is localhost then i see no problems at all . However whenever i try to connect to the external server where I always gets the following exception
- JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
- Could not register a EJB receiver for connection to remote://10.160.148.61:4447
java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
I have tried to follow the steps mentioned EJB invocations from a remote client using JNDI
The exception tells me tthere is something wrong in my configuration files related to authentication . Here is my ejb_client_properties file
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=10.160.148.61
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.username=tan
remote.connection.default.password=f2b1c3c7d3f1e224cbf6508494cf0418
Note : the user tan is added to my mgt.user.properties file on the server . I used add-user.bat to add a user in the server . I also added an application user . I use the same credentials to pass to the server . I cant think of anything else .
My ejb calling is as follows :
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
InitialContext aJNDI = new InitialContext(jndiProperties);
Ppi handle = (Ppi) aJNDI
.lookup("ejb:PPIEAR/PService/PConnect!com.gem.p.PConnection?stateful");
I see numerous threads related to the exception but unable to fix it :( Can someone help .
I also have a legitimate SSL certificate installed on the server . Do i need to do something extra to take care of that ?
Also NOTE : My server is running in standalone mode .
Ok I have been able to figure out the problem .
It was a case of the the application user being added incorrectly on the server side . Specifically see below .
[userone@localhost bin]$ ./add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): b
Enter the details of the new user to add.
Realm (ApplicationRealm) : ApplicationRealm ---->> Careful Here . You need to type this or leave it blank . I filled an incorrect value here and things went wrong from there .
Username : testuser
Password : testpassword
Re-enter Password : testpassword
What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none) : testrole
About to add user 'testuser' for realm 'ApplicationRealm'
Is this correct yes/no? yes
Added user 'testuser' to file '/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-users.properties'
Added user 'testuser' to file '/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-users.properties'
Added user 'testuser' with roles testrole to file '/home/userone/jboss-as-7.1.0.Final/standalone/configuration/application-roles.properties'
Added user 'testuser' with roles testrole to file '/home/userone/jboss-as-7.1.0.Final/domain/configuration/application-roles.properties'
.
.
I took me a long time to figure this out . Helpful link for the same :: http://middlewaremagic.com/jboss/?p=1466
这篇关于javax.security.sasl.SaslException:从远程客户端连接到Jboss 7服务器时,Authentic失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!