[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: How to authenticate to the JBoss server from a desktop (
Marcos_APS
do-not-reply at jboss.com
Wed Jul 2 15:11:58 EDT 2008
Hello, Jaikiran!
I'm following the article I found and yours. This is how I'm logging in.
private LoginContext fContextoLogin;
|
| public void conectar(String nomeUsuario, String senha) throws Exception
| {
| String arquivoConfiguracao = "jaas.config";
|
| System.setProperty(
| "java.security.auth.login.config", arquivoConfiguracao);
|
| // Is there a better way the configure the properties bellow?
| System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| System.setProperty(Context.URL_PKG_PREFIXES,
| "org.jboss.naming:org.jnp.interfaces");
| System.setProperty(Context.PROVIDER_URL,
| "jnp://localhost:1099"); // for now I'm just testing locally
|
| CallbackHandler gerenciador =
| new UsernamePasswordHandler(nomeUsuario, senha);
| fContextoLogin = new LoginContext("login", gerenciador);
| fContextoLogin.login();
| }
but I'm getting the error bellow:
| javax.security.auth.login.LoginException: Erro ao localizar fonte de dados: 'java:/LaboratorioInformaticaDS'.
| at br.urca.www.laboratorioinformatica.seguranca.jboss.ModuloLoginFuncionarios$Dados.<init>(ModuloLoginFuncionarios.java:173)
| at br.urca.www.laboratorioinformatica.seguranca.jboss.ModuloLoginFuncionarios$Dados.<init>(ModuloLoginFuncionarios.java:158)
| at br.urca.www.laboratorioinformatica.seguranca.jboss.ModuloLoginFuncionarios.getUsersPassword(ModuloLoginFuncionarios.java:41)
| at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:206)
| 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 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 br.urca.www.laboratorioinformatica.desktop.dados.ejb.ConexaoEJB.conectar(ConexaoEJB.java:38)
| at br.urca.www.laboratorioinformatica.desktop.Lab$Login.login(Lab.java:21)
| at br.urca.www.desktop.Sistema$DialogoLogin$DlgLogin.conectar(Sistema.java:219)
| at br.urca.www.desktop.Sistema$DialogoLogin$DlgLogin.access$0(Sistema.java:201)
| at br.urca.www.desktop.Sistema$DialogoLogin$DlgLogin$2.actionPerformed(Sistema.java:179)
| at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
| at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
| at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
| at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
| at javax.swing.AbstractButton.doClick(Unknown Source)
| at javax.swing.plaf.basic.BasicRootPaneUI$Actions.actionPerformed(Unknown Source)
| at javax.swing.SwingUtilities.notifyAction(Unknown Source)
| at javax.swing.JComponent.processKeyBinding(Unknown Source)
| at javax.swing.KeyboardManager.fireBinding(Unknown Source)
| at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
| at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
| at javax.swing.JComponent.processKeyBindings(Unknown Source)
| at javax.swing.JComponent.processKeyEvent(Unknown Source)
| at java.awt.Component.processEvent(Unknown Source)
| at java.awt.Container.processEvent(Unknown Source)
| at java.awt.Component.dispatchEventImpl(Unknown Source)
| at java.awt.Container.dispatchEventImpl(Unknown Source)
| at java.awt.Component.dispatchEvent(Unknown Source)
| at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
| at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
| at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
| at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
| at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
| at java.awt.Component.dispatchEventImpl(Unknown Source)
| at java.awt.Container.dispatchEventImpl(Unknown Source)
| at java.awt.Window.dispatchEventImpl(Unknown Source)
| at java.awt.Component.dispatchEvent(Unknown Source)
| at java.awt.EventQueue.dispatchEvent(Unknown Source)
| at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
| at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
| at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
| at java.awt.Dialog$1.run(Unknown Source)
| at java.awt.Dialog$3.run(Unknown Source)
| at java.security.AccessController.doPrivileged(Native Method)
| at java.awt.Dialog.show(Unknown Source)
| at java.awt.Component.show(Unknown Source)
| at java.awt.Component.setVisible(Unknown Source)
| at java.awt.Window.setVisible(Unknown Source)
| at java.awt.Dialog.setVisible(Unknown Source)
| at br.urca.www.desktop.Sistema$DialogoLogin.login(Sistema.java:82)
| at br.urca.www.desktop.Sistema$DialogoLogin.access$0(Sistema.java:79)
| at br.urca.www.desktop.Sistema$1.run(Sistema.java:48)
| at java.awt.event.InvocationEvent.dispatch(Unknown Source)
| at java.awt.EventQueue.dispatchEvent(Unknown Source)
| at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
| at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
| at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
| at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
| at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
| at java.awt.EventDispatchThread.run(Unknown Source)
| Caused by: javax.naming.NameNotFoundException: LaboratorioInformaticaDS not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
| 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 sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
| at sun.rmi.transport.Transport$1.run(Unknown Source)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
| at java.lang.Thread.run(Unknown Source)
| at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
| at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
| at sun.rmi.server.UnicastRef.invoke(Unknown Source)
| at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at br.urca.www.laboratorioinformatica.seguranca.jboss.ModuloLoginFuncionarios$Dados.<init>(ModuloLoginFuncionarios.java:165)
| ... 68 more
|
The datasource is not being found. I'm using the same datasource that I use in the web application and it is working there. What am I doing wrong or missing?
Marcos
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4162157#4162157
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4162157
More information about the jboss-user
mailing list