lernen.2007
Erfahrenes Mitglied
Die Klasse die abfragt ist das: Ist es richtig so oder muss die Klasse was implementieren?
import java.util.Properties;
import javax.naming.InitialContext;
public class TestJNDI {
/**
*
*
* @param args
*/
public static void main(String[] args) {
Properties p = new Properties();
p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.provider.url", "jnp://localhost:1099");
p.put("java.naming.factory.url.pkgs", "org.jboss.namingrg.jnp.interfaces");
try{
InitialContext jndiContext = new InitialContext(p);
jndiContext.lookup("java:jca/Name");
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
}
}
import java.util.Properties;
import javax.naming.InitialContext;
public class TestJNDI {
/**
*
*
* @param args
*/
public static void main(String[] args) {
Properties p = new Properties();
p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.provider.url", "jnp://localhost:1099");
p.put("java.naming.factory.url.pkgs", "org.jboss.namingrg.jnp.interfaces");
try{
InitialContext jndiContext = new InitialContext(p);
jndiContext.lookup("java:jca/Name");
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
}
}