Jndi properties in InitialContext : java.naming.factory.initial

I am trying to lookup a bean with the following code. I get a NamingException on line 9 when the jndi properties are referenced. The exception message that I receive is "Cannot instantiate class: org.jnp.interfaces.NamingContextFactory". Does anyone know what the problem may be?
1 // Set the jndi properties
2 Properties jndiProps = new Properties();
3 jndiProps.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
4 jndiProps.setProperty("java.naming.provider.url", "localhost:1099");
5 jndiProps.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
6 try
7 {
8 Context ctx = new InitialContext(jndiProps);
9 homeMyBean = (LocalMetricResultsHome) ctx.lookup("MyBean");5
10 }
11 catch (NamingException e)
12 {
13 // handle namingexception
14 }

It means the .jar file containing that class is not in your ClassPath. Try putting jnp-client.jar into your ClassPath.

Similar Messages

  • 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

    Hi!
    I got this error message at runtime.
    After adding value to the Intialcontext by adding the following code snippet:
    Properties p = new Properties();
    p.put("java.naming.factory.initial",
    "com.sun.jndi.cosnaming.CNCtxFactory");
    p.put("java.naming.provider.url",
    "iiop://127.0.0.1:9010");
    initContext = new javax.naming.InitialContext(p);
    After this i am getting different error message:
    org.omg.CORBA.COMM_FAILURE:
    minor code: 1 completed: Maybe at om.sun.corba.se.internal.iiop.IIOPConnection.purge_calls(Unknown Source)
    at com.sun.corba.se.internal.iiop.ReaderThread.run(Unknown Source)
    Looking forward a proper solution
    for this problem.
    Thanks in advance.
    Regards,
    James Arun

    I have find the code to specify the naming context property to access another host
    Properties props = new Properties();
    props.setProperty("java.naming.factory.initial",
    "com.sun.enterprise.naming.SerialInitContextFactory");
    props.setProperty("java.naming.factory.url.pkgs",
    "com.sun.enterprise.naming");
    props.setProperty("java.naming.factory.state",
    "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
    // optional. Defaults to localhost. Only needed if web server is running
    // on a different host than the appserver
    props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
    // optional. Defaults to 3700. Only needed if target orb port is not 3700.
    props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");

  • NoInitialContextException:  ...java.naming.factory.initial

    Calling J2eeRi.LookupEjbHome() throughs a NoInitialContextException (see bottom) in the last example of the COM Bridge Tutorial:
    ----- last line of the following code segement throws exception:
    Dim JvmCtl As New JvmControl
    JvmCtl.Classpath = "%J2EE_HOME%\lib\j2ee.jar;%COMBRIDGE_HOME%\doc\guide\examples\lib\AccountAppClient.jar"
    JvmCtl.StartJvm
    Set J2eeRi = New J2eeRiServices
    J2eeRi.ProviderURL = "iiop://localhost:1244" '1050
    Set AcctHome = J2eeRi.LookupEjbHome("MyAccount", "account.AccountHome")
    java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException: 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
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:638)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:241)
         at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:278)
         at javax.naming.InitialContext.lookup(InitialContext.java:345)
         at java.lang.reflect.Method.invoke(Native Method)
         at com.sun.interop.beans.PrivilegedMethodInvokeAction.run(PrivilegedMethodInvokeAction.java:51)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.interop.beans.RegularDispatcher.invoke(RegularDispatcher.java:142)
         at com.sun.interop.dispatch.InstanceProxy.Invoke(InstanceProxy.java:96)
    java.lang.Exception: Could not call javax.naming.InitialContext.lookup because: 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
         at com.sun.interop.beans.RegularDispatcher.invoke(RegularDispatcher.java:159)
         at com.sun.interop.dispatch.InstanceProxy.Invoke(InstanceProxy.java:96)
    java.lang.Exception: Could not call javax.naming.InitialContext.lookup because: 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
         at com.sun.interop.beans.RegularDispatcher.invoke(RegularDispatcher.java:159)
         at com.sun.interop.dispatch.InstanceProxy.Invoke(InstanceProxy.java:96)
    What's missing here?

    http://java.sun.com/j2se/1.4.2/docs/api/javax/naming/Context.html
    maybe you should set the property:Context.INITIAL_CONTEXT_FACTORY
    try that.

  • JNDI properties Encryption.

    Hi All,
    I am using OC4J application server 10.1.3.1.0.
    my application is standalone application(thick client).
    to get the lookup of remote application.
    we are using jndi.properties as follows .
    java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory
    java.naming.provider.url=opmn:ormi://ipaddress:6005:group/application,opmn:ormi://ipaddress:6006:group/application
    java.naming.security.principal=myusername
    java.naming.security.credentials=password1
    oracle.j2ee.rmi.loadBalance=lookup
    Now i want one clarification that can i able to encrypt the username and password for security purpose because every client machine is able to see this properties.
    if yes can u suggest the solutions ASAP.
    thanks in advance
    Mohan Reddy

    try it out

  • Javax.naming.NoInitialContextException - jndi.properties

    I created an Enterprise application and deployed an Ejb project to the JBoss server.When I try to connect to the JNDI like this:
    Object o = initialContext.lookup(JNDI_NAME); I get this exception:
    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
    I put the jndi.properties file both into the client app and the bean project, near the .java files.
    here is the jndi.properties file:
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=http://localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    I'm really confused...
    thanks..

    xyzt wrote:
    I put the jndi.properties file both into the client app and the bean project, near the .java files.
    here is the jndi.properties file:
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.provider.url=http://localhost:1099
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    I think that goes in
    ${JBOSS_HOME}/server/default/deploy/jms/jms-ds.xml

  • Problem with the JNDI properties while executing a client test

    Hello Everybody,
    I'm trying to learn Jdeveloper, and I have followed the tutoriel " Learn Oracle Fronn Oracle" Volum 2, so i am trying to create a simple oriented bean message with EJB 3.0, and a client test to deliver a message, and the problem is that i can't display my message in the Embedded OC4J WINDOW.
    This is the errors displayed:
    Line:-----
    D:\jdevstudio10132\jdk\bin\javaw.exe -client -classpath D:\jdevstudio10132\EJB30MDB\SimpleMDB\classes;D:\jdevstudio10132\j2ee\home\lib\ejb30.jar;D:\jdevstudio10132\j2ee\home\lib\activation.jar;D:\jdevstudio10132\j2ee\home\lib\ejb.jar;D:\jdevstudio10132\j2ee\home\lib\jms.jar;D:\jdevstudio10132\j2ee\home\lib\jta.jar;D:\jdevstudio10132\j2ee\home\lib\mail.jar;D:\jdevstudio10132\j2ee\home\lib\servlet.jar;D:\jdevstudio10132\rdbms\jlib\aqapi.jar;D:\jdevstudio10132\toplink\jlib\toplink-essentials.jar;D:\jdevstudio10132\j2ee\home\oc4j.jar;D:\jdevstudio10132\j2ee\home\oc4jclient.jar;D:\jdevstudio10132\j2ee\home\lib\javax77.jar -Dhttp.proxyHost=10.0.0.99 -Dhttp.proxyPort=8080 -Dhttp.nonProxyHosts=localhost|127.0.0.1|doi-sonia -Dhttps.proxyHost=10.0.0.99 -Dhttps.proxyPort=8080 -Dhttps.nonProxyHosts=localhost|127.0.0.1|doi-sonia oracle.mdb.jmsclient.TestJMSClient
    Looking up TCF
    javax.naming.CommunicationException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]
         at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:292)
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
         at com.evermind.naming.FilterContext.lookup(FilterContext.java:126)
         at com.evermind.server.ApplicationClientContext.lookup(ApplicationClientContext.java:63)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at oracle.mdb.jmsclient.TestJMSClient.main(TestJMSClient.java:20)
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:507)
         at java.net.Socket.connect(Socket.java:457)
         at java.net.Socket.<init>(Socket.java:365)
         at java.net.Socket.<init>(Socket.java:207)
         at com.evermind.server.rmi.RMIClientConnection.createSocket(RMIClientConnection.java:682)
         at oracle.oc4j.rmi.ClientSocketRmiTransport.createNetworkConnection(ClientSocketRmiTransport.java:58)
         at oracle.oc4j.rmi.ClientRmiTransport.connectToServer(ClientRmiTransport.java:78)
         at oracle.oc4j.rmi.ClientSocketRmiTransport.connectToServer(ClientSocketRmiTransport.java:68)
         at com.evermind.server.rmi.RMIClientConnection.connect(RMIClientConnection.java:646)
         at com.evermind.server.rmi.RMIClientConnection.sendLookupRequest(RMIClientConnection.java:190)
         at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:174)
         at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:283)
         ... 5 more
    Process exited with exit code 0.
    Line:-----
    and and there is the TestJMSClient code:
    Line:-----
    package oracle.mdb.jmsclient;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.Message;
    import javax.jms.MessageProducer;
    import javax.jms.Session;
    import javax.jms.Topic;
    import javax.naming.InitialContext;
    public class TestJMSClient {
    public static void main(String[] args) {
    try {
    System.out.println("Looking up TCF");
    ConnectionFactory connectionFactory =
    (ConnectionFactory) new InitialContext()
    .lookup("jms/TopicConnectionFactory");
    Connection connection = connectionFactory.createConnection();
    connection.start();
    System.out.println("Starting Topic Session");
    Session topicSession = connection.createSession(false,
    Session.AUTO_ACKNOWLEDGE);
    Destination topic = (Destination)new InitialContext().lookup("jms/demoTopic");
    MessageProducer publisher = topicSession.createProducer(topic);
    Message message = topicSession.createMessage();
    message.setJMSType("theMessage");
    message.setLongProperty("time", System.currentTimeMillis());
    message.setStringProperty("subject", "Test EJB 3.0 MDB");
    message.setStringProperty("message",
    "Test message Send to first EJB 3.0 MDB");
    publisher.send(message);
    System.out
    .println("Message Sent to JMS Topic, Check Server Console to See whether MDB got activated!");
    publisher.close();
    topicSession.close();
    connection.close();
    }catch (Throwable ex) {
    ex.printStackTrace();
    Line:-----
    I am not sure if the JNDI properties should have a correct configuration to make this application work:
    Line:-----
    java.naming.factory.initial=oracle.j2ee.naming.ApplicationClientInitialContextFactory
    java.naming.provider.url=ormi://localhost:23891/current-workspace-app
    java.naming.security.principal=oc4jconn
    java.naming.security.credentials=welcome
    Line:-----
    Above, it's the code given by the tutoriel, i change welcome by my pass word, but the problem still existing.
    Any idea or help would be greatful
    Thanks

    I use Oracle Jdeveloper 10.1.3.2.0 , Oracle 10g(10.2) Express Edition and PL/SQL Developer V: 7.1.0.13337, XP as OS .
    this is my netstat-a cmd, i expect you can answer, if you want any information about my system, ask me and i will answer you, thanks a lot:
    Connexions actives
    Proto Adresse locale Adresse distante Etat
    TCP est-tatia:epmap est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:microsoft-ds est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1053 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1110 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1521 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:8888 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:9127 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:19780 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:23791 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:23943 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:netbios-ssn est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1056 est-tatia.ABL.local:1521 ESTABLISHED
    TCP est-tatia:1059 10.0.0.101:13000 ESTABLISHED
    TCP est-tatia:1387 10.0.0.101:epmap TIME_WAIT
    TCP est-tatia:1388 10.0.0.101:1026 TIME_WAIT
    TCP est-tatia:1390 10.0.0.101:epmap TIME_WAIT
    TCP est-tatia:1391 10.0.0.101:1026 TIME_WAIT
    TCP est-tatia:1521 est-tatia.ABL.local:1056 ESTABLISHED
    TCP est-tatia:1038 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1044 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:1132 localhost:1521 ESTABLISHED
    TCP est-tatia:1137 localhost:1138 ESTABLISHED
    TCP est-tatia:1138 localhost:1137 ESTABLISHED
    TCP est-tatia:1139 localhost:1140 ESTABLISHED
    TCP est-tatia:1140 localhost:1139 ESTABLISHED
    TCP est-tatia:1385 localhost:1386 ESTABLISHED
    TCP est-tatia:1386 localhost:1385 ESTABLISHED
    TCP est-tatia:1389 localhost:23791 ESTABLISHED
    TCP est-tatia:1521 localhost:1132 ESTABLISHED
    TCP est-tatia:8080 est-tatia.ABL.local:0 LISTENING
    TCP est-tatia:23791 localhost:1389 ESTABLISHED
    TCP est-tatia:30523 est-tatia.ABL.local:0 LISTENING
    UDP est-tatia:microsoft-ds *:*
    UDP est-tatia:isakmp *:*
    UDP est-tatia:1025 *:*
    UDP est-tatia:1026 *:*
    UDP est-tatia:1151 *:*
    UDP est-tatia:4500 *:*
    UDP est-tatia:15000 *:*
    UDP est-tatia:15001 *:*
    UDP est-tatia:ntp *:*
    UDP est-tatia:netbios-ns *:*
    UDP est-tatia:netbios-dgm *:*
    UDP est-tatia:1900 *:*
    UDP est-tatia:ntp *:*
    UDP est-tatia:1027 *:*
    UDP est-tatia:1048 *:*
    UDP est-tatia:1287 *:*
    UDP est-tatia:1289 *:*
    UDP est-tatia:1900 *:*
    **************************************************************************

  • Application specific key-value pairs in jndi.properties

    Hello,
    Can I specify my application specific key-value pair in jndi.properties?
    I tried something like this
    java.naming.factory.initial=.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001
    myVar=myVal
    When i tried looking up "myVar" from my client program, I got an error.
    The other parameters like weblogic.jndi.WLInitialContextFactory are picked up.
    Anyhelp will be appreciated
    Vasim

    We have a similar problem.
    We would like to configure our PROVIDER_URL for a specific web application - not
    for the entire server. Since the URL should be different in development, test
    and production environments, we would prefer to just set it in the deployment
    descriptor. And we have a lot of code that just uses
    ctx = new InitialContext();
    when looking up EJBs, queues etc.
    Actually, to take the problem one step further, it should be expected that later
    we will have EJB's deployed on different machines/clusters - so we will actually
    need specific urls for each EJB.
    Is there a good way to do this? Or will we have to custom-develop our own jndi
    configuration standard using application parameters to set which JNDI provider
    each EJB should be looked up with?
    Alternativaely, can we "import" the JNDI trees of the app server in the JNDI tree
    of the web servers?
    So, how should we go about this?
    Robert Patrick <[email protected]> wrote:
    Vasim wrote:
    Hi Robert,
    You are right. But The object "myVar" which I am trying to look upis not in
    the JNDI tree nor am I interesed in binding it . But my requirementis that
    I have one application specific variable which I am trying to lookup and I
    dont want to have a separare config file for this..and hence the question..So, put the properties you want in the jndi.properties file and load
    the properties
    file from your code by doing something like this:
    Properties props = new Properties();
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if (cl == null)
    cl = System.getSystemClassLoader();
    InputStream is = cl.getResourceAsStream("jndi.properties");
    props.load(is);
    Personally, I would not use this file and would create an application-specific
    file
    or, as Daniel suggested, define your properties as a System property
    and use
    System.getProperty("myVar").
    btw, is jndi.properties only for those objects which are bound to jnditree?
    jndi.properties is only used for creating the JNDI InitialContext. The
    whole idea
    of this file is that in remote client code (without the jndi.properties
    file), you
    need to do something like this to tell the JNDI classes how to connect
    to the JNDI
    provider:
    Properties props = new Properties();
    props.put(Context.PROVIDER_URL, "t3://myservername:7001");
    props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    InitialContext ctx = new InitialContext(props);
    but inside the server, you only need to do this because the server is
    the provider
    and already knows how to connect to itself:
    InitialContext ctx = new InitialContext();
    Therefore, the jndi.properties file allows you to externalize this property-setting
    code that sets up the properties to be passed to the InitialContext constructor
    so
    that the remote client code can now look exactly like the code inside
    the server.
    The InitialContext constructor will look for this jndi.properties file
    in your
    classpath and load it to get the necessary configuration information
    to determine
    how to connect to the JNDI provider.
    Hope this helps,
    Robert

  • External JNDI Client, jndi.properties/connection

    How can I lookup up a object
    jms/ConnectionFactory, which I've confirmed is in this namespace with a external java program client.
    I have the Client jars in the class path. It connects, tries to lookup jms/ConnectionFactory.
    But I get
    javax.naming.NameNotFoundException. Root exception is
    org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
         at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)
         at org.omg.CosNaming._NamingContextExtStub.resolve(_NamingContextExtStub.java:406)
         at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:440)
         at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:492)
         at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:470)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
    jndi.properties are:
    java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
    java.naming.provider.url=iiop://localhost:3700
    java.naming.factory.url.pkgs=com.sun.enterprise.naming
    If I connect from a web-app, I can lookup the object via java:comp/env/jms/ConnectionFactory

    one way is to not use the java:comp/env context and use the <jndi-name> listed in
    a sun-[ejb/web].jar.
    example of ejb lookup from rich standalone client.
    Properties env = new Properties();
    //Sun App server 7 specific
         env.put("java.naming.factory.initial",
              "com.sun.jndi.cosnaming.CNCtxFactory");
         env.put("java.naming.provider.url", "iiop://localhost:3700");
    System.out.println("ENV stuff done");
         Context initial = new InitialContext(env);
    System.out.println("new initial env done");
         Object objref = initial.lookup("ConfigManager"); <---- this is the actual
    jndi name in sun-ejb-jar.xml.
    <ejb>
    <ejb-name>ConfigManager</ejb-name>
    <jndi-name>ConfigManager</jndi-name>
    a datasource resource would be
    <resource-ref>
    <res-ref-name>jdbc/OracleDS</res-ref-name>
         <jndi-name>jdbc/OracleDS</jndi-name>
    so Object objref = initial.lookup("jdbc/OracleDS"); would work for a datasource.

  • Using jndi.properties with weblogic 6.1

    Apologies if this is a basic question - I am new to Weblogic.
    I have successfully got a test EJB working with Weblogic 6.1 using a properties object to set up my JNDI InitialContext.
    In the weblogic examples I've downloaded it says you can also use a jndi.properties file to do this. I have set up a jndi.properties file, which is in the classpath for my class calling the EJB. But when I do my jndi .lookup("ejbname") I get the error:
    javax.naming.CommunicationException: Can't find SerialContextProvider
    The weblogic documentation at:
    http://e-docs.bea.com/wls/docs61///rmi_iiop/API_rmi_iiop.html
    refers to using jndi.properties and says to look at:
    http://edocs.bea.com/wls/docs61/jndi/jndi.html
    But at this page there is no mention of the jndi.properties method.
    I'd be grateful for any suggestions - in particular whether it is possible to use this method of configuring the JNDI setup.
    I'm running wlserver6.1 on a Windows 2000 PC, using JDK 1.3.1
    My jndi.properties file looks as follows:
    java.naming.property.names=java.naming.factory.initial,java.naming.provider.url
    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001

    It is not WebLogic-specific. See
    http://java.sun.com/j2se/1.3/docs/api/javax/naming/InitialContext.html
    Alison Tunley <[email protected]> wrote:
    Apologies if this is a basic question - I am new to Weblogic.
    I have successfully got a test EJB working with Weblogic 6.1 using a properties object to set up my JNDI InitialContext.
    In the weblogic examples I've downloaded it says you can also use a jndi.properties file to do this. I have set up a jndi.properties file, which is in the classpath for my class calling the EJB. But when I do my jndi .lookup("ejbname") I get the error:
    javax.naming.CommunicationException: Can't find SerialContextProvider
    The weblogic documentation at:
    http://e-docs.bea.com/wls/docs61///rmi_iiop/API_rmi_iiop.html
    refers to using jndi.properties and says to look at:
    http://edocs.bea.com/wls/docs61/jndi/jndi.html
    But at this page there is no mention of the jndi.properties method.
    I'd be grateful for any suggestions - in particular whether it is possible to use this method of configuring the JNDI setup.
    I'm running wlserver6.1 on a Windows 2000 PC, using JDK 1.3.1
    My jndi.properties file looks as follows:
    java.naming.property.names=java.naming.factory.initial,java.naming.provider.url
    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001--
    Dimitri

  • Where to put jndi.properties in Web application to lookup remote EJB?

    Hi All,
    I want to use EJB deployed in an OC4J from web application deployed in another OC4J.
    I've try to put jndi.properties file into WEB-INF/classes; package it into a jarfile and put into WEB-INF/lib, ... In all case, it doesn't work.
    If I hard-coding the env properties as following, it works.
    env.put( Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory" );
    env.put( Context.SECURITY_PRINCIPAL, "oc4jadmin" );
    env.put( Context.SECURITY_CREDENTIALS, "welcome1");
    env.put(Context.PROVIDER_URL, "opmn:ormi://fmtresearch:6005:home/TEST");
    But if I put those env properties in jndi.properties file, it doesn't work.
    java.naming.factory.initial=oracle.j2ee.rmi.RMIInitialContextFactory
    java.naming.security.principal=oc4jadmin
    java.naming.security.credentials=welcome1
    java.naming.provider.url=opmn:ormi://fmtresearch:6005:home/TEST
    Note that, the jndi.properties work if it is used in client application.
    Please help me! Thanks.

    This may not help you directly. However, did you try printing the environment properties in the InitialContext you created.
    Another thing.
    You can use this function after creating the initial context to see the JNDI tree and see if it contains anything.
    Thank you.
    Function To list the JNDI Context name-object bindings
    private void listContext2 (Context ctx, int ind, String name, String spaceIndent) {
    String indent = spaceIndent + "[" + Integer.toString (ind) + "]" ;
    try {
    System.out.println (indent + "{" + name + "}");
    NamingEnumeration justList = ctx.list(name);
    while (justList.hasMore()) {
    NameClassPair listItem = (NameClassPair) justList.next();
    String className = listItem.getClassName();
    String subName = listItem.getName();
    boolean isRelative = listItem.isRelative();
    String relativeName = ("".equals(name) ? new String(subName) : new String (name + "/" + subName));
    listContext2 (ctx, (ind+1), relativeName, (" " + spaceIndent) );
    catch (Exception exc) {
    System.out.println ("Exception Occured at listContext2");
    Hope it helps not deviates. Good luck

  • JNDI params for (default) J2EE naming service.

    Dear All,
    I am trying to get a client program to access a session bean using JNDI. Could anyone tell me how the naming context should be set up (i.e. what -D command line params to use).
    Assuming the server Sun's J2EE and beans are deployed using deploy tool;
    What parameters would be required to do a lookup on the naming service?
    i.e.
    java.naming.factory.initial=???
    java.naming.provider=???
    any others?
    The reason for this is so that EJB clients can be installed WITHOUT having to also install J2SDKEE too.
    In principle it should be possible to do the lookup using only only javax.naming and javax.rmi. (Which are in the standard SDK).
    Can anyone help???
    JNDI Code...
    /* What naming params will make this lookup */
    /* on an EJB running within J2EE */
    /* work?? */
    Context context = new InitialContext();
    Object obj = context.lookup ("crs472/SimpleConverter");
    // get a reference to the home interface
    CurrencyConverterHome converterHome =
    (CurrencyConverterHome)PortableRemoteObject.narrow(obj,
    CurrencyConverterHome.class);
    // create an instance of the currency converter EJB
    converter = converterHome.create();
    System.out.println("Got the home interface OK.");
    // Start calling methods...
    Regards,
    Jeremy Townson

    hi
    u have to pass a properties object or a hashtable while creating a IntialContext object
    this properties obj or hashtable should be having values for these keys
    javax.naming.Context.INITIAL_CONTEXT_FACTORY -class name provided by the naming service")
    for websphere its - com.ibm.ejs.ns.jndi.CNInitialContextFactory
    Similarly for weblogic , Sun J2EE
    the other key will u have to provide is the
    javax.naming.Context.PROVIDER_URL - ip address along with the port on whcih the naming service is listening for the request
    then u passs this properties obj or the hashtable to the
    Context context = new InitialContext(props/hash);
    regards

  • Application specific key-value pair in jndi.properties

    Hello,
    Can I specify my application specific key-value pair in jndi.properties?
    I tried something like this
    java.naming.factory.initial=.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001
    myVar=myVal
    When i tried looking up "myVar" from my client program, I got an error.
    The other parameters like weblogic.jndi.WLInitialContextFactory are picked up.
    Anyhelp will be appreciated
    Vasim

    Hello,
    Can I specify my application specific key-value pair in jndi.properties?
    I tried something like this
    java.naming.factory.initial=.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001
    myVar=myVal
    When i tried looking up "myVar" from my client program, I got an error.
    The other parameters like weblogic.jndi.WLInitialContextFactory are picked up.
    Anyhelp will be appreciated
    Vasim

  • Unable to access  Remote EJB with jndi.properties in classpath

    Hi
    I'm trying to use remote interfaces with my adf web layer.
    Created remote datacontrol for my model part and my model EAR is deployed in another Oracle App Server instance(S1).
    My web layer is deployed in another Oracle App Server(S2). My page def uses the remote interfaces.
    Following are the files which are needed to have ejb ref entry.
    ---- orion-web.xml ----
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <orion-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-web-10_0.xsd"
    schema-major-version="10" schema-minor-version="0"
    servlet-webdir="/servlet/" >
    <ejb-ref-mapping name="MySessionEJB" location="MySessionEJB"
    remote-server-ref="true"
    jndi-properties-file="jndi.properties"></ejb-ref-mapping>
    </orion-web-app>
    --- web.xml ---
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
    <description>Empty web.xml file for Web Application</description>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    </context-param>
    <context-param>
    <param-name>oracle.adf.view.faces.USE_APPLICATION_VIEW_CACHE</param-name>
    <param-value>true</param-value>
    </context-param>
    <context-param>
    <param-name>CpxFileName</param-name>
    <param-value>com.home.view.DataBindings</param-value>
    </context-param>
    <filter>
    <filter-name>PCF</filter-name>
    <filter-class>oracle.webcache.adf.filter.FacesPageCachingFilter</filter-class>
    </filter>
    <filter>
    <filter-name>adfBindings</filter-name>
    <filter-class>oracle.adf.model.servlet.ADFBindingFilter</filter-class>
    </filter>
    <filter>
    <filter-name>adfFaces</filter-name>
    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>PCF</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfBindings</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>adfFaces</filter-name>
    <url-pattern>*.jspx</url-pattern>
    </filter-mapping>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>AFCStatsServlet</servlet-name>
    <servlet-class>oracle.webcache.adf.servlet.AFCStatsServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>resources</servlet-name>
    <servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>1</session-timeout>
    </session-config>
    <mime-mapping>
    <extension>html</extension>
    <mime-type>text/html</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>txt</extension>
    <mime-type>text/plain</mime-type>
    </mime-mapping>
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    <jsp-config/>
    <ejb-ref>
    <ejb-ref-name>MySessionEJB</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>com.home.model.MySessionEJBRemote</remote>
    <ejb-link>MySessionEJB</ejb-link>
    </ejb-ref>
    </web-app>
    and this jndi.properties file in placed in the WEB-INF/classes folder.
    java.naming.factory.initial=oracle.j2ee.rmi.RMIInitialContextFactory
    java.naming.security.principal=oc4jadmin
    java.naming.security.credentials=welcome123
    java.naming.provider.url=opmn:ormi://S1:6003:Test_Instance/test-ejb
    The same web application if I run it in Jdeveloper its able to open the welcome.jspx which calls the remote EJB method on load. But when I deploy it Oracle Server 10.1.3.1.0 the error "500 Internal Server Error" shows up and in log file following exception can be found
    avax.faces.el.EvaluationException: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg
    =JBO-29000: Unexpected exception caught: javax.naming.NameNotFoundException, msg=MySessionEJB not found
    Seems like the jndi properties is ignored during the Context creation for lookup.
    Please advice where I'm missing the configuration.

    http://docs.sun.com/source/819-0079/dgjndi.html

  • Jndi.properties need help urgently !!

    Hi,
    I am fairly new to JNDI and LDAP.
    We want to enable customers to be able to log into our software via their pre existing LDAP system.
    For test purpose I am working with Microsoft Active Directory.
    We want to setup the intial context environment with the jndi.properties and obtain all the Organizational units under the root element.
    what is the minimum information I need to have in my jndi.properties to do this ?
    Do I need to be authenticated in order to perform searches on the directory?
    my jndi.properties looks as follows
    java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
    java.naming.provider.url=ldap://workstation:389
    can I Specify url as follows
    java.naming.provider.url=ldap://workstation:389/DC=abc,dc=xkz,dc=com
    and then just go ahead and query to get all the OU's under the root element?
    Please help

    Thank you so much. I managed to obtain all the Organizational Units and the persons under them.
    I do get a PartialResultExcpetion - but i think thats cause Active Directory doesn't manage referrals.
    I am now facing a new issue -
    1.I installed openLDAP win32 version on my Windows XP machine.
    2.Also installed sleepycat software for the BDB.
    3.I used the graphical utility proivded by [email protected]
    I managed to have an Adminstrator by the name cn=Manager and password as secret log into the utility.
    I also created Organizational units and persons under those using the utility.
    When I do ANonymous querying I obtian all the info I want , but when I authenticate any user I run into either InvalidNameException or AuthenticationException.
    What could possible be wrong , through my JNDI class I provide the right credentials.
    Also is there any good tutorials in understanding LDIF's they are too complicated.

  • Imqobjmgr does not recognize the value of java.naming.provider.url property

    On Windows, I am running imqobjmgr 4.3
    when I run imqobjmgr -i list.properties, I am getting the following error
    Error [A3052]: imqobjmgr does not recognize the value of java.naming.provider.url property.
    Why is that?
    classpath
    C:\Sun\SDK\imq\lib\jms.jar;C:\Sun\SDK\imq\lib\imq.jar;C:\Sun\SDK\imq\lib\fsconte
    xt.jar;.
    contents of list.properties
    # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    # Copyright 2000-2008 Sun Microsystems, Inc. All rights reserved.
    # The contents of this file are subject to the terms of either the GNU
    # General Public License Version 2 only ("GPL") or the Common Development
    # and Distribution License ("CDDL") (collectively, the "License"). You may
    # not use this file except in compliance with the License. You can obtain
    # a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
    # or mq/legal/LICENSE.txt. See the License for the specific language
    # governing permissions and limitations under the License.
    # When distributing the software, include this License Header Notice in each
    # file and include the License file at mq/legal/LICENSE.txt. Sun designates
    # this particular file as subject to the "Classpath" exception as provided by
    # Sun in the GPL Version 2 section of the License file that accompanied this
    # code. If applicable, add the following below the License Header, with the
    # fields enclosed by brackets [] replaced by your own identifying information:
    # "Portions Copyrighted [year] [name of copyright owner]"
    # Contributor(s):
    # If you wish your version of this file to be governed by only the CDDL or
    # only the GPL Version 2, indicate your decision by adding "[Contributor]
    # elects to include this software in this distribution under the [CDDL or GPL
    # Version 2] license." If you don't indicate a single choice of license, a
    # recipient has the option to distribute your version of this file under
    # either the CDDL, the GPL Version 2 or to extend the choice of license to
    # its licensees as provided above. However, if you add GPL Version 2 code
    # and therefore, elected the GPL Version 2 license, then the option applies
    # only if the new code is made subject to such option by the copyright holder.
    # @(#)list.properties     1.11 07/02/07
    # This property file will list administered objects
    # Version of command file
    # NOTE: This is not the version of the Sun Java(tm) System Message Queue product
    version=2.0
    cmdtype=list
    # If you want to only list a particular type of administered
    # object, uncomment the following line and specify the type.
    # Acceptable values for the type property are: t, q, tf, and qf,
    # where t = topic, q = queue, tf = topic connection factory, and
    # qf = queue connection factory.
    #obj.type=
    # To use the LDAP service provider implementation from
    # Sun Microsystems, uncomment the following two property lines
    # and set the url property correctly.
    objstore.attrs.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
    objstore.attrs.java.naming.provider.url=ldap://localhost:389/ou=imqobjmgr,o=sun.com
    # To use the File System service provider implementation from
    # Sun Microsystems on Solaris, uncomment the following two
    # property lines and set the url property correctly.
    # *** Note that the url syntax here is platform specific. ***
    #objstore.attrs.java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
    #objstore.attrs.java.naming.provider.url=file:///home/foo/imq_admin_objects
    # To use the File System service provider implementation from
    # Sun Microsystems on Windows, uncomment the following two
    # property lines and set the url property correctly.
    # *** Note that the url syntax here is platform specific. ***
    #objstore.attrs.java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
    #objstore.attrs.java.naming.provider.url=file:///C:/imq_admin_objects
    #objstore.attrs.java.naming.security.authentication=
    #objstore.attrs.java.naming.security.principal=
    #objstore.attrs.java.naming.security.credentials=

    I see you're using Sun Java System Message Queue. There's a forum specific to that product over at [http://forums.sun.com/forum.jspa?forumID=711&start=0|http://forums.sun.com/forum.jspa?forumID=711&start=0] . You could try asking there.
    Nigel

Maybe you are looking for

  • Boot Camp 2.1 Vista 32 no audio after install

    Hi, I recently installed the boot camp 2.1 update on my mbp 2.4, for windows vista. Everything went fine expect for one problem, I have no audio. I can't see anything wrong in device manager, and the icon is still present in the task bar. It's not mu

  • Problem: Use an ODI variable in a Java Procedure

    Hi and thanks in advance, i need to use a project variable in a java procedure i've written. In particular i should read a file (and manage it...), but its name is stored in avariable called #fileName that i refresh each time. writing something like:

  • Axis Disappearing From Animation

    Hello, Without going into wasteful detail, I am building a powerpoint presentation that has four individual bar charts each with three bars of data (envision 4 charts, one bar chart in each corner,  each chart with three bars).  I have set this to an

  • Major Problem with importing application from QA environment to PROD

    We did our first ever full move of our application from our QA server to our PROD server tonight. First, I exported the current PROD application version as a backup. Then I did an export of the application on QA and then imported it into PROD using t

  • How to delete Cancelled lot in QM lot - QA32 T.Code

    Is it possible to delete canccelled lot (Lot with status LTCA)  in QA32 transaction. Pl. giude me. Ganesh