this is my client code

import javax.security.auth.Subject;
import java.security.acl.Group;
import java.util.HashMap;
import java.util.Map;
import javax.naming.Context; 
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginContext;
import org.apache.log4j.Logger;
import org.jboss.security.auth.callback.UsernamePasswordHandler;
import org.jboss.security.ClientLoginModule;
import org.jboss.security.auth.spi.UsernamePasswordLoginModule;

/**
 *
 * @author  Optiwise
 */
public class OptiwiseClient extends     ClientLoginModule
{
   public static void main(String args[]) throws Exception
   {
          Hashtable env = new Hashtable(); 
      env.put(Context.INITIAL_CONTEXT_FACTORY, 
"org.jnp.interfaces.NamingContextFactory"); 
          env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      Logger log = Logger.getLogger("OptiwiseClient");
      log.info("Login with username="+args[0]+", password="+args[1]);
      UsernamePasswordHandler handler = new UsernamePasswordHandler(args[0], 
args[1].toCharArray());
      LoginContext lc = new LoginContext("OptiwiseClient", handler);
      lc.login();

          System.out.println("HANDLER->"+handler);
          System.out.println("LOGIN CONTEXT->"+lc);
      log.info("Looking up RequestMgr Bean");
      InitialContext iniCtx = new InitialContext(env);
          System.out.println("INITIAL CONTEXT->"+iniCtx);
      Object ref = iniCtx.lookup("RequestMgr");
          System.out.println("REFERENCE->"+ref);
      RequestMgrHome home = (RequestMgrHome) ref;
      RequestMgr ob1 = home.create();
          System.out.println("OBJECT NAME"+ob1);
          log.info(ob1);
          System.out.println(ob1);
      log.info("Created Request Manager Object");
      lc.logout();
   }
}


in client side i am getting this exception


F:\sanju\work\JBoss>java -Djava.security.auth.login.config=%JBOSS_HOME%\client\a
uth.conf OptiwiseClient sanju sanju
HANDLER->[EMAIL PROTECTED]
LOGIN CONTEXT->[EMAIL PROTECTED]
INITIAL CONTEXT->[EMAIL PROTECTED]
REFERENCE->RequestMgrHome
Exception in thread "main" java.rmi.ServerException: RemoteException occurred in
 server thread; nested exception is:
        java.rmi.ServerException: EJBException:; nested exception is:
        javax.ejb.EJBException: checkSecurityAssociation; CausedByException is:
        Authentication exception, principal=sanju
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
60)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:701)
        at java.lang.Thread.run(Thread.java:536)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:247)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
        at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Sour
ce)
        at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvo
kerProxy.java:135)
        at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
a:96)
        at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
java:46)
        at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:4
5)
        at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
        at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
        at $Proxy0.create(Unknown Source)
        at OptiwiseClient.main(OptiwiseClient.java:42)
Caused by: java.rmi.ServerException: EJBException:; nested exception is:
        javax.ejb.EJBException: checkSecurityAssociation; CausedByException is:
        Authentication exception, principal=sanju
        at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.j
ava:347)
        at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
24)
        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyF
actoryFinderInterceptor.java:93)
        at org.jboss.ejb.StatelessSessionContainer.internalInvokeHome(StatelessS
essionContainer.java:319)
        at org.jboss.ejb.Container.invoke(Container.java:720)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
nDispatcher.java:284)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
        at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
367)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
        at sun.rmi.transport.Transport$1.run(Transport.java:148)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
60)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:701)
        at java.lang.Thread.run(Thread.java:536)
Caused by: javax.ejb.EJBException: checkSecurityAssociation; CausedByException i
s:
        Authentication exception, principal=sanju
        at org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(Se
curityInterceptor.java:165)
        at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
tor.java:81)
        at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
20)
        ... 21 more

F:\sanju\work\JBoss>



i am trying on the way what you told last, may be it is the reason , becuase when i am 
passing query to the database i am getting some meaningless text instead of the 
password i hav given. so it could be the reason, let me to see it.
thank you for your help. .. 
see my client code too. 
thanks in advance.
sanju

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3832214#3832214

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3832214


-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to