JNDI Context Retrieval in EJB 3.0

I have a doubt about JNDI context retrieval in EJB 3.0. I know that when I call a bean from another bean I can use this line:
InitialContext ctx=new InitialContext();
But I'd like to know whether in a Client I am obliged to pass this parameter:
InitialContext ctx=new InitialContext(System.getProperties());
This method was the one I called when I used EJB 2.1..Now in many examples I find both these approaches...I'd like to know what differentiates one from another and which is the standard in EJB 3.0?
I read that when calling a bean from another bean I can use the first constructor with no parameters...but in clients I am obliged to give the param..why?
Thanks!

Correct me if I am wrong: the application client
container is a "static" container: you need to know
which EJB to call at develop time and you can not
change it later without recompiling.That's not quite right. First, there's nothing special about the application client
container with respect to retrieving Java EE dependencies that is not also true
of Java EE web containers and EJB containers. The programming model for
defining and accessing EE dependencies is exactly the same, independent of
whether the code is running in an Application Client, EJB container, etc.
It's true that dependencies are defined at development time, but one of the
whole reasons for the level of indirection provided by Java EE dependencies
is to allow the target of those dependencies to change without changing code.
E.g, with EJB dependencies this is done using the ejb-link attribute in ejb-ref
or ejb-local-ref. That specifies which EJB is the target of the ejb dependency
without changing the code used to retrieve the dependency.
>
JNDI was designed to be more flexible: you can
dynamically lookup EJB homes, then call a remote
method you like at runtime. Is that flexibility lost
with application client container. Is there any way
to dynamically inquiry-invoke?In the Java EE programming model, components always define what their
dependencies are so that the deployer can configure them. The idea of
doing a direct global lookup without using a Java EE dependency is
outside the scope of Java EE. It works in many implementations but the
specifics are not portable.
We have a presentation that covers some of these topics you might find
interesting. See here :
https://glassfish.dev.java.net/javaee5/ejb/compdependencies_xmlforum_nov15.pdf

Similar Messages

  • How to set jndi context to call EJB?

    Hello!
    install the j2ee sdk 1.4 on a server that has the ip address 211.83.144.48.
    then I deploy a EJB ,but I want to call the method from another pc.
    The problem is that how I initialize the jndi context? How can get the url for "Context.PROVIDER_URL"?
    thks.

    Hi there, I am having what appears to be a very similar problem.
    the code I am using for gaining the initial context is as follows:
    properties.put("java.naming.factory.initial",JNDI_FACT_CLASS_NAME);
    properties.put("java.naming.provider.url", s);
    return new InitialContext(properties);
    where these instantiated variables when pulled out of the hash are :
    java.naming.factory.initial : com.sun.appserv.naming.S1ASCtxFactory
    java.naming.provider.url : iiop://lich.ecs.soton.ac.uk:3700
    this works absolutely fine on the localhost machine, running both client and server, however when
    running on seperate machines I get the same ORB_COMM error as previously stated:
    WARNING: ORBUTIL.connectFailure
    org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:1739) com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:1757)
    ..etc..
    apparently this is caused by :
    java.net.ConnectException: Connection refused
    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:460)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    ...etc...
    the server is definately up and running, and can provide all other services to the remote client, using both the IP and the DNS resolved name, and JVT seems to work fine, just not corba look up's of a queue.
    I am using the Sun Application Platform Server 8 and the standard j2EE RI versions of corba , JNDI e.t.c
    if you could suggest any further reason why the localhost may be resolvable, but the remote may not I would drastically appreciate the help, as I have been scouring forums for 2 days now, and exhaused all
    other potential solutions.
    thanks
    Tim

  • Initializing jndi context to call ejb??Help!!!

    hi!
    I installed j2ee sdk 1.4 ,deployed a ejb on my server.I tried to call the ejb following the example given by the
    book.:
    import javax.naming.*;
    import javax.rmi.*;
    import java.util.*;
    public class jndi {
    public static void main(String[] args) {
    try {
         Hashtable env = new Hashtable();
         Context initctx = new InitialContext();
         Object objref = initctx.lookup("java:comp/env/ejb/HelloRef");
    } catch (Exception ex) {
    System.err.println("Caught an unexpected exception!");
    ex.printStackTrace();
    the error occured:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    then I try to initalize the jndi context:
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL,"ldap://localhost:389");
    Context initctx = new InitialContext(env);
    It still does not work:
    javax.naming.CommunicationException: localhost:389. Root exception is java.net.ConnectException: Connection refused: connect
    Whatcan I do to call the ejb??

    Hi, I think your original code should work ok but you should check the JNDI name of the EJB you deployed.
    In order for your lookup to work properly the JNDI name of your EJB should be "java:comp/env/ejb/HelloRef" to match the lookup in your code.
    Object objref = initctx.lookup("java:comp/env/ejb/HelloRef");
    I'd try that first, you should find the EJB JNDI name in your deployment descriptors within the jar file.

  • How to use JNDI to lookup remote EJB Home?

    Hello,
    I am writing a servlet to call a remote EJB on another machine.
    I use JNDI to lookup remote EJBHome (not) but fail.
    Any advice?
    Any trick to configure application-client.xml?
    Thanks!

    Use com.evermind.server.rmi.RMIInitialContextFactory instead
    Here an example
    // EmployeeClient.java
    package mypackage5;
    import javax.ejb.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import java.io.*;
    import java.util.*;
    import java.rmi.RemoteException;
    import com.evermind.server.ApplicationClientInitialContextFactory;
    import com.evermind.server.rmi.RMIInitialContextFactory;
    * A simple client for accessing an EJB.
    public class EmployeeClient
    public static void main(String[] args)
    System.out.println("EmployeeClient.main(): client started...");
    try
    * initialize JNDI context by setting factory, url and credential
    * in a hashtable
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    //env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
    env.put(Context.PROVIDER_URL, "ormi://koushikm:23791/application4");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "admin");
    * or set these properties in jndi.properties
    * or use container defaults if that's where client got launched from
    Context context = new InitialContext(env);
    * Lookup the EmployeeHome object. The reference is retrieved from the
    * application-local context (java:comp/env). The variable is
    * specified in the assembly descriptor (META-INF/application-client.xml).
    Object homeObject =
    context.lookup("HelloEJB");
    System.out.println("EmployeeClient.main(): bean found...");
    // Narrow the reference to EmployeeHome.
    HelloEJBHome home =
         (HelloEJBHome) PortableRemoteObject.narrow(homeObject,
    HelloEJBHome.class);
    System.out.println("EmployeeClient.main(): home narrowed...");
    // Create remote object and narrow the reference to Employee.
    HelloEJB remote =
         (HelloEJB) PortableRemoteObject.narrow(home.create(), HelloEJB.class);
    System.out.println("EmployeeClient.main(): remote created...");
    String message=remote.helloWorld("SUCCESS");
    System.out.println(message);
    } catch(NumberFormatException e) {
    System.err.println("NumberFormatException: " + e.getMessage());
    } catch(RemoteException e) {
    System.err.println("RemoteException: " + e.getMessage());
    } catch(IOException e) {
    System.err.println("IOException: " + e.getMessage());
    } catch(NamingException e) {
    System.err.println("NamingException: " + e.getMessage());
    } catch(CreateException e) {
    System.err.println("CreateException: " + e.getMessage());
    Hello,
    I am writing a servlet to call a remote EJB on another machine.
    I use JNDI to lookup remote EJBHome (not) but fail.
    Any advice?
    Any trick to configure application-client.xml?
    Thanks!

  • How to get JNDI context on Sun AS8.1? Please help!

    I am using NetBean4.1 with AS8.1.
    I want to write a client application to retrieve a ejb remotely on the AS8.1 server.
    Does anyone know how to get the JNDI initial context?
    If my Sun AS8.1 server is located at ip 218.100.100.100,
    what is the url needed to create a JNDI initial context?
    Also, the ejb my client app going to retreive contains the following class
    CustomerBean.class
    CustomerRemote.class
    CustomerRemoteHome.class
    CustomerRemoteBusiness.class
    when compiling the client app, do I only need CustomerRemoteHome.class?
    or do I need any other class file to compile(stub or whatever)?
    Thank you very much!!

    RTFM
    Using a Stand-Alone Client to Access an EJB Component
    To access an EJB component from a stand-alone client, perform the following steps:
    1. In your client code, instantiate the InitialContext:
    InitialContext ctx = new InitialContext();
    It is not necessary to explicitly instantiate a naming context that points to the CosNaming service.
    2. In the client code, look up the home object by specifying the JNDI name of the home object. For example:
    Object ref = ctx.lookup("jndi-name");
    BeanAHome = (BeanAHome)PortableRemoteObject.narrow(ref,BeanAHome.class);
    For more information about naming and lookups, see �Accessing the Naming Context� on page 239.
    3. Deploy the EJB component to be accessed. For more information on deployment, see �Tools for Deployment� on page 88.
    4. Copy the following JAR files to the client machine and include them in the classpath on the client side:
    * appserv-rt.jar - available at install_dir/lib
    * j2ee.jar - available at install_dir/lib
    5. To access EJB components that are residing in a remote system, set the values for the Java Virtual Machine startup options:
    jvmarg value = "-Dorg.omg.CORBA.ORBInitialHost=${ORBhost}"
    jvmarg value = "-Dorg.omg.CORBA.ORBInitialPort=${ORBport}"
    Here ORBhost is the Application Server hostname and ORBport is the ORB port number (default is 3700).
    This information can be obtained from the domain.xml file on the remote system. For more information on domain.xml file, see the Sun Java System Application Server Administration Reference.
    6. Run the stand-alone client. As long as the client environment is set appropriately and the JVM is compatible, you merely need to run the main class.

  • Error during JNDI lookup Accessing Remote EJB (access to web service restricted using declarative security model)

    Hello everyone,
    I developed a Web Service prototype accessing remote EJB using the EJB
    control with special syntax in the jndi-name attribute: @jws:ejb
    home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
    Everything works fine, but I get an error when I restrict access to my web
    service with a declarative security model by implementing steps provided in
    help doc:
    - Define the web resource you wish to protect
    - Define which security role is required to access the web resource
    - Define which users are granted the required security role
    - Configure WebLogic Server security for my web service(Compatibility
    Security/Users)
    I launch the service by entering the address in a web browser. When prompted
    to accept the digital certificate, click Yes, when prompted for network
    authentication information, enter username and password, navigate to the
    Test Form tab of Test View, invoke the method by clicking the button and I
    get the following exception:
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
    name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
    lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed
    for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
    </detail>
    </error>
    I have a simple Hello method as well in my WebService (which is also
    restricted) and it works fine, but remote EJB access doesn't. I tested my
    prototype on Weblogic 7.2 and 8.1 platforms - same result.
    Is that a bug or I am missing some additional configuration in order to get
    that working. Has anyone seen similar behavior? Is there a known resolution?
    Or a suggested way to work around the problem?
    Thank you.
    Andre

    Andre,
    It would be best if this issue is handled as an Eval Support case. Please
    BEA Customer Support at http://support.beasys.com along with the required
    files, and request that an Eval support case be created for this issue.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "Andre Shergin" <[email protected]> wrote in message
    news:[email protected]...
    Anurag,
    I removed "t3", still get an error but a different one (Unable to create
    InitialContext:null):
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
    create InitialContext:null]</faultstring>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
    lookup from
    jndi://secuser1:[email protected]:7131/AccountDelegatorEJB[Unable to
    create InitialContext:null] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetVisaHistoryTransactions.getVisaHistoryTxn(GetVisaHistoryTransactions
    .jws:67) </jwErrorDetail>
    </detail>
    </error>
    Note: inter-domain communication is configured properly. The Web Service to
    remote EJB works fine without a declarative security.
    Any other ideas?
    Thank you for your help.
    Andre
    "Anurag" <[email protected]> wrote in message
    news:[email protected]...
    Andre,
    It seems you are using the URL
    jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB
    whereas you should not be specifying the "t3:" protocol.
    The URL should be like
    jndi://secuser1:[email protected]:7131/AccountDelegatorEJB
    Please do let me know if you see any issues with this.
    Note that this will only allow you to access remote EJBs in the same WLS
    domain. For accessing EJBs on another domain, you need to configure
    inter-domain communication by
    following a few simple steps as mentioned at
    http://e-docs.bea.com/wls/docs81/ConsoleHelp/jta.html#1106135. This link has
    been provided in the EJB Control Workshop documentation.
    Regards,
    Anurag
    "Andre Shergin" <[email protected]> wrote in message
    news:[email protected]...
    Raj,
    I tried that before, it didn't help. I got similar error message:
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
    failed for
    name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB]</faultstr
    ing>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during JNDI
    lookup from
    jndi:t3://secuser1:[email protected]:7131/AccountDelegatorEJB[Lookup
    failed for
    name:t3://secuser1:[email protected]:7131/AccountDelegatorEJB] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260) at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64) </jwErrorDetail>
    </detail>
    </error>
    Anything else should I try?
    P.S. AccountDelegatorEJB, the remote EJB my Web Service calls is NOTaccess
    restricted.
    I hope there is a solution.
    Thanks,
    Andre
    "Raj Alagumalai" <[email protected]> wrote in message
    news:[email protected]...
    Andre,
    Can you try using the following url with username and password
    jndi://username:password@host:7001/my.resource.jndi.object ?
    once you add webapp level security, the authenticated is the user who
    invokes the EJB.
    http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/ejb/con
    CreatingANewEJBControl.html?skipReload=true
    has more info on using remote EJB's.
    Hope this helps.
    Thanks
    Raj Alagumalai
    WebLogic Workshop Support
    "Alla Resnik" <[email protected]> wrote in message
    news:[email protected]...
    Hello everyone,
    I developed a Web Service prototype accessing remote EJB using the EJB
    control with special syntax in the jndi-name attribute: @jws:ejb
    home-jndi-name="t3://10.10.245.70:7131/AccountDelegatorEJB"
    Everything works fine, but I get an error when I restrict access to my
    web
    service with a declarative security model by implementing steps
    provided
    in
    help doc:
    - Define the web resource you wish to protect
    - Define which security role is required to access the web resource
    - Define which users are granted the required security role
    - Configure WebLogic Server security for my web service(Compatibility
    Security/Users)
    I launch the service by entering the address in a web browser. Whenprompted
    to accept the digital certificate, click Yes, when prompted for
    network
    authentication information, enter username and password, navigate tothe
    Test Form tab of Test View, invoke the method by clicking the buttonand
    I
    get the following exception:
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>Error during JNDI lookup from
    jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookup failed for
    name:t3://10.10.245.70:7131/AccountDelegatorEJB]</faultstring>
    <detail>
    <jwErrorDetail> weblogic.jws.control.ControlException: Error during
    JNDI
    lookup from jndi:t3://10.10.245.70:7131/AccountDelegatorEJB[Lookupfailed
    for name:t3://10.10.245.70:7131/AccountDelegatorEJB] at
    weblogic.knex.control.EJBControlImpl.acquireResources(EJBControlImpl.java:27
    8) at
    weblogic.knex.context.JwsInternalContext.acquireResources(JwsInternalContext
    .java:220) at
    weblogic.knex.control.ControlHandler.invoke(ControlHandler.java:260)at
    ibas.AccountControl.getTransactionHistory(AccountControl.ctrl) at
    ibas.GetSecure.retrieveVisaHistoryTxn(GetSecure.jws:64)</jwErrorDetail>
    </detail>
    </error>
    I have a simple Hello method as well in my WebService (which is also
    restricted) and it works fine, but remote EJB access doesn't. I testedmy
    prototype on Weblogic 7.2 and 8.1 platforms - same result.
    Is that a bug or I am missing some additional configuration in order
    to
    get
    that working. Has anyone seen similar behavior? Is there a knownresolution?
    Or a suggested way to work around the problem?
    Thank you.
    Andre

  • How to change JNDI service provider for EJB's?

    I need EJBean's home interface to be bound to another JNDI provider, not Weblogic.
    How can I do it?
    The most simple solution is not working: to specify <jndi-name> in weblogic-ejb-jar.xml
    for bean as "xxx:bean_name".
    By JNDI rules for such names context factory with name com.sun.jndi.url.xxx.xxxURLContextFactory
    will be used. But for Weblogic this does not work. An exception is thrown during
    bean deployment -
    javax.management.MalformedObjectNameException: ObjectName: Invalid value -> xxx:bean_name
    at javax.management.ObjectName.validateAndAdd(ObjectName.java:440) at javax.management.ObjectName.initObjectName(ObjectName.java:409)
    at javax.management.ObjectName.<init>(ObjectName.java:254) at weblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:196)
    at weblogic.management.runtime.RuntimeMBeanDelegate.register(RuntimeMBeanDelegate.java:90)
    at weblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate.java:83)
    at weblogic.ejb20.internal.BaseEJBHomeMBean.<init>(BaseEJBHomeMBean.java:33) ......................

    This is not an answer on my
    question - My questions was: how to force a Welogic EJB Container to BIND EJBean's
    home interface to another JNDI Service provider, not Weblogic.
    But you wrote how to use JNDI in general - I already know how to use it :)))
    Phil.
    "VSK" <[email protected]> wrote:
    Hi
    Have a look at the code below
    private Context getInitialContext () throws NamingException
    String from = "CtxHelper::getInitialContext ";
    String webLogicHostUrl = t3://SERVERNAME:9001
    Logger.debug(from, "Begin Method", 3);
    Hashtable h = System.getProperties();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory
    h.put(Context.PROVIDER_URL, webLogicHostUrl);
    return new InitialContext(h);
    } //end getInitialContext
    This way we will get the InitailContext and then do a jndi lookup using
    the
    Context object as follows
    ctx.lookup..........
    Now in the above code replace weblogic.jndi.WLInitialContextFactory by
    ur
    provider.
    Hope this helps.
    -VKS
    "Phil Peshin" <[email protected]> wrote in message
    news:[email protected]...
    I need EJBean's home interface to be bound to another JNDI provider,not
    Weblogic.
    How can I do it?
    The most simple solution is not working: to specify <jndi-name> inweblogic-ejb-jar.xml
    for bean as "xxx:bean_name".
    By JNDI rules for such names context factory with namecom.sun.jndi.url.xxx.xxxURLContextFactory
    will be used. But for Weblogic this does not work. An exception isthrown
    during
    bean deployment -
    javax.management.MalformedObjectNameException: ObjectName: Invalidvalue -> xxx:bean_name
    at javax.management.ObjectName.validateAndAdd(ObjectName.java:440)at
    javax.management.ObjectName.initObjectName(ObjectName.java:409)
    at javax.management.ObjectName.<init>(ObjectName.java:254) atweblogic.management.WebLogicObjectName.<init>(WebLogicObjectName.java:196)
    atweblogic.management.runtime.RuntimeMBeanDelegate.register(RuntimeMBeanDelega
    te.java:90)
    atweblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate
    ..java:83)
    atweblogic.ejb20.internal.BaseEJBHomeMBean.<init>(BaseEJBHomeMBean.java:33)

  • How to initialize the jndi context?

    Hello!
    install the j2ee sdk 1.4 on a server that has the ip address 211.83.144.48.
    then I deploy a EJB ,but I want to call the method from another pc.
    The problem is that how I initialize the jndi context? How can get the url for "Context.PROVIDER_URL"?
    thks.

    You need to look document of the application server that u are using.
    Because this depends on application servers.

  • JNDI context federation / external contexts

    I could not find any information whether or not Oracle Application Server supports federation of JNDI contexts.
    I wanted to add external context to its JNDI. I want java:comp/env/external to point to different JNDI provider. (similar to JBoss ExternalContext mbean).
    Anyone knows if that is possible?
    Thank you

    HI Arie,
    If you are accessing enterprise beans with J2EE clients (servlets, JSP, other enterprise beans, J2EE application clients), do not specify and use this arbitrary JNDI name. Instead, define EJB references in the clientsu2019 deployment descriptors and access the beans using these references. For more information, check the following link
    http://help.sap.com/saphelp_nw04/helpdata/en/a0/019b3e25f95f14e10000000a114084/content.htm
    if the above does not work try the following:--
    Try to lookup the Ejb by its JNDI name given in the EJB-J2ee-engine.xml file if it does not exist there  give any valid name and try to lookUp.
    or try to lookup the ejb by its default jndi name.
    "localejbs/bean name>"
    http://help.sap.com/saphelp_nw04/helpdata/en/38/3e5a4201301453e10000000a155106/frameset.htm
    in the Above link refer the second option "Lookup from a Non-J2EE Java Application"
    Siddharth
    Edited by: Siddharth Jain on Aug 22, 2008 7:13 AM

  • Problem: empty JNDI Context, weird name space

    Hello,
    I am unable to deploy our EAR file and one of the suspicious things is that if I print out the 'InitialContext' (the JNDI Context), I get nothing!.
    Here is the code:
    InitialContext jndiContext = new InitialContext();
    System.out.println("CONTEXT: " + jndiContext);
    System.out.println("ENV: " + jndiContext.getEnvironment());
    System.out.println("NAME: " + jndiContext.getNameInNamespace());
    And this is the output I get:
    05/01/18 15:45:50 CONTEXT: javax.naming.InitialContext@18c4a7f
    05/01/18 15:45:50 CONTEXT ENV: {} <=== empty!?
    05/01/18 15:45:50 CONTEXT NAME: wgen <=== where is this 'wgen' coming from!?
    I see 2 issues here:
    1. Why is the Context environment empty? It shouldn't be empty!
    2. Where does the Context name of 'wgen' come from? I do not have 'wgen' mentioned anywhere in ejb-jar.xml
    So then I tried fixing issue 1 by creating the Context environment programmatically:
    java.util.Hashtable env = new java.util.Hashtable();
    env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationInitialContextFactory");
    env.put(javax.naming.Context.SECURITY_PRINCIPAL, "jazn.com/admin");
    env.put(javax.naming.Context.SECURITY_CREDENTIALS, "admin2");
    env.put(javax.naming.Context.PROVIDER_URL, "opmn:ormi://localhost:3201:OAS1.bray/wgen")
    InitialContext jndiContext = new InitialContext(env);
    This still produced an empty environment.
    Has anyone got aaaany ideas about this?
    Where is OAs/OC4J getting that 'wgen' context from? How do you populate the JNDI environment? It's as if the JNDI is completely brain-dead.... and it's possible that it's just misconfigured. All I have in my j2ee/config/ dir is a jndi.properties file that looks like this:
    java.naming.factory.initial=com.evermind.server.ApplicationInitialContextFactory
    java.naming.provider.url=opmn:ormi://localhost:6003:OAS1.bray/wgen
    java.naming.security.principal=admin
    java.naming.security.credentials=admin2
    Thanks,
    Otis

    I would say there is nothing wrong with JNDI in your oc4j. The very fact that the CONTEXT NAME is wgen, which is obtained from the
    java.naming.provider.url=opmn:ormi://localhost:6003:OAS1.bray/wgen
    shows jndi is functioning.
    To see more of you jndiContext, run
    listContext (jndiContext,"")
    after you have added the following method that iterates through the subContexts. Please note that getEnviroment returns the enviroment for the context, not the context itself. It might be empty indeed.
    private static void listContext (Context ctx, String indent) {
    try {
    NamingEnumeration list = ctx.listBindings("");
    while (list.hasMore()) {
    Binding item = (Binding)list.next();
    String className = item.getClassName();
    String name = item.getName();
    System.out.println(indent+className+" "+name);
    Object o = item.getObject();
    if (o instanceof javax.naming.Context)
    listContext ((Context)o,indent+" ");
    catch (NamingException ex) {
    ex.printStackTrace();
    System.err.println ("List error: "+ex);

  • "No JNDI context" error

    Hello.
    I'm currently using SQLDeveloper version 1.5.0.5.3 and since maybe three versions ago, I started getting frequently the following error when opening the application:
    {color:#ff0000}SEVERE 60 0 oracle.jdevimpl.db.adapter.DefaultContextWrapper failed to create naming Context for db connections at url: file:/C:/Documents and Settings/jvargem/Application Data/SQL Developer/system1.5.0.53.38/o.jdeveloper.db.connection.11.1.1.0.22.49.35/connections.xml
    SEVERE 61 16 oracle.jdevimpl.db.adapter.DefaultContextWrapper failed to create naming Context for db connections at url: file:/C:/Documents and Settings/jvargem/Application Data/SQL Developer/system1.5.0.53.38/o.jdeveloper.db.connection.11.1.1.0.22.49.35/connections.xml
    SEVERE 62 15 oracle.jdeveloper.db.DatabaseConnections DatabaseConnections has no JNDI context so cannot list connections.
    SEVERE 63 0 oracle.jdevimpl.db.adapter.DefaultContextWrapper failed to create naming Context for db connections at url: file:/C:/Documents and Settings/jvargem/Application Data/SQL Developer/system1.5.0.53.38/o.jdeveloper.db.connection.11.1.1.0.22.49.35/connections.xml
    SEVERE 64 0 oracle.jdevimpl.db.adapter.DefaultContextWrapper failed to create naming Context for db connections at url: file:/C:/Documents and Settings/jvargem/Application Data/SQL Developer/system1.5.0.53.38/o.jdeveloper.db.connection.11.1.1.0.22.49.35/connections.xml
    SEVERE 65 0 oracle.jdeveloper.db.DatabaseConnections DatabaseConnections has no JNDI context so cannot list connections.{color}
    When this error happens, no connections are displayed, which prevents me from using the application unless I create the connection all over again!
    As I said this happens frequently and afterwards I have to close and restart the application several times until the error goes away. The problem is that sometimes it doesn't go away and I have to restart the computer and restart all over again, hoping it will work.
    As anyone experienced this? Any idea of what may be happening and how to solve it?
    Thanks a lot
    Jo&atilde;o Vargem

    Please read the whole thread before posting.
    You did search the forum, which is great, but then read what people respond! There was only 1 reply here, so that shouldn't be too much work...
    If the latest version still gives you problems, do get back though.
    Regards,
    K.

  • Dynamic jndi-name in weblogic-ejb-jar.xml

    Is there a way to create dynamic (i.e. runtime) jndi-names for EJBs instead of
    (or in addition to) "hard coding" them in the weblogic-ejb-jar.xml file? What
    I'm trying to do is have one WebLogic instance (JVM) host multiple environments
    (our Beta and Training environments) and I simply want to deploy the same .ear
    file twice but have each environment (application - .ear) reference a different
    database schema (jdbc connection pool). I have everything working just fine for
    this scenario except when I define jndi-names for our ejbs. The problem is that
    I am really deploying the same ejbs (jndi-names and actually code base) in each
    applicatoin instance and I get an exception when the WebLogic is trying to deploy
    the second application (.ear) because the jndi-names in it have already been deployed
    by the first application instance. I recieve a jndi error stating that the name
    is already deployed.
    Or is there a better path to go down for what I am trying to do to have one WebLogic
    instance support our beta and training environments? Usually (but not always)
    our code base is the for same for both of these environments, I simply need to
    have each environment use a different database schema.
    Thanks

    A little birdie tells me that BEA does this very thing. Looking at the
    descriptors for WebLogic Portal I see:
    <weblogic-enterprise-bean>
    <ejb-name>LoaderEJB</ejb-name>
    <enable-call-by-reference>True</enable-call-by-reference>
    <jndi-name>${APPNAME}.BEA_content.LoaderHome</jndi-name>
    </weblogic-enterprise-bean>
    Yes, the ${APPNAME} token really is expanded into the J2EE application
    name at deployment time!
    Sincerely,
    Daniel Selman
    Bryan Dixon wrote:
    Rewriting our build process isn't really much of an option for me. Our current
    build process is too complex and time consuming right now to convert to Ant (we
    eventually will do this but not for a while). So are there any other ideas that
    aren't build related?
    Thanks
    "Eric Ma" <[email protected]> wrote:
    You don't need run-time dynamism in JDNI names and it can't be done anyways.
    You
    need token substitution in XML configuration files when building the
    app. If
    you are using Ant for building, then it is a breeze. If not, first convert
    your
    build process to use Ant.
    Also, a single WLS instance hosting multiple environments sounds really
    INTRIGUING
    to me.
    Eric Ma
    "Bryan Dixon" <[email protected]> wrote:
    Is there a way to create dynamic (i.e. runtime) jndi-names for EJBsinstead
    of
    (or in addition to) "hard coding" them in the weblogic-ejb-jar.xml file?
    What
    I'm trying to do is have one WebLogic instance (JVM) host multiple environments
    (our Beta and Training environments) and I simply want to deploy the
    same .ear
    file twice but have each environment (application - .ear) referencea
    different
    database schema (jdbc connection pool). I have everything working just
    fine for
    this scenario except when I define jndi-names for our ejbs. The problem
    is that
    I am really deploying the same ejbs (jndi-names and actually code base)
    in each
    applicatoin instance and I get an exception when the WebLogic is trying
    to deploy
    the second application (.ear) because the jndi-names in it have already
    been deployed
    by the first application instance. I recieve a jndi error stating that
    the name
    is already deployed.
    Or is there a better path to go down for what I am trying to do to have
    one WebLogic
    instance support our beta and training environments? Usually (but not
    always)
    our code base is the for same for both of these environments, I simply
    need to
    have each environment use a different database schema.
    Thanks

  • OC4J 1.0.2.2.1 Creating 2 JNDI Contexts

    Hello,
    I have a problem when creating two JNDI contexts.
    I've got a very simple class that creates 2 contexts serially with 2 separate property objects.
    But the 2nd context seems to be being created with the first properties object. And yes I am closing the first.
    Here is it
    public class TestLookup
    private static void lookup(String name, String password)
    InitialContext ctx = null;
    try
    Properties p = new Properties();
    p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    p.setProperty(Context.PROVIDER_URL, "ormi://localhost:23791");
    p.setProperty(Context.SECURITY_PRINCIPAL, name);
    p.setProperty(Context.SECURITY_CREDENTIALS, password);
    ctx = new InitialContext(p);
    ctx.lookup("Security");
    System.out.println("finish");
    catch (Exception e)
    try
    if (ctx != null)
    ctx.close();
    System.out.println("ctx closed");
    catch (Exception e2)
    e2.printStackTrace();
    e.printStackTrace();
    public static void main(String[] args)
    lookup("123", "admin");
    lookup("admin", "admin");
    Here is the output
    ctx closed
    java.lang.SecurityException: Invalid username/password for default (123)
    etc....
    ctx closed
    java.lang.SecurityException: Invalid username/password for default (123)
    etc....
    Any ideas anyone

    This may be problem with your userid/password. Please look the $OC4J_HOME/j2ee/home/config/principals.xml whether you have a right userid password.
    I did a quick test at looking up at "jdbc/OracleDS" for two users admin and SCOTT and this works fine both in 1.0.2.2.x an 9.0.2
    I got your errors when I had wrong passwords for these users
    regards
    Debu

  • Stand-alone JNDI lookup of an EJB in an Enterprise Application (EAR) build

    Hi All,
    I am having some difficulty doing JNDI look up an EJB 3.0 Bean that is part of an Enterprise Application (EAR) build. Below are all the related codes:
    package ejb;
    import javax.ejb.Local;
    @Local
    public interface Hello1Local {
        public String getHello1();
    package ejb;
    import javax.ejb.Stateless;
    @Stateless
    public class Hello1Bean implements Hello1Local {
        public String getHello1() {
            return "I am Hello1 Bean!";
    package ejb;
    import javax.ejb.Remote;
    @Remote
    public interface Hello2Remote {
        public String getHello2();
    package ejb;
    import javax.ejb.Stateless;
    import javax.ejb.EJB;
    @Stateless
    @EJB(name="ejb/Hello1",
         beanInterface=Hello1Local.class,
         beanName="Hello1Bean")
    public class Hello2Bean implements Hello2Remote {
        @EJB private Hello1Local hello1bean;
        public String getHello2() {
            return hello1bean.getHello1();
    There is no problem looking up Hello2 Bean using an Application Client such as the following:
    public class LocalHelloApplicationClient {
        @EJB(name="Hello2")
        private static Hello2Remote hello2Bean;
        public static void main(String[] args) {
            System.out.println("hello2Bean.getHello2(): " + hello2Bean.getHello2());
    }There is also no problem doing JNDI lookup (from a Stand-Alone Client the same bean if both Hello1 and Hello2 were created by themselves. ie not part of an Enterprise Application (EAR) build. However, I am wondering whether it is possible to do JNDI lookup of the same bean (Hello2) that is part of an Enterprise Application (EAR) built. Below are the type of JNDI lookup entries that I have tried without success:
    public class StandalonePojoCallHelloWorld {
        public static void main(String [] args)
            try
                InitialContext jndiContext = new InitialContext();
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("ejb.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.Hello2.remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.ejb.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.Hello2Remote");
                                                                     or
                Hello2Remote hello2Bean =  (Hello2Remote) jndiContext.lookup("LocalHelloEnterpriseApplication.LocalHelloEnterpriseApplication-ejb.Hello2Remote");
                System.out.println("hello2Bean.getHello2(): " + hello2Bean.getHello2());
            catch (javax.naming.NamingException ne)
             ne.printStackTrace();
    They all came up with the same error message:
    javax.naming.NameNotFoundException: LocalHelloEnterpriseApplication.LocalHelloEnterpriseApplication-ejb.Hello2Remote not found
            at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:216)
            at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:188)
            at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
            at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:129)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)Any suggestion would be appreciated.
    Thanks,
    Jack

    Hello
    I've somme problems to get access to ejb interface from remote stand-alone client.
    Here is my EJB code :
    package stateless;
    import javax.ejb.Stateless;
    @Stateless(name = "TestSB", mappedName = "ejb/stateless/TestSB")
    public class TestEJBBean implements TestEJBRemote {
        public String getMessage() {
           return "Hello EJB World";
    }And the remote interface :
    package stateless;
    import javax.ejb.Remote;
    @Remote
    public interface TestEJBRemote {
        String getMessage();
    } In client side, i just edit main.java like this :
    package testclient;
    import java.io.FileInputStream;
    import java.util.Properties;
    import javax.naming.InitialContext;
    import stateless.TestEJBRemote;
    public class Main {
        public static void main(String[] args) throws Exception {
            Properties props = new Properties();
            props.load(new FileInputStream("jndi.properties"));
            InitialContext ctx = new InitialContext(props);
            TestEJBRemote testEJB = (TestEJBRemote) ctx.lookup("ejb/stateless/TestSB");
            System.out.println(testEJB.getMessage());
    }here is my jndi.properties file (my glassfish server IP is 192.168.0.10) :
    java.naming.factory.initial = com.sun.enterprise.naming.SerialInitContextFactory
    java.naming.factory.url.pkgs = com.sun.enterprise.naming
    java.naming.factory.state = com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
    org.omg.CORBA.ORBInitialHost = 192.168.0.10
    org.omg.CORBA.ORBInitialPort = 3918when i run client on the same machine than the glassfish app server, it works fine.
    But i run it on the different machine than the glassfish app server (on the same LAN without firewall), it fails with this error message :
    eclan@eclan-laptop:~/NetBeansProjects/TestClient$ java -jar dist/TestClient.jar
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 3918"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4038"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4138"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 3918"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4038"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    24 ao&ucirc;t 2008 09:53:05 com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl <init>
    ATTENTION: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 4138"
    org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2690)
         at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2711)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:261)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:274)
         at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:130)
         at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:192)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:181)
         at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:325)
         at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
         at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
         at com.sun.enterprise.naming.SerialContext.narrowProvider(SerialContext.java:131)
         at com.sun.enterprise.naming.SerialContext.getRemoteProvider(SerialContext.java:220)
         at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:160)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at testclient.Main.main(Main.java:14)
    Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:347)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:244)
         ... 13 more
    Caused by: java.net.ConnectException: Connection refused
         at sun.nio.ch.Net.connect(Native Method)
         at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:507)
         at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:105)
         at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:332)
         ... 14 more
    eclan@eclan-laptop:~/NetBeansProjects/TestClient$ THANKS YOU FOR YOUR HELP
    Justin

  • Error in SQL Developer: Database Connections has no JNDI context so cannot

    Hello,
    I have installed SQL Developer 3.1.07 version on Linux. Previously I was able to create a connection and browse the existing tables, add tables, etc.
    Now when I launch SQL Developer, I see that no connections are displayed. Instead there are these three messages indicating an error. Can you please advice on how to resolve this?
    Thanks,
    Errors:
    SEVERE     44     0     oracle.jdeveloper.db.DatabaseConnections     DatabaseConnections has no JNDI context so cannot list connections.
    SEVERE     43     36     oracle.jdevimpl.db.adapter.DefaultContextWrapper     Failed to create naming Context for db connections at url: file:/home/user/.sqldeveloper/system3.1.07.42/o.jdeveloper.db.connection.11.1.1.4.37.59.48/connections.xml
    SEVERE     42     0     oracle.jdevimpl.db.adapter.DefaultContextWrapper     Failed to create naming Context for db connections at url: file:/home/user/.sqldeveloper/system3.1.07.42/o.jdeveloper.db.connection.11.1.1.4.37.59.48/connections.xml

    Hi uparthas,
    Here is a similar thread (Windows 7) marked as answered, and may be applicable to a Linux environment if you are using jdk1.7 rather than jdk1.6:
    Lost my connections.
    If that does not solve the issue, you might also wish to ...
    1. Exit SQL Developer
    2. Delete or rename the /home/user/.sqldeveloper/system3.1.07.42 directory
    3. Launch SQL Developer, perhaps without choosing to migrate settings from a prior install.
    Hope this helps,
    Gary
    SQL Developer Team

Maybe you are looking for