JBoss AS7 : Client is unable to connect to application-server

176 views Asked by At

I am migrating ejb application from OC4j to JBoss AS7, I am able to deploy ear successfully as mentioned in below message in JBoss console

17:30:30,346 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on 127.0.0.1:4447
17:30:30,613 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:/jdbc/testappDataSource]
17:30:39,431 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 26) JBAS018559: Deployed "testapp.ear" (runtime-name : "testapp.ear")

and application is using Customdatabase authentication so updated standalone.xml accordingly as mentioned below:

<security-domain name="testapp" cache-type="default">
                    <authentication>
                        <login-module code="com.demo.dev.framework.products.oc4j.security.auth.OC4JLoginManager" flag="required"/>
                    </authentication>
                </security-domain>

and configured remote connector as:

 <subsystem xmlns="urn:jboss:domain:remoting:1.1">
        <connector name="remoting-connector" socket-binding="remoting"/>
    </subsystem>

Jndi properties of the application is:

INITIAL_CONTEXT_FACTORY=org.jboss.naming.remote.client.InitialContextFactory
PROVIDER_URL=remote://127.0.0.1:4447/testapp
Context.SECURITY_PRINCIPAL=<db user name>
Context.SECURITY_CREDENTIALS=<db password>
Context.URL_PKG_PREFIXES= "org.jboss.ejb.client.naming" 

Now i am creating loginContext and performing login operation from application, however i am getting below error in console:

Created MBeanServer with ID: -793ffe64:14dcde54837:-8000:PC197689:1
2015-06-07 17:31:05,573      1 ERROR ( 114): Failed to create remoting connection.
javax.naming.NamingException: Failed to create remoting connection
    at com.demo.dev.framework.util.ejb.LoginServiceLocator.authenticate(LoginServiceLocator.java:102)
    at com.demo.dev.app.application.security.auth.OC4JLoginModuleWrapper.commit(OC4JLoginModuleWrapper.java:220)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.security.auth.login.LoginContext.invoke(Unknown Source)
    at javax.security.auth.login.LoginContext.access$000(Unknown Source)
    at javax.security.auth.login.LoginContext$4.run(Unknown Source)
    at javax.security.auth.login.LoginContext$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
    at javax.security.auth.login.LoginContext.login(Unknown Source)
    at com.demo.dev.app.application.security.auth.Authentication.authenticate(Authentication.java:49)
    at com.demo.dev.app.application.gui.controller.LoginCommand$LoginUserCommand.getResponseIntern(LoginCommand.java:68)
    at com.demo.dev.framework.gui.command.BlockingGuiCommand.getResponse(BlockingGuiCommand.java:300)
    at com.demo.dev.framework.gui.command.CommandQueue.executeCommand(CommandQueue.java:538)
    at com.demo.dev.framework.gui.command.CommandQueue.doWork(CommandQueue.java:161)
    at com.demo.dev.framework.gui.command.CommandQueue.access$5(CommandQueue.java:141)
    at com.demo.dev.framework.gui.command.CommandQueue$NonModal.run(CommandQueue.java:611)
    at java.lang.Thread.run(Unknown Source)
2015-06-07 17:31:05,706    134 ERROR ( 114): Client is unable to connect to application-server 

(Failed to create remoting connection).
javax.security.auth.login.LoginException: Client is unable to connect to application-server 

(Failed to create remoting connection)
    at com.demo.dev.app.application.security.auth.OC4JLoginModuleWrapper.commit(OC4JLoginModuleWrapper.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.security.auth.login.LoginContext.invoke(Unknown Source)
    at javax.security.auth.login.LoginContext.access$000(Unknown Source)
    at javax.security.auth.login.LoginContext$4.run(Unknown Source)
    at javax.security.auth.login.LoginContext$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
    at javax.security.auth.login.LoginContext.login(Unknown Source)
    at com.demo.dev.app.application.security.auth.Authentication.authenticate(Authentication.java:49)
    at com.demo.dev.app.application.gui.controller.LoginCommand$LoginUserCommand.getResponseIntern(LoginCommand.java:68)
    at com.demo.dev.framework.gui.command.BlockingGuiCommand.getResponse(BlockingGuiCommand.java:300)
    at com.demo.dev.framework.gui.command.CommandQueue.executeCommand(CommandQueue.java:538)
    at com.demo.dev.framework.gui.command.CommandQueue.doWork(CommandQueue.java:161)
    at com.demo.dev.framework.gui.command.CommandQueue.access$5(CommandQueue.java:141)
    at com.demo.dev.framework.gui.command.CommandQueue$NonModal.run(CommandQueue.java:611)
    at java.lang.Thread.run(Unknown Source)

I have tried sample remote ejb application using JBoss and it is working fine however when i try to connect my application with JBoss, it is not allowing to connect.

Is there any additional thing i need to do for communication?

1

There are 1 answers

1
John On

I'm not sure how Customdatabase credentials works but it looks like you might need to adjust these lines:

Context.SECURITY_CREDENTIALS = <db user name>
Context.SECURITY_CREDENTIALS = <db password>

SECURITY_CREDENTIALS is listed twice. Should it be

Context.SECURITY_PRINCIPAL = <db username>
Context.SECURITY_CREDENTIALS = <db password>

Also, just to see if it works:

Context.SECURITY_PRINCIPAL = <jboss username>
Context.SECURITY_CREDENTIALS = <jboss password>

Also, maybe the white spaces are causing a problem. Try:

Context.SECURITY_PRINCIPAL=<db user name>
Context.SECURITY_CREDENTIALS=<db password>