1 2 Previous Next 21 Replies Latest reply on Jan 6, 2015 8:51 AM by myakkali

    Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final

    als

      Hello.
      I have the experience of 11 years with JBOSS.
      Recently we wanna to migrate from JBOSS 6 to JBOSS 7.1.0 final

      Here is a part of my code

      final Hashtable jndiProperties = new Hashtable();
      jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");
      jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
      jndiProperties.put("remote.connection.default.username","usera");
      jndiProperties.put("remote.connection.default.password","passa");
      Context context;
      try {
      context = new InitialContext(jndiProperties);

      I may put username and password, I may not put it - all the time I got

      ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
      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]
      at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
      at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:117)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
      at javax.naming.InitialContext.init(InitialContext.java:242)
      at javax.naming.InitialContext.<init>(InitialContext.java:216)

      JBoss is of course running and the user added to application users.
      Any help? Is JBoss 7.1.0 robust enough to port the system from Jboss 6 to it?

        • 1. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
          wdfink

          I suppose this you have a secured connection.

          So add the credentials with:

               put(Context.SECURITY_PRINCIPAL,"user");

               p.put(Context.SECURITY_CREDENTIALS, "user123");

          that should work.

           

          JBoss 7.1.0 will be robust enough, there are some leftovers (mostly special use cases) if you migrate from previous versions, but that depend on what you need for your application.

          But I would recommend to use 7.1.1.Final or even the latest release. There will be enhancements and bugfixes.

          • 2. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
            als

            Hello and many thanks, Wolf-Dieter.

            This succesfully worked.

             

            Now the JNDI problem

            I see that the JNDI name of my ejb is java:app/XXXEJB.

            I am trying to do

            Object ob=context.lookup("java:app/XXXEJB");

             

            and get the

            javax.naming.NameNotFoundException:

             

            What I am doing wrong? the ability of remote access to EJBs is the main issue why we still didnt used the JBoss 7 but prefered 6. But now they say it works....

            Could you help?

            • 3. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
              wdfink

              See this wiki page for more details.

               

              You can not do a lookup remote within the 'java:' namespace.

              • 4. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                als

                many thanks!

                • 5. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                  als

                  hello Wolf-DIeter.

                   

                  I installed the 7.1.1 final.

                  did exactly what wrote in Wiki.

                  Still the same error about JNDI javax.naming.NameNotFoundException.

                  The EAR with EJB JAR is succesfully deployed but this *&&#%& thing doesnt see the JNDI.

                   

                  Did you succeded to connect remote client? How can I see the valid JNDI for invocation, since the JNDI , configured as explained in WIKI doesnt work ...

                   

                  Please help..

                  • 6. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                    als

                    Thanks again Wolf-Dieter,I just solved this.

                    Mistake was that I forgot to put this string

                    jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                     

                    This is important string guys!

                    • 7. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                      vatsanm

                      Need help.  Having same symptom, but cant seem to fix it.

                       

                      .

                      I have a JB 7.1.1 AS server (having EJB client) talking to another JB 7.1.1 AS server (hosting the EJB server).

                      My JNDI - ejb:wfm/wfm//ETMImpl!com.vzw.wfm.server.etm.ETMInterface  - this matches the server JNDI definition.  This is not EJB3 (it maybe EJB2.x or EJB 1.0.5).  I inherited this code.

                      Getting the exception below. 

                      How did you fix the issue?

                       

                      **********************my jboss-ejb-client.xml *************

                      <?xml version="1.0"?>
                      <jboss-ejb-client xmlns="urn:jboss:ejb-client:1.0">
                              <client-context>
                                      <ejb-receivers>
                                              <remoting-ejb-receiver outbound-connection-ref="remote-ejb-connection"/>
                                      </ejb-receivers>
                              </client-context>
                      </jboss-ejb-client>

                       

                      *************************standalone.xml - its a clustered environmetn  not a domain ****************

                      <subsystem xmlns="urn:jboss:domain:remoting:1.1">
                                  <connector name="remoting-connector" socket-binding="remoting"/>
                                  <outbound-connections>
                                      <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-ejb1" >
                                          <properties>
                                              <property name="SASL_POLICY_NOANONYMOUS" value="false"/>
                                              <property name="SSL_ENABLED" value="false"/>
                                          </properties>
                                      </remote-outbound-connection>
                                      <remote-outbound-connection name="remote-ejb-connection2" outbound-socket-binding-ref="remote-ejb2">
                                          <properties>
                                              <property name="SASL_POLICY_NOANONYMOUS" value="false"/>
                                              <property name="SSL_ENABLED" value="false"/>
                                          </properties>
                                      </remote-outbound-connection>
                                  </outbound-connections>
                          </subsystem>

                       

                       

                       

                      <socket-binding-group name="standard-sockets" default-interface="public">
                              <socket-binding name="http" port="8880"/>
                              <socket-binding name="jndi" port="18400"/>
                              <socket-binding name="classServer" port="18401"/>
                              <socket-binding name="jrmp" port="18402"/>
                              <socket-binding name="remoting" port="4447"/>
                              <outbound-socket-binding name="remote-ejb1">
                                  <remote-destination host="myserver.com" port="42010"/>
                              </outbound-socket-binding>
                              <outbound-socket-binding name="remote-ejb2">
                                  <remote-destination host="myserver.com" port="42020"/>
                              </outbound-socket-binding>
                          </socket-binding-group>

                       

                      ******************************************************************************

                       

                      15:44:51,839 INFO  [stdout] (MSC service thread 1-14) EJBClient|lookup|INFO|15|DEFAULT|Tue Apr 10 15:44:51 EDT 2012|MSC service thread 1-14|JNDI created:::> ej
                      b:wfm/wfm//ETMImpl!com.vzw.wfm.server.etm.ETMInterface|
                      15:44:51,855 INFO  [org.jboss.ejb.client] (MSC service thread 1-14) JBoss EJB Client version 1.0.5.Final
                      15:44:51,861 INFO  [stdout] (MSC service thread 1-14) EJBClient|init|INFO|15|DEFAULT|Tue Apr 10 15:44:51 EDT 2012|MSC service thread 1-14|EJB object(myInterfac
                      e) : Proxy for remote EJB StatelessEJBLocator{appName='wfm', moduleName='wfm', distinctName='', beanName='ETMImpl', view='interface com.vzw.wfm.server.etm.ETMI
                      nterface'}|
                      15:44:51,863 INFO  [stdout] (MSC service thread 1-14) EJBClient|init|INFO|15|DEFAULT|Tue Apr 10 15:44:51 EDT 2012|MSC service thread 1-14|exceptionFound flag/e
                      jbObjFound flag : false/true|
                      15:44:51,865 INFO  [stdout] (MSC service thread 1-14) EJBClient|init|INFO|15|DEFAULT|Tue Apr 10 15:44:51 EDT 2012|MSC service thread 1-14|EJB object - myInterf
                      ace : Proxy for remote EJB StatelessEJBLocator{appName='wfm', moduleName='wfm', distinctName='', beanName='ETMImpl', view='interface com.vzw.wfm.server.etm.ETM
                      Interface'}|15:45:40,576 ERROR [org.jboss.remoting.remote.connection] (Remoting "etmimage" read-1) JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
                      15:45:40,580 ERROR [stderr] (http--0.0.0.0-8880-1) java.lang.IllegalStateException: No EJB receiver available for handling [appName:wfm,modulename:wfm,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1c4c54d
                      15:45:40,583 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)
                      15:45:40,584 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:119)
                      15:45:40,585 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)
                      15:45:40,586 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)
                      15:45:40,587 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)
                      15:45:40,588 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)
                      15:45:40,589 ERROR [stderr] (http--0.0.0.0-8880-1)      at $Proxy70.getMdnsForPendingOrders(Unknown Source)
                      15:45:40,590 ERROR [stderr] (http--0.0.0.0-8880-1)      at client.EJBClient.getWfmUpgradePendingLines(Unknown Source)
                      15:45:40,591 ERROR [stderr] (http--0.0.0.0-8880-1)      at coei.webstore.PendingLinesServlet.getUpgradePendingLines(PendingLinesServlet.java:371)
                      15:45:40,592 ERROR [stderr] (http--0.0.0.0-8880-1)      at coei.webstore.PendingLinesServlet.coreOrderProcessing(PendingLinesServlet.java:222)
                      15:45:40,593 ERROR [stderr] (http--0.0.0.0-8880-1)      at coei.webstore.BaseServlet.doPost(BaseServlet.java:443)
                      15:45:40,594 ERROR [stderr] (http--0.0.0.0-8880-1)      at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
                      15:45:40,595 ERROR [stderr] (http--0.0.0.0-8880-1)      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
                      15:45:40,596 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
                      15:45:40,597 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
                      15:45:40,598 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
                      15:45:40,599 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
                      15:45:40,600 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
                      15:45:40,602 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
                      15:45:40,603 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                      15:45:40,604 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                      15:45:40,605 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
                      15:45:40,605 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
                      15:45:40,606 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
                      15:45:40,608 ERROR [stderr] (http--0.0.0.0-8880-1)      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
                      15:45:40,608 ERROR [stderr] (http--0.0.0.0-8880-1)      at java.lang.Thread.run(Thread.java:662)

                       

                      • 8. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                        als

                        try to put into classpath jboss-ejb-client.properties file with text

                         

                         

                         

                        remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

                         

                         

                        remote.connections=default

                         

                         

                        remote.connection.default.host=localhost

                        remote.connection.default.port = 4447

                        remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

                        remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER

                        • 9. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                          vatsanm

                          Do I need jboss-ejb-client.properties even though I am using it under diff JBoss servers?  I thought per documentaion that its only for  standalone EJB client.  I wil try this and update.

                           

                          • 10. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                            vatsanm

                            Got the same excpeiton.

                            here is my jboss-ejb-client.proprties (its in WEB-INF/classes).

                             

                            #JB7 EJB setup
                            endpoint.name=client-endpoint
                            remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

                            remote.connections=default

                            remote.connection.default.host=myserver.com
                            remote.connection.default.port = 42010
                            remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
                            remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER

                            remote.connection.two.host=myserver.com
                            remote.connection.two.port = 42020
                            remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
                            remote.connection.two.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS=JBOSS-LOCAL-USER

                            remote.connection.default.username=wfmuser
                            remote.connection.default.password=wfmuserPassword
                            remote.connection.two.username=wfmuser
                            remote.connection.two.password=wfmuserPassword

                            • 11. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                              wdfink

                              Does this documentation helps?

                              • 12. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                                vatsanm

                                No.  I changed to code to be like the documentation.  The only difference is that instead of stanalone-full.xml, I started with standalone.xml and added remoting subsystem.

                                • 13. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                                  wdfink

                                  If you want to use the connection 'two' you have to change your jboss-ejb-client.properties

                                  change:

                                  remote.connections=default

                                  to:

                                  remote.connections=default, two

                                  to use the second connection.

                                   

                                  Also try the standalone-full.xml just to test whether it solve your problem ...

                                  • 14. Re: Cant connect from EJB Client to EJB in JBOSS AS 7.1.0 Final
                                    vatsanm

                                    I fixed the issue finally. YEEAAAAHHHHH

                                    The issue was not at the client end.  The EJB server was accidently configured for sercure users only ( and the system that was runnign it was takign me out of the application-users.properties file) assumign that they had disabled secure access at the connector.  I did nto need the jboss-ejb-client.peoperties in this case only jboss-ejb-client.xml

                                    The bottomlime :

                                     

                                         THE DOCUMENTAION FOR EJB INVOCATION BETWEEN 2 AS SERVERS IS CORRECT PER LINK - https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance

                                     

                                    I also coverted a standalone client per the documentation and it works perfectly as per link https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI

                                     

                                    Thx for all the help.

                                    1 2 Previous Next