Remote connection failed: javax.security.sasl.SaslException: Authentication
naselpmis Jun 20, 2012 12:10 PMWe are getting below error. We migrating from galssfish to jboss.
below are documentation we followed to setup the remote invocation.
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance
JBoss Server 1 - war file
MotdController.java
package com.controller;
import org.myapp.ejb.Greeter;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
@ManagedBean(name="motd")
public class MotdController {
private String motd;
public void findMotd() {
FacesMessage msg;
FacesContext ftx = FacesContext.getCurrentInstance();
try { Properties jndiProps = new Properties(); jndiProps.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); jndiProps.put(Context.PROVIDER_URL, "remote://<serverip>:4447"); Context ctx = new InitialContext(jndiProps); final Context context = new javax.naming.InitialContext(jndiProps); final Greeter bean = (Greeter) context.lookup("GreeterBean"); final String greeting = bean.greet("Tom"); System.out.println("Received greeting: " + greeting); } catch (Exception e) { e.printStackTrace(); msg = new FacesMessage("failed to call Remote EJB"); ftx.addMessage(null, msg); }
}
public String getMotd() { return motd; }
public void setMotd(String motd) { this.motd = motd; }
---------------------------------------------------------
JBoss Server 2 - jar file
MotdController.java
package org.myapp.ejb;
import javax.ejb.Remote;
import javax.ejb.Stateless;
@Stateless
@Remote (Greeter.class)
public class GreeterBean implements Greeter {
@Override
public String greet(String user) { return "Hello " + user + ", have a pleasant day!"; }
}
---------------------------------
16:22:54,914 ERROR [org.jboss.remoting.remote.connection] (Remoting "config-based-naming-client-endpoint" read-1) JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
16:22:54,915 ERROR [stderr] (http--0.0.0.0-8080-5) javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed]
16:22:54,916 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:51)
16:22:54,916 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:151)
16:22:54,917 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
16:22:54,917 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
16:22:54,919 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.naming.InitialContext.init(InitialContext.java:242)
16:22:54,919 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.naming.InitialContext.<init>(InitialContext.java:216)
16:22:54,920 ERROR [stderr] (http--0.0.0.0-8080-5) at com.controller.MotdController.findMotd(MotdController.java:32)
16:22:54,920 ERROR [stderr] (http--0.0.0.0-8080-5) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:22:54,924 ERROR [stderr] (http--0.0.0.0-8080-5) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
16:22:54,924 ERROR [stderr] (http--0.0.0.0-8080-5) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
16:22:54,925 ERROR [stderr] (http--0.0.0.0-8080-5) at java.lang.reflect.Method.invoke(Method.java:601)
16:22:54,925 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
16:22:54,925 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
16:22:54,925 ERROR [stderr] (http--0.0.0.0-8080-5) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
16:22:54,925 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
16:22:54,926 ERROR [stderr] (http--0.0.0.0-8080-5) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
16:22:54,930 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.faces.component.UICommand.broadcast(UICommand.java:315)
16:22:54,930 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
16:22:54,931 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
16:22:54,931 ERROR [stderr] (http--0.0.0.0-8080-5) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
16:22:54,931 ERROR [stderr] (http--0.0.0.0-8080-5) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
16:22:54,931 ERROR [stderr] (http--0.0.0.0-8080-5) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
16:22:54,931 ERROR [stderr] (http--0.0.0.0-8080-5) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
16:22:54,932 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
16:22:54,934 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
16:22:54,935 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
16:22:54,935 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
16:22:54,935 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
16:22:54,935 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
16:22:54,936 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
16:22:54,936 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
16:22:54,939 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
16:22:54,940 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
16:22:54,941 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
16:22:54,944 ERROR [stderr] (http--0.0.0.0-8080-5) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
16:22:54,944 ERROR [stderr] (http--0.0.0.0-8080-5) at java.lang.Thread.run(Thread.java:722)
16:22:54,945 ERROR [stderr] (http--0.0.0.0-8080-5) Caused by: java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
16:22:54,945 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:87)
16:22:54,946 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:68)
16:22:54,947 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:196)
16:22:54,947 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:169)
16:22:54,947 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:134)
16:22:54,948 ERROR [stderr] (http--0.0.0.0-8080-5) ... 34 more
16:22:54,952 ERROR [stderr] (http--0.0.0.0-8080-5) Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
16:22:54,952 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:365)
16:22:54,953 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:214)
16:22:54,953 ERROR [stderr] (http--0.0.0.0-8080-5) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
16:22:54,953 ERROR [stderr] (http--0.0.0.0-8080-5) at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
16:22:54,953 ERROR [stderr] (http--0.0.0.0-8080-5) at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
16:22:54,954 ERROR [stderr] (http--0.0.0.0-8080-5) at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
16:22:54,954 ERROR [stderr] (http--0.0.0.0-8080-5) at org.xnio.nio.NioHandle.run(NioHandle.java:90)
16:22:54,955 ERROR [stderr] (http--0.0.0.0-8080-5) at org.xnio.nio.WorkerThread.run(WorkerThread.java:184)
16:22:54,955 ERROR [stderr] (http--0.0.0.0-8080-5) at ...asynchronous invocation...(Unknown Source)
16:22:54,955 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)
16:22:54,956 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)
16:22:54,958 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)
16:22:54,958 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)
16:22:54,959 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:105)
16:22:54,959 ERROR [stderr] (http--0.0.0.0-8080-5) at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:67)
16:22:54,960 ERROR [stderr] (http--0.0.0.0-8080-5) ... 37 more