Error:javax.naming.NoInitialContextException: Need to specify the name of the class

Hello

I get the following error
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 have the following
                InitialContext  ctx = new InitialContext();
                String datasource = (DataSource)ctx.lookup(name);
The above is called as a method of my method public static void.

No idea how I can fix this error

If you do not use adf is not sence to use the Houston contoext...
Try

env.put("java.naming.factory.initial", com.sun.jndi.cosnaming.CNCtxFactory);

deletion of the end of the

  env.put(JboContext.DEPLOY_PLATFORM, JboContext.PLATFORM_LOCAL);

Timo

Tags: Java

Similar Questions

  • javax.naming.NoInitialContextException...

    I use ejb3.1 on JBoss 7.0.2. I develop beans with the @Schedule annotation. The codes are:


    = IScheduleTestPort.java

    package com.aaa.ejb3;

    Import javax.ejb.Remote;

    @Remote
    public interface {IScheduleTestPort}
    public String getSignal();
    }


    = ScheduleBean.java

    package com.aaa.ejb3;

    import java.util.Date;
    javax.annotation.PostConstruct import;
    Import javax.ejb.Schedules;
    Import javax.ejb.Schedule;
    Import javax.ejb.Stateless;

    @Stateless
    / public class ScheduleBean implements IScheduleTestPort {}

    private String str;

    @PostConstruct
    public void doPostConstruct() {}
    Str = "time is: «;»»
    }

    @Schedules({)
    @Schedule (= hour dayOfMonth "5" = "09-18", minute = "*", second = "" 10/5, timezone = "America/Los Angeles").
    ({@Schedule ('My' = dayOfMonth, hour = "minute 10-17", = "*", second = "* / 5", timezone = "Asia/Seoul")})
    @Override
    public String getSignal() {}
    TODO self-generating method stub
    Return str + new Date();
    }

    }

    = ScheduleBeanClient.java

    package com.aaa.ejb3;

    import java.util.Properties;
    Import javax.naming.InitialContext;
    to import javax.naming.Context;

    public class ScheduleBeanClient {}

    /**
    @param args
    */
    Public Shared Sub main (String [] args) {}

    TODO self-generating method stub
    try {}
    Properties props = new Properties ();

    props.put ("Java.naming.Factory.initial", "org. JNP.interfaces.NamingContextFactory");
    props.put ("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
    props.put ("java.naming.provider.url", "jnp://localhost:1099"); ")

    Context ctx = new InitialContext (props);
    Annex ScheduleBean = (ScheduleBean) ctx.lookup("java:module/ScheduleBean");

    While (true) {}
    System.out.println (Schedule.getSignal ());
    }
    } catch (Exception e) {}
    Generative TODO catch block
    e.printStackTrace ();
    }

    }

    }


    But client throws exception like below:


    javax.naming.NoInitialContextException: failed to instantiate the class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    to javax.naming.InitialContext. < init > (InitialContext.java:197)
    at com.aaa.ejb3.ScheduleBeanClient.main(ScheduleBeanClient.java:47)

    Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
    in java.net.URLClassLoader$ 1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged (Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    to Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0 (Native Method)
    at java.lang.Class.forName(Class.java:247)
    at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)


    So I delete the setting of InitialContext.


    Public Shared Sub main (String [] args) {}

    TODO self-generating method stub
    try {}

    Context ctx = new world;
    Annex ScheduleBean = (ScheduleBean) ctx.lookup("java:module/ScheduleBean");


    While (true) {}
    System.out.println (Schedule.getSignal ());
    }
    } catch (Exception e) {}
    Generative TODO catch block
    e.printStackTrace ();
    }

    ...


    This survey the following exception codes.


    javax.naming.NoInitialContextException: need to specify the class name in the environment or property of the system, as a cmdlet parameter or in a file of application resources: java.naming.factory.initial

    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at com.aaa.ejb3.ScheduleBeanClient.main(ScheduleBeanClient.java:49)

    I have no idea what's wrong with my codes. I need your help!

    Thanks in advance.

    But client throws exception like below:

    javax.naming.NoInitialContextException: failed to instantiate the class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

    If you add this category to your CLASSPATH.

    So I remove the InitialContext setting

    If you did exactly the wrong thing.

  • I can't edit .htaccess (I need to specify the browser cache)

    I try to optimize my site created in Adobe Muse.

    Google Page speed trends tells me that I should "specify the cache of the browser.

    When I go on my server hosting (Plesk - GoDaddy) to edit the .htaccess, I get only this message in the code:

    # Begin Muse generated redirects

    # End generated Muse redirects

    How then can I modify the .htaccess file?

    THNX

    Hi merinzaa,

    Beginning/end comments are added by Muse. The rest of the .htaccess file contains everything that you put and the Muse leaves unchanged. your look like a problem with access to the .htaccess file.

    Contact your Web host regarding the appropriate access.

    Best regards

    Ankush;

  • Need help with the classes of structure and folders!

    Hello all :)
    I've been programming some time in Actionscript 3 now. But most of the time I did not so much major projects. So I just had 1 folder with the Fla and class and other classes for different objects. But yesterday, I discovered that I need some more when structuring projects is growing. So what I would like is to have the main file with fla and a file in this folder with the classes or something. But I can't understand it. Searched around the web and Yes tried many things. So now, I have discovered that I need help to solve this problem :)!
    Hope someon can help me with this one, it should be pretty easy, but I understand it now.

    Thanks to !

    You have assigned the MainAs as the file MainFLA.fla document class?

    You have an object in the library that is linked to the class 'Classes.Animal '?

    I would like to declare the variable of animal1 where you have one, but I would not instantiate until, within the service of MainAs.

    SerializableAttribute public class extends MovieClip {} MainAs

    public var animal1:Animal;

    public void MainAs() {}

    the constructor code

    animal1 = new Animal();

    addChild (animal1);

    }

    Is the code that show you for the placement of the Animal object a typo or do you really have it assign the property x twice?

  • Prevent the child class dependency when the conditional use disable to specify the class in the development environment

    Hello

    I develop an application that I want to run on the normal systems and in real time using LabVIEW Proffesional Development System 2012 SP1

    To control how the application interacts with the user, I created a class that defines the type of user interface behavior that should allow me to have nice dialog boxes when the system is running on a machine windows and no dialog box (or any other friendly code in non-real time) if they sail on a real-time target.

    The parent class is the code that suits the actual time and the class of the child is the one with dialog boxes.

    To control the class of which it is responsible, I have a structure conditional disable. It works fine when the application is built in an executable or executable file in real time, but the problem arises when I want to use the code during development on the target in real time.

    I think that with the application under a target in real time (RT PXI), the proper case of the conditional - disable is enabled for the parent class is used, but the child classes are also listed under dependencies - I pressume it's because they exist on the block diagram in the case of persons disabled conditional turn off the diagram.

    This means that I can't deploy the code on the target in real time as it is unhappy with the class of the child code - even if it will never run.

    To save the poster my real project, I created an example with a Parent and child class and a flag to disable conditional 'class' to illustrate the problem.

    If you run Test.vi, you will see that the child class always gets locked (i.e. is addictive) while running even if it is not called.

    So - basically my question is: is what I can do about it or will I enough to disable it with conditionals and simply put the constant to correct class on the block diagram in the tests?

    Thanks in advance

    John.

    I feel your pain.  I came across something similar some time back.

    Apparently official NOR position is that you have to put a conditional structure of Disable IN EVERY ONE OF YOUR CLASS live.  In the Windows screws, you simply have a case of empty disable conditional with the windows code in another case and vice versa on the RT.

    I also much prefer the method you describe...

  • Several Windows error messages that I need to fix, the list is in position.

    I wrote error messages that appear when I restart my computer. The list is below. How can I fix them?

    sink to receive asynchronous callbacks for WMI client applications
    Microsoft Sync Center
    Task Scheduler Engine
    the collection file is not valid or is corrupted. new empty collections file was created
    ezdockconfig.xml Init failed
    media center media status aggregator has stopped working
    Control Panel HD audio has stopped working
    persistence module stopped
    module igfxsrvc has stopped working
    Hkcmd module has stopped working
    igfxtray module has stopped working

    Hello

    1. Since when are you facing this problem?

    Method 1: Run the fixit available in the article below

    When I try to use Windows Media Player 11, the program does not start, or some UI elements are blank
    http://support.Microsoft.com/kb/925704

    Method 2: If a Protection of resources Windows (WRP) file is missing or is damaged, Windows may not behave as expected. Auditor of file system (CFS) scan to fix all of the corrupted system files. To do this, follow the steps mentioned in the link below:

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

     

    Method 3:  Select the boot and then check if the problem persists

    Follow step 1 in the link below,
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem.

    Continue with the remaining steps to pin-point on the third party service.

    After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.

  • Adobe Application Manager error - administrator privileges are needed to continue the installation

    Adobe Application Manager error - administrator privileges are required to continue installation

    I'm already logged as long as administrator - there isn't a single account

    Windows 7.0

    any ideas on how to solve the problem?

    I just manually downloaded the MAO, installed and it worked, thank you

  • Having trouble installing Photoshop elements 14. The error that says I need to download the 64-bit version of photoshop. Where can I get this?

    Where can I get the 64-bit version of photoshop?

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

  • Need to call the PL/SQL Package in the group dynamics of approval class that implements IDynamicApprovalGroup

    Hi all

    This is regarding the approval of invoice AP I need in my project where the user selects the users/people approval when creating the invoice based on logic. There may be any number of users who could be part of the approval group.

    Approval users information is stored in a table with a single Bill.

    When the user initiates invoice approval, approval of the Bill should go to all the people/users selected in the invoice.

    I created the dynamic of approval group which is the result of a java class. This java class implements IDynamicApprovalGroup. (what is the oracle Developer Guide).

    I called PL/SQL to java class package to get all the details of users of custom for the current invoice table.

    I used the DriverManager.getConnection method by hard coding (JDBC URL, Username, Pwd) connection details that works perfectly fine.

    But I don't want to hard-code the connection details because it will change in bodies SIT/UAT/PROD.

    Please ask you to guide me if there is no solution for the information of connection without hard coding it.

    Following code used to get the connection details

    try {}

    Class.forName ("oracle.jdbc.driver.OracleDriver");

    System.out.println ("= class loaded");

    }

    catch (ClassNotFoundException ex) {}

    System.out.println ("= class loading error");

    ex.printStackTrace ();

    }

    Fitting out = null;

    CallableStatement cstmt = null;

    Try

    {

    connection = DriverManager.getConnection ("jdbc:oracle:thin:@xxhostname:1521/SID", "FUSION", "*");

    Connection = GetConnection ();

    System.out.println ("= connection =" + connection);

    prepare the call

    cstmt = connection.prepareCall ("{call XX_AP_INV_DYN_APPROVAL_PKG. {GET_GROUP_PARTICIPANTS (?,?)} ») ;

    cstmt.setString (1, '12345');   ID on invoice

    Exit of the register

    cstmt.registerOutParameter (2, java.sql.Types.VARCHAR);

    Call the stored procedure

    cstmt. Execute();

    System.out.println ("= procedure being executed");

    approvalGroupMembers = cstmt.getString (2).split("#");

    System.out.println ("= output:" + cstmt.getString (2));

    }

    catch (Exception ex) {}

    ex.printStackTrace ();

    }

    Finally

    {

    Try

    {

    If (cstmt! = null)

    close the callable statement

    {

    cstmt. Close();

    cstmt = null;

    }

    System.out.println ("= stmt closed");

    }

    catch (SQLException ex)

    {

    System.out.println ("= stmt close err");

    ex.printStackTrace ();

    }

    Try

    {

    If (connection! = null)

    close the connection

    {

    Connection.Close;

    connection = null;

    }

    System.out.println ("= closed conn");

    }

    catch (SQLException ex)

    {

    System.out.println ("= Close conn err");

    ex.printStackTrace ();

    }

    }

    Thank you

    Dipak.

    HI Dembélé - you should be able to call the provider database from the java class. Documentation is here. However, you need to specify the name of the data provider that is the same in all environments. Do you know what it is? If it's not I'll take a look and get back to you.

    __

    Peter Maurer

    Relationship with the developers of Applications in fusion

    https://blogs.Oracle.com/fadevrel/

  • Specify the samples only to change?

    No doubt a variation of this has been requested before, so my apologies, but I'm unable to find anything.

    I use a PCIe-6537 and try to generate a long sequence (say 2 seconds) using C. Is it possible to only specify some samples? Or do I need to specify the value each time the sample?

    For example, suppose I want 32 track 1 followed by HIGH microsecond of a second BASS, repeated twice. I wish I could say:

    Example 0: 2 ^ 32-1

    Example 1:0

    Sample of 1000000:2 ^ 32-1

    Sample 1000001:0

    However it seems I have to specify the actual value at each point in time. Of course, it takes much more time and memory to write but I do not see otherwise. Is there a way?

    I hope that the question is clear. Thank you.

    I can't find a place to change the theme or mark it as solved

    My real scenario was a bit more complicated, but I found away around him. Each writing sample explicitly should no longer be a problem.

    I hope that is correct on the occasion of my own post as a 'solution '.

  • HP Office Jet 4500 do not print due to error on paper, there is paper in the printer.

    I get an error that says I need to add the document to the printer.  The printer is full of paper.  I deleted the printer and re-installed, I closed the printer down several times, I rebooted several times.  I can put a paper on pc and press copy and it will copy in order to not mistake here for an out of paper issue. When I try to print anything I'm getting an error of paper output.  Help, please

    Hello NColyar,

    Welcome to the HP Forums!

    I understand that you receive a message indicating "on paper" using the Officejet 4500. I will do my best to help you! Please make sure that the printer is connected to a live wall, not a surge protector. I just want to check if that makes a difference.

    Then follow this document HP all-in-one is not get or paper feed. If you still receive the error message, please contact HP technical support for further assistance. Click here to read: worldwide Contact HP.

    Good luck.

  • Error (10,47): EntryFlowPageCO not found in the oracle.apps.ap.oie.entry class.

    Hi all

    I extended a CO named IndusFinalReviewPageCOXX and I got the following error.

    Error (10,47): EntryFlowPageCO not found in the class oracle.apps.ap.oie.entry.summary.webui.FinalReviewPageCO in the indus.oracle.apps.ap.oie.entry.summary.webui.IndusFinalReviewPageCOXX class.


    I already drag the EntryFlowPageCO class file in the path myclasses\oracle\apps\ap\oie\entry\summary\webui
    and import the file. but the error remains the same... After that, I compile the EntryFlowPageCO class file and found a CO EntryFlowPageCO imports more. I drag the class of this CO also file in the appropriate path... But still the same error.

    Please give me the solution as soon as POSSIBLE.

    Thank you
    Amit Jaitly

    Amit,

    In the standard central, you can check this controller as entryflowpageco is not under myclasses\oracle\apps\ap\oie\entry\summary\webui.

    Its under oracle/apps/ap/goose/entry/webui put the same under this directory structure.

    Kind regards
    GYAN

  • Error 5000: The class 'Particle' must subclass 'flash.display.MovieClip' because it is linked to a symbol in the library of this type.

    Running Flash CS3, I looked at the tutorial from lynda.com on strengthening the systems of particles in ActionScript 3.0 to create a few sparks shooting in an animation.  I'm stuck to what I think is a point really basic, but I can't seem to cross it.  Basically, all I'm doing at this point is to create a class called particle (that I'll learn to do things that the particles to make a little later) bind it to a MovieClip on the stage in my .fla file and use the function to update the particle to move it around the stage in a way defined in the instance (so I can later give properties of different movement to) each as an instance generated the MC).  I know there are easier ways to accomplish my basic task without loading an external module, but this seems to makes it so I have to hurt something very simple, that I can't see so I thought I'd post the code here and see what I'm missing.

    I start with a file called Particle.as in the same folder as my file Test.fla Spark.

    In Particle.as, I have the following code:

    package
    {
    import flash.display. *;

    Particles/public class extends MovieClip
    {
    public xVelocity:Number;
    public yVelocity:Number;

    public void Particle()
    {
    xVelocity = 0;
    yVelocity = 0;
    }

    public void update (): void
    {
    This.x += xVelocity;
    This.y += yVelocity.

    }
    }
    }

    So, I declare that all the particles are built with no movement, but if they are explicitly granted an x or y velocity, they will pass by there a lot when updating the instance function is called in the timeline panel.

    Then in my file Test.fla spark, I have a small shape in a MovieClip called Spark.  In the properties of binding of spark, I chose to export for ActionScript and export in first frame.  The class is called Spark and the Base class is the particle.  For testing purposes, I dropped an instance on the stage and called spark.  Then in the layer actions in the first image (the timeline is just the spark layer and the layer actions, a long frame each with no "stop();" so it should run forever), I have included the following code:

    spark.xVelocity = 5;
    spark.yVelocity = - 1;

    function updateSpark(event:Event):void
    {
    Spark.Update ();
    }

    addEventListener (Event.ENTER_FRAME, updateSpark);

    Is what it seems that this should be on every Flash ENTER_FRAME should call updateSpark, which is a function that handles the event update() for the instance of the spark which is a movieclip instance that has an update event that moves x and y of the position of their relative velocity variables.  It seems simple enough to me, but when I ctrl-enter to test the movie, I get the following compiler 3 errors:

    Particle.As line 1: 5000: the class 'Particle' must subclass 'flash.display.MovieClip' because it is linked to a symbol in the library of this type.

    Particle.As line 7:1071: syntax error: expected a keyword (for example function definition) after the public attribute, not xVelocity.

    Particle.As line 7:1084: Syntax error: expecting rightbrace before the semicolon.

    Since I imported flash.display. * and declares the class public particle so it extends MovieClip I have no idea why I get this error of 5000.  I see this issue come up a lot when searching Google and forums, but none of the resolutions that I could find have suggested an approach that applies to me or solve the problem.

    Any help to fix this would be appreciated.  I enclose a zip of the FLA a files as described above in case there is something in the settings of publication that I messed up inadvertently.  In addition, if you can get this to compile without error, then the problem may be due to my Flash CS3 Pro install which will result in the problem isn't with my code and start looking at me in a different direction.

    Thank you

    Scott

    Yes, 'var '.

  • What is the point of finding info from the class?

    Currently, at school, I learn about how to get information about an object. This has to do with polymorphism. You can rotate all objects in a polymorphic table, unless it's a circle.
    Class c = Class.forName("Circle");
    System.out.println(c.getName());
    System.out.println(c.getSimpleName());
    System.out.println(c.getCanonicalName());
    System.out.println(c.isInterface());
    System.out.println(c.getSuperclass());
    This will give you information about a class. With the help of class class can create a ClassNotFound exception and is generally more difficult to code. Wouldn't be better to just a method of id() with inside information. Using the method proposed by the manual, you need to create a class for each shape reference. What happens if you have a lot of forms, then it is a waste of memory to create all these objects? If you created an id() method in the base class that should be replaced by the subclasses, then simply call a method. Otherwise, you will need to create a class object for another object.

    Isn't it more easy and less complicated then the code above? This will not cause a runtime error.
    System.out.println(circle.id());
    Why use a class better than simply create object and id() method in all classes?

    Sometimes, you want to create a code that loads the classes during execution.

    The compiler does not know about the class. If you need information on the class in a generic way.

    This is not possible with your example because the compiler needs to know your class so that it can compile.

  • Problem steps Recorder error - you have not permissions to system files needed to create the specified output file.

    I am trying to use the PSR as a domain user, but get the following error message when you try to save my record:

    "You don't have permissions of system files needed to create the specified output file.
    If I run the present when logged in as a domain administrator, I can record without problem.  But when logged in as a domain user, I get the error.  I tried "Run as Administrator" as well as "Run as different user", enter the domain administrator credentials, but still get the error.
    Everyone knows about this problem?

    Hello Giblits,

    Because the computer is connected to a domain, it would be better on the TechNet forum. I suggest you post your question on the following link to get the exact resolution.

    http://social.technet.Microsoft.com/forums/en-us/category/w7itpro

Maybe you are looking for

  • Firefox Inspector not to focus on the element by click on inspect.

    The new firefox for developers is out, I downloaded and used as your primary browser.However, I discovered that the Inspector not to focus or show the direct element that I inspected. He just open the inspector window & show the tag of the whole body

  • Fingerprint Sensor Driver for Pavilion DM4-3115TX (Windows 7 Ultimate 64-bit)

    A few days ago, I bought this Pavilion DM4 - 3115TX Beats Edition. (Nr B6U96PA #AR6) With the installed operating system, I'm going to install all drivers. Everything works except the finger print driver. For me, it's hard to find the compatible driv

  • Treo 800w cannot assign OneNote to hardware button

    I just upgraded to a 755 p of a Treo 800w (after owning a 650, 600, Palm Vx and Palm Pilot before that).  For the most part, I was very happy.  Frankly, the only real issues I had have been with Windows Mobile Device Center.  The rest of the transiti

  • How to display the table HP V1900 - 8G switch MAC address

    Hello! Someone probably knows... Is it possible to display the MAC addresses of computers connected to the switch HP V1900 - 8G (ditch the WEB or CLI). All managed switches, I worked with had something like "MAC address Table" or more to display the

  • BG img to fill a nested div container, but skip a parent padding

    HelloIf I have a div container with padding set up so that the text remains in a specific width ESP... and then I have another div to call a background as a class picture.(Kept them as two separate to avoid conflicts with the rules) - how can I get t