Ciao a tutti.
Mi servirebbe un aiuto.
Ho realizzato seguendo le direttive di un topic su questo portale
http://www.javaportal.it/rw/25590/ed...html#download.
una classe per collegare e effettuare il bind di un oggetto java per inserire un nuovo context nel server LDAP.
il codice è il seguente
import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class BindJavaObject
{
public static void main(String args[])
{
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.j ndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,"ldap://127.0.0.1:389");
env.put(Context.SECURITY_PRINCIPAL,"cn=manager,dc= di,dc=uniroma1,dc=it");
env.put(Context.SECURITY_CREDENTIALS,"secret");
try
{
DirContext ctx = new InitialDirContext(env);
String s = new String("CIAO A TUTTI");
ctx.bind(args[0], s);
}catch(NameAlreadyBoundException nabe)
{
System.err.println("errore");
}catch(Exception e)
{
e.printStackTrace();
}
}
}
Per maggiori dettagli si veda il topic al link precedente.
Dopo aver compilato da shell
# javac BindJavaObject.java ----------------------->(tutto bene)
quando vado per lanciare
#java BindJavaObject cn=prova, dc=di, dc=uniroma1, dc=it
mi da il seguente errore:
Exception in thread "main" java.lang.NoClassDefFoundError: BindJavaObject
at gnu.java.lang.MainThread.run(libgcj.so.70)
Caused by: java.lang.ClassNotFoundException: BindJavaObject not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/home/michele/Desktop/tomcat/common/lib/jsp-api.jar,file:/home/michele/Desktop/tomcat/common/lib/servlet-api.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.70)
at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj .so.70)
at java.lang.ClassLoader.loadClass(libgcj.so.70)
at java.lang.ClassLoader.loadClass(libgcj.so.70)
at gnu.java.lang.MainThread.run(libgcj.so.70)
Credo nn sia dovuto a errori nel codice.
Il mio Package java è il seguente
-java version "1.4.2"
-gij (GNU libgcj) version 4.1.2 (Ubuntu 4.1.2-0ubuntu5)
-javac 1.6.0_02
Tutto in ambiente Linux (ubuntu).
Datemi una mano
Grazie.

Rispondi quotando