• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ClassNotFoundException

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have written a client program. The code is below:
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.*;
import javax.security.auth.login.*;
import com.ibm.websphere.security.auth.callback.*;
import com.ibm.websphere.naming.WsnInitialContextFactory;


// Perform an InitialContext and default lookup prior to logging in so that target realm
// and bootstrap host/port can be determined for SecurityServer lookup.

public class JaasClient
{

public JaasClient()
{
Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
//env.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost.aapam.com:2809");
env.put(Context.PROVIDER_URL, "iiop://localhost.aapam.com:2809/nagraj");
Context initialContext = null;

LoginContext lc = null;
try {
initialContext = new InitialContext(env);
Object obj = initialContext.lookup("");
lc = new LoginContext("nagLogin",
new WSCallbackHandlerImpl("nagraj", "wizard", "nagraj"));



} catch (LoginException le) {
System.out.println("Cannot create LoginContext. " + le.getMessage());
le.printStackTrace();

// insert error processing code
} catch(SecurityException se) {
System.out.println("Security Exception." + se.getMessage());
// Insert error processing
}
catch(NamingException ne) {
System.out.println("Naming Exception" + ne.getMessage());
ne.printStackTrace();
// Insert error processing
}
try {
lc.login();

} catch(LoginException le) {
System.out.println("Fails to create Subject. " + le.getMessage());
// Insert error processing code
}
}
public static void main(String[] ab) throws Exception
{
JaasClient a = new JaasClient();
}
}
sample.sh file is used to compile the file which contains:

export WAS_HOME=/opt/WebSphere/AppServer
echo $WAS_HOME
javac -classpath $CLASSPATH:/$WAS_HOME/lib/wssec.jar:/$WAS_HOME/lib/naming.jar:. JaasClient.java -d .
runClient.sh file is used to run the client which contains:
export WAS_HOME=/opt/WebSphere/AppServer
echo $WAS_HOME
export PATH=/$WAS_HOME/java/bin:$PATH
java -classpath $CLASSPATH:/$WAS_HOME/lib/wssec.jar:/$WAS_HOME/lib/namingclient.jar:/$WAS_HOME/lib/j2ee.jar:. JaasClient
When I run the client using runClient.sh I am getting the following error. Can anyone help me in this. It is very urgent.
Thanks in advance.
Nagaraj
]
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Which version of WebSphere are you using. Also what exactly is the error could you please paste the stack trace?
Suttan
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
READ THE INFOCENTER. Look up "Application Client" in an InfoCenter search and you will find that your method of launching your client will not work.
Kyle
 
reply
    Bookmark Topic Watch Topic
  • New Topic