JBoss InitialContext problem

View: New views
1 Messages — Rating Filter:   Alert me  

JBoss InitialContext problem

by Haun, Patrick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm using JBoss 4.2.2.GA. I'm trying to use a datasource from the inside
of my Application. Therefore I try to get the EntityManager via a JNDI
lookup.

A JSP file containig this code snippet:

                InitialContext ctx = new InitialContext();
      DatabaseMetaData dm = null;
      DataSource ds = (DataSource)
      ctx.lookup("java:/DerbyDS");

works completly.

But inside my OSGi Application I get the following errors:

1.: using this code snippet
          Context ctx = new InitialContext();
        ctx.lookup("java:/DerbyDS");
               
                leads to
                09:59:34,750 ERROR [STDERR]
javax.naming.CommunicationException: Receive timed out [Root exception
is java.net.SocketTimeoutException: Receive timed out]
               


2.: using this code snippet
       
           final Properties env = new Properties();
         env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
         env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
         env.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
         final Context initialContext = new InitialContext(env);
         initialContext.lookup("java:/DerbyDS");

                leads to:
                09:59:29,508 ERROR [STDERR] DerbyDS not bound


This is my underlying problem. If the JNDI lookups do work properly I
want to get the Entity Manager this way.


CENIT AG, Industriestrasse 52-54, 70565 Stuttgart, Tel.: +49 711 7825-30, Fax: +49 711 7825-4000, Internet: www.cenit.de
Geschaeftsstellen: Berlin, Duesseldorf, Frankfurt, Hamburg, Hannover, Muenchen, Oelsnitz, Saarbruecken
Vorstandsmitglieder: Kurt Bengel, Christian Pusch
Aufsichtsratsmitglieder: Andreas Schmidt (Vorsitzender des Aufsichtsrats), Hubert Leypoldt, Andreas Karrer
Bankverbindungen:
Deutsche Bank (BLZ 600 700 70) Kto. 1661 040 IBAN : DE85 6007 0070 0166 1040 00 SWIFT-CODE : DEUTDESS,
Commerzbank (BLZ 600 400 71) Kto. 532 015 500 IBAN : DE83 6004 0071 0532 0155 00 SWIFT-Code : COBADEFF600,
BW-Bank (BLZ 600 501 01) Kto. 2 403 313 IBAN : DE17 6005 0101 0002 4033 13 SWIFT-Code : SOLADEST
Registergericht: Amtsgericht Stuttgart
Handelsregister: HRB Nr. 19117
Umsatzsteuer: ID-Nr. DE 147 862 777

_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users