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.

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");

  • 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.

  • 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

  • Java.naming.ORB   system property

    Hello,
    In my program, i want to set java.naming.ORB system property to the ORB that is already initialized. Is there any way to do this ??
    Thanks.

    Don't post this again. You already asked it here: http://forum.java.sun.com/thread.jsp?thread=401537&forum=31&message=1751719

  • What does the word Factory mean in "naming factory "

    What does the word Factory mean in "naming factory" in JNDI tech?

    A Factory class is a class that produces an instance of an object. For example, a ParserFactory class will have a method that returns a Parser. Usually this Factory class is looking at something in the environment to decide which object to return. "Factory" is just one of many "Design Patterns" that you will encounter in the programming world. Several (many?) books have been written about design patterns.

  • How to set java.naming.provider.url when multiple oc4j instances in iAS

    Hi Folks,
    I have problems engaging a connection to a deployed application in a 9.0.3 iAS instance. I created 2 oc4j instance within the iAs instance.
    I wonder how to set up the JNDI provider url?!?
    According http://download-west.oracle.com/docs/cd/A97329_01/web.902/a95879/jndi.htm
    the provider url contains of ormi://host:port/application.
    Unfortunatly I get a connection refused Naming Exception.
    What's wrong?
    Where can I look up the
    java.naming.security.principal
    java.naming.security.credentials
    Are they set by default?
    I tried the following scenario:
    java.naming.provider.url=ormi://host/oc4j-instance/application/
    and a user/password from principals.xml in the application/config directory, but don't have any success.
    So please help me ;-).
    Bye & Thx
    Toby

    This is correct as far as aI remember
    1) java.naming.provider.url = t3://server1:port1,server2:port2
    see
    http://download.oracle.com/docs/cd/E13222_01/wls/docs81/jndi/jndi.html -- Using WebLogic JNDI from a Client in a Clustered Environment

  • Java naming Convention

    Hi all,
    I urgently needed your assistance on advice regarding the java naming convention.
    i am in the middle of creating a interface class and a implementation class
    BusinessAccountIF
    and
    BusinessAccount
    However, I been told is very bad ideal to use the word IF in the ending of interface.
    Technical we don’t need to, but I always like my code to be tidy,
    hence using the IF in the end of the interfaces class.
    Please do let me know what your thought??
    Edited by: 846020 on 21-Mar-2011 06:10

    846020 wrote:
    However, I been told is very bad ideal to use the word IF in the ending of interface. I agree. Smacks to me of those annoying chaps that put 'Int' at the end of all integer variables; it's just noise.
    Technical we don’t need to, but I always like my code to be tidy, ...
    Please do let me know what your thought??As others have said: keep your names as descriptive as possible.
    I would expect an interface called 'BusinessAccount' (which seems perfectly sensible to me) to be extended from an interface called 'Account', and have implementing classes that describe a specific type of business account (eg, 'DepositAccount', 'EquityAccount', 'AssetMaintenanceAccount'), possibly via a "skeleton implementation" class, which by convention, is usually called 'AbstractBusinessAccount'.
    Winston

  • Finding intial context factory for java naming connect to DS5

    I'm a newbie to LDAP programming using the JNDI interfaces to connect to my
    DS 5 implementation. I can't seem to find any reference as to where the
    correct factory for the initialDirContext is! I need the factory classname
    for this call:
    env.put(Context.INITIAL_CONTEXT_FACTORY,"factory classname goes here");
    which is neccesary to set the initialDirContext.
    As far as I can tell there is no default context for an LDAP connection that
    would make this easier and I don't know where or if I can find one remotely
    located on my DS5 box.
    Any help would be appreciated,
    -Jake

    I'm a newbie to LDAP programming using the JNDI interfaces to connect to my
    DS 5 implementation. I can't seem to find any reference as to where the
    correct factory for the initialDirContext is! I need the factory classname
    for this call:
    env.put(Context.INITIAL_CONTEXT_FACTORY,"factory classname goes here");
    which is neccesary to set the initialDirContext.
    As far as I can tell there is no default context for an LDAP connection that
    would make this easier and I don't know where or if I can find one remotely
    located on my DS5 box.
    Any help would be appreciated,
    -Jake

  • Creating a Java named query?

    Hi,
    From the application developers manual; is it implied that named queries can be created using the Oracle Toplink API in Java; i.e out of the workbench but I have not been able to find any references to this elsewhere. Does anyone have any information on this? i.e creating the named query in Java code and then adding it to the project deployment.
    In addition, is it possible to have it such that if a named query expects 4 arguments; the Java code is written to check if there are any null values passed in, and if the values are null those columns wlil be removed from the query.

    There are really two types of queries that apply.
    Named queries being those queries defined in Java code at application start up that take a fixed number and types of parameters. These queries are typically added using descriptor after-load methods. In the MW you select the static after-load method where you wish to define your queries. As of TopLink 9.0.4 it is possible to define your named queries with arguments directly in the MW without an after-load method.
    Redirect queries are queries where TopLink invokes your method at runtime to execute the query. This approach allows for your code to selectively build the where clause based upon the arguments passed in.
    Some links into the docs that may be of interest:
    after-load: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10316/dscriptr.htm#1014978
    Using named queries: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10313/queries.htm#1146839
    Redirect queries: http://download-west.oracle.com/docs/cd/B10464_01/web.904/b10313/queries.htm#1141580
    Doug

  • Java SP's - Initial Load Time!

    FYI, We are running Oracle 8.1.7 on HP/UX 11.0 using Java Stored Procedures.
    The Java stored procedures work fine (sub-second performance) after being loaded into memory, but the initial load time can be anywhere from 2 to 3 seconds. When you have 30+ Java stored procedures, the initial startup causes table locking and contention that will cause our app to crash.
    Rewriting these Java SP's in PL/SQL shows that PL/SQL is immune to this initial load time (to a much lesser degree). Besides rewriting my application to read all of the Java SP's into memory before app startup, is there anything I can do on the Oracle server side to improve (or eliminate) load times for Java Stored Procedures?
    Thanks!

    Hi Sonja,
    maybe you can help me:
    I want to map a portal role (     pcd:portal_content/every_user/general/eu_role) to a user. So I use the SAP Provisioning Framework with the Job "SetJavaRole&GroupForUser". But I get following exception:
    putNextEntry failed storingSPML.SAPUSER.3010
    Exception from Add operation:com.sap.idm.ic.ToPassException: No such objectclass defined
    Exception from Modify operation:com.sap.idm.ic.ToPassException: SPML exception: Could not update
    user The given id "$FUNCTION.sap_getSPMLRoles(2371!!NEW_UME!!pcd:portal_content/every_user
    /general/eu_role)"is not a unique id of a role!
    In the "destination" tab of the job I entered the following values:
         SPMLID             SPML.SAPUSER.%MSKEYVALUE%
         assignedroles     $FUNCTION.sap_getSPMLRoles(%MSKEY%!!%$rep.$NAME%!!pcd:portal_content/every_user/general/eu_role)
    I have no idea what's wrong in here...
    Maybe you or someone else can help me...?!

  • Java Applet not Initializing (LMS)

    Hello everyone,
    I have a small problem when trying to access a Java applet screen. When I open the applet, there are two different portions of the screen, a left window and a right window. In the left window, there is a caption at the top that says "LMS Initializing". There is supposed to be a list of hyperlinks that populate in the window, but they never do. It hangs on the LMS.
    What is LMS? Something is blocking it's initialization. I have checked the manage add-ons menu and verified that the Java is plugged into IE, but I cannot seem to figure out the issue.
    I do know of the following issues as well, and I have verified that they are not the problem here:
    *Popup blockers
    *IE security settings under the "Security" tab in Internet Options
    *Secure Socket Layers
    If anyone else can give me a boost here, I would appreciate it. Thanks!

    did you restart the forms server with the command.
    $ADMIN_SCRIPTS_HOME/adopmnctl.sh stopall
    $ADMIN_SCRIPTS_HOME/adopmnctl.sh startall

  • Java Applet not initiating

    I'm new to Java and have been going through the SAMS "Teach Yourself Java 2" and have a problem will Applets. I am using the latest download of Java2SE (J2sdk1.4.2_09) and NetBeans IDE.
    Creating Java programs works fine but when I do the exercise for Applets called "Palindrome" project, it fails. I embed the <APPLET> tag in my HTML a couple different ways laid out in the text but all fails. I doing this without the Internet. Is there something special that I need to do to get this to work with the generated palindrome.class on my hard drive.
    I did make some changes to my computer's Internet settings based on an FAQ I saw on the Sun site - Proxy_Server - localhost. But this did not solve my problem.
    I would appreciate any suggestions on how I might further investigate this - I'm sure I have something set wrong and just need some more test options to identify the problem.
    Your assistance is greatly appreciated.
    Thanks
    Don

    I checked the Browser VM and it shows the same as the one in the Java Plug-in control panel but I continue to get the same error. Can anyone with some Java experience identify the problem from this error code:
    Java(TM) Plug-in: Version 1.4.2
    Using JRE version 1.4.2_09 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings
    Proxy Configuration: Manual Configuration
    Proxy:
    Proxy Overrides:
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    p: reload proxy configuration
    q: hide console
    r: reload policy configuration
    s: dump system properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    load: class Palidrome.class not found.
    java.lang.ClassNotFoundException: Palidrome.class
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:162)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:123)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:566)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:619)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:548)
         at sun.applet.AppletPanel.run(AppletPanel.java:299)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: java.io.FileNotFoundException: A:\Palidrome\class.class (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at java.io.FileInputStream.<init>(FileInputStream.java:66)
         at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:69)
         at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:156)
         at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:274)
         at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:43)
         at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:152)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:149)
         ... 9 more
    Any assistance you can offer will be greatly appreciated.
    Don

  • Is there any class in java named State .and also HTML tag

    while reading a code of Servlet
    I came across a class called State in the code which is added in the Vector
    vector.addElement(new State("instating"));
    I have never heared of this class.
    and also in the same code I came across This 2 tag's of HTML
    out.println("<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">");
    out.println("<a href=\"/lifecycle/servlet/freak\">Reload</a></p>");
    please if any one can explain me this tags as I don't know HTML.

    Thank for Gussing actually there is a method in the application which take String as a parameter.name of the method is createState(String message) .I thik they have written wrong code by adding State ("string")
    in the book .the book is from the WROX press the name of the book is
    Java server programming J2EE edition but so far there was'nt any mistake in the book.
    any what about those HTML tag.

  • Why System.arraycopy function does not follow java naming conventions ?

    System.arraycopy should be
    System.arrayCopy....
    can anyone tell me why is it so ?

    BigDaddyLoveHandles wrote:
    DogsAreBarking wrote:
    System.arraycopy should be
    System.arrayCopy....
    can anyone tell me why is it so ?Because it dates back to the early days of Java, back when rocks were soft. Note also that java.awt.GridBagLayout has several methods that start with capital letters! Shocking!Hmm, I never noticed that. And in version 1.4 they apparently added identical methods which names that start with lower case. Now that's a funky API :-)
    Along the same line, one thing that irks me is that eclipse keeps suggesting
    Color.blackas the first auto-completion choice when I type
    Color.BThe horror!

Maybe you are looking for

  • How to delete/reverse an A/R Invoice

    Hi How can I delete/reverse an A/R Invoice that has been based on an delivery - without changing/adding the items back to the stock (as the credit memo would handle it) - and reopen the delivery note for future invoicing? The invoice has been posted

  • Non-Apple apps don't open after iOS5 upgrade (with fix)

    Hi, I thought I'd add this thread in case it's useful to someone else with the same problem. I had a iPhone 4 on latest 4.3.5 and upgraded via iTunes to iOS5 this morning. None of my non-Apple apps would open, they'd just open and close instantly. So

  • I'm having a hard time retreiving my contacts...

    ...from my SIM card. I know iPhone's don't save contacts to a SIM card, but I am having a really difficult time figuring out Bluetooth. I have a LG Trax phone that I want to transfer the contacts over to my iPhone. Any help, with detail, would be gre

  • How to interface native methods in LINUX???

    As the cc command in Solaris is : cc -G -I/usr/java/include -I/usr/java/include/solaris \filename.c -o libfile.so what will be the similiar command in LINUX system????

  • Import a application In sharepoint 2010

    I Have a exported application in my  c drive  in a folder . I want to import it to a new web application . how can  i achieve this I tried using  management shell  like : import-spweb http: //  path:c:\path name but its throwing an error  like. impor