我正在将ejb应用程序从OC4j迁移到JBoss AS7,我能够成功部署ear,如下面JBoss控制台中的消息所述
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")
并且应用程序正在使用Customdatabase身份验证,因此更新了standalone.xml,如下所述:
<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>
并将远程连接器配置为:
<subsystem xmlns="urn:jboss:domain:remoting:1.1">
<connector name="remoting-connector" socket-binding="remoting"/>
</subsystem>
应用程序的Jndi属性是:
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"
现在我正在创建loginContext并从应用程序执行登录操作,但是我在控制台中遇到以下错误:
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)
我已经尝试使用JBoss的示例远程ejb应用程序并且它工作正常但是当我尝试将我的应用程序与JBoss连接时,它不允许连接。
我需要做些什么来进行沟通吗?
答案 0 :(得分:0)
我不确定Customdatabase凭据是如何工作的,但看起来您可能需要调整这些行:
Context.SECURITY_CREDENTIALS = <db user name>
Context.SECURITY_CREDENTIALS = <db password>
SECURITY_CREDENTIALS列出两次。应该是
Context.SECURITY_PRINCIPAL = <db username>
Context.SECURITY_CREDENTIALS = <db password>
另外,只是看它是否有效:
Context.SECURITY_PRINCIPAL = <jboss username>
Context.SECURITY_CREDENTIALS = <jboss password>
此外,可能是白色空间造成问题。尝试:
Context.SECURITY_PRINCIPAL=<db user name>
Context.SECURITY_CREDENTIALS=<db password>