JNDI

Status
Nicht offen für weitere Antworten.
G

Gast

Gast
habe einen Swing-Client der auf einen JBoss zugreift.
Im Projekt direkt eingebunden ist die jbossall-client.jar des JBoss, sowohl im Eclipse als auch in der erzeugten jar-Datei alles bestens.
Code:
...
javax.naming.InitialContext initial=new javax.naming.InitialContext(getProperties());
...
public static Properties getProperties(){
 Properties objProperties = null;
 objProperties = new Properties();
 objProperties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
 objProperties.put(javax.naming.Context.URL_PKG_PREFIXES,"jboss.naming:org.jnp.interfaces");
 objProperties.put(javax.naming.Context.PROVIDER_URL, "localhost:1099" );
 return objProperties;
}
wollte jetzt die jbossall-client.jar auslagern, gehe so vor:
Code:
public static Properties getASProperties(){
 Properties objProperties=new Properties();
 String sst="C:/KOPIASSES/Java/JBoss/client/jbossall-client.jar";
 URL url;
 try{
  url=new URL("file:/"+sst);
  URL[] cp={url};
  URLClassLoader ucl=new URLClassLoader(cp);
  Thread.currentThread().setContextClassLoader(ucl);
  Class c=ucl.loadClass("org.jnp.interfaces.NamingContextFactory"); 
  objProperties.put("org.jnp.interfaces.NamingContextFactory",c.newInstance()); 
  objProperties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); 
  objProperties.put(javax.naming.Context.URL_PKG_PREFIXES,"org.jboss.naming org.jnp.interfaces"); 
  objProperties.put(javax.naming.Context.PROVIDER_URL,"localhost:1099");
 }catch(MalformedURLException e){} 
 catch(ClassNotFoundException e){} 
 catch(InstantiationException e){} 
 catch(IllegalAccessException e){} 
 return objProperties;
}
Zwei Probleme:
1.
Der Ausführung NamingContextFactory klappt im Eclipse, aber in meiner erzeugten jar-Datei nicht, obwohl die objProperties wohl gefüllt wird.
2.
Im Eclipse, wo es funktioniert, dauert der Zugriff auf eine Db-Tabelle via JBoss wesentlich länger.
 

FArt

Top Contributor
Gast hat gesagt.:
1.Der Ausführung NamingContextFactory klappt im Eclipse, aber in meiner erzeugten jar-Datei nicht, obwohl die objProperties wohl gefüllt wird.
2.Im Eclipse, wo es funktioniert, dauert der Zugriff auf eine Db-Tabelle via JBoss wesentlich länger.

1. Fehlermeldung?
2. Im Vergleich zu was? Werden ein Haufen Daten zum Client transferiert? Dann ist natürlich das marshalling/unmarshaling schuld.

btw: warum so umständlich? Leg doch einfach eine Datei jndi.properties mit den Properties für den Server in den Klassenpfad des Clients... dann reicht ein new InitialContext() aus...
 
G

Gast

Gast
benutze verschiedene Applikationsserver, in der Applikation wählt der Benutzer einen AS JBoss, Geronimo ggf. WebSphere aus, weiß nicht, ob das mit jndi.properties geht.

1. keine Fehlermeldung Eclipse bzw. jar-Datei
2. im Beispiel Liste mit 40 Ds - unterschied ca. Faktor 8 längere Zeit
 
Status
Nicht offen für weitere Antworten.

Ähnliche Java Themen

Neue Themen


Oben