NullPointerException on execution/ creation of a PreparedStatement

Hi,
I am facing a very weird problem. There is a jar file that is run from the command prompt connecting to SQL Server on the same machine. This program basically does some processing of records within a SQL transaction.
Sometimes the program ends with a NullPointerException at a PreparedStatement for example on the both record and the transaction is rollbacked .
Now if I run the program again for the same data, I may get a nullpointer exception at some other record for example on the 250th record.
Now if you are beginning to feel that there is something wrong with the code then let me tell you this problem ,
If I run the same jar file on another machine pointing to the earlier mentioned SQL Server and for the same data it runs perfectly fine.
That is what is giving the creeps. In both the scenarios only thing changing is the machine on which it is being executed and the java version.
Any Help on the above problem will be highly appreciated
Thanks,
Jyothi

Then you have a race condition.

Similar Messages

  • NullPointerException during InitialContext creation in RJVMFinder (WL 5.1)

    Has anyone seen this NPE when creating an InitialContext? We got this for about
    a day on one of our cluster instances, and then it magically went away (the other
    server in the cluster worked fine).. Solaris, Weblogic 5.1 service pack 10.
    java.lang.NullPointerException
    at weblogic.rjvm.RJVMFinder.equals(RJVMFinder.java:98)
    at java.util.Hashtable.get(Hashtable.java:323)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:190)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:195)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:665)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at javax.naming.InitialContext.init(InitialContext.java:222)
    at javax.naming.InitialContext.<init>(InitialContext.java:198)

    Contact [email protected] and reference CR081579.
    Tom LeRoux wrote:
    Has anyone seen this NPE when creating an InitialContext? We got this for about
    a day on one of our cluster instances, and then it magically went away (the other
    server in the cluster worked fine).. Solaris, Weblogic 5.1 service pack 10.
    java.lang.NullPointerException
    at weblogic.rjvm.RJVMFinder.equals(RJVMFinder.java:98)
    at java.util.Hashtable.get(Hashtable.java:323)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:190)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:195)
    at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
    at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:665)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at javax.naming.InitialContext.init(InitialContext.java:222)
    at javax.naming.InitialContext.<init>(InitialContext.java:198)--
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • NullPointerException inside ProcessService creation

    Hi all,
    I am writing a standalone java app to connect to ALBPM using PAPI and am hitting the following error:
    W:\savaria_1\server_1_0\src>java -Dfuego.je22.initialctx.file=C:\bea\TestApp\Properties\tomcatProperties.jndi -classpath W:\3rdparty\bea-albpm-5.7\lib\fuegoresources.jar;W:\3rdparty\bea-albpm-5.7\lib\fuegoresources_en.jar;. -Djava.ext.dirs=W:\3rdparty\bea-albpm-5.7\lib com.tradebeam.workflow.gateway.WFRequestHandler
    java.lang.NullPointerException
    at java.util.TreeSet.addAll(TreeSet.java:244)
    at fuego.boot.LanguageData.addLocalesByLanguage(LanguageData.java:84)
    at fuego.boot.LanguageData.addRuntimeLocale(LanguageData.java:43)
    at fuego.boot.LanguageData.addSupportedLocale(LanguageData.java:52)
    at fuego.boot.BootData.registerJar(BootData.java:213)
    at fuego.boot.Loader.loadClasspathPlugins(Loader.java:1100)
    at fuego.boot.Loader.initPlugins(Loader.java:557)
    at fuego.boot.Loader.initPlugins(Loader.java:668)
    at fuego.boot.Loader.initPlugins(Loader.java:630)
    at fuego.papi.ProcessService.getFactory(ProcessService.java:657)
    at fuego.papi.ProcessService.create(ProcessService.java:426)
    at com.tradebeam.workflow.gateway.WFRequestHandler.firstTest(WFRequestHandler.java:53)
    at com.tradebeam.workflow.gateway.WFRequestHandler.main(WFRequestHandler.java:101)
    Any idea what have I missed / done wrong? Thanks!
    Regards,
    Matthew

    Hi Mariano,
    Yes, it's my continuation of making my standalone java talk to BPM (I am working on Proof of concept and feasibility to upper management for purchasing decision)This is what I use instead of the ext dir:
    java -Dfuego.je22.initialctx.file=C:\bea\TestApp\Properties\tomcatProperties.jndi -classpath W:\3rdparty\bea-albpm-5.7\lib\fuegopapi-client.jar;W:\3rdparty\bea-albpm-5.7\lib\ejb-2.0.jar;W:\3rdparty\bea-albpm-5.7\lib\jms.jar;W:\3rdparty\bea-albpm-5.7\lib\classes12.jar;. -Djava.ext.dirs=W:\3rdparty\bea-albpm-5.7\lib com.tradebeam.workflow.gateway.WFRequestHandler
    and I still get the same error. Any insight? The error complains about locale so I think I may be missing something.
    Thanks a lot!
    Regards,
    Matthew

  • PreparedStatement in two servlets

    Hello,
    I've got a doubt concerning PreparedStatement with JDBC.
    If I have the same statement in two different servlets, is my SQL compiled just once in the DBMS ?
    So, if I create a new Instance of PreparedStatement that was previously created in another servlet the statement is not created again.
    Is it true?
    Thanks.
    C.

    The performance impact of PreparedStatement varies widely from DBMS to DBMS (and driver implementation to driver implementation).
    At one end, some systems merely implement PreparedStatement on top of Statement; the SQL is treated identically in the database no matter which statement type you use.
    At the other end are DBMS's such as Oracle, that work really hard to optimize PreparedStatement and have several internal layers.
    In Oracle, the compilation step is called a "parse", and there are 3 possibilities when executing a SQL statement using a PreparedStatement:
    no parse
    soft parse
    hard parse
    A hard or soft parse will occur when the execution connection.PrepareStatement is called. The ideal situation for each SQL statement is "parse once execute many".
    In a hard parse, Oracle looks at the SQL, computes a hashcode from the SQL text and looks for an appropriate execution plan in its caches. A cache miss occurs, Oracle prepares the execution plan, saves it in cache keyed by the hashcode, and binds the execution plan to the PreparedStatement (effectively speaking, at least, I'm not sure how the implementation achieves that). It's then ready for parameter binding and execute().
    In a soft parse, Oracle looks at the SQL, computes a hashcode from the SQL text and looks for an appropriate execution plan in its caches. A cache hit occurs, Oracle finds an existing execution plan and binds it to the PreparedStatement. Again, we're now ready for binding and execute(). In a parse, the vast bulk of the work and locking occurs in preparing an execution plan, so a soft parse is hugely better than a hard parse.
    Parse is avoided totally when new parameters are bound to an existing PreparedStatement and it's then executed. No parse is much better than a soft parse.
    You only get a soft parse in Oracle when the SQL matches EXACTLY; case, punctuation, and white space all matter. Also, retention in the cache depends on the memory available to Oracle, and the load on the system, in terms of number of different SQL statements being used. This is why it's so important to use parameter binding; "SELECT a FROM b WHERE c = 1;" is not an exact match for "SELECT a FROM b WHERE c = 2"; using ""SELECT a FROM b WHERE c = ?" allows the cache hit to occur.
    So coming back to the way you phrased your question: it would be better to use the same PreparedStatement object in both servlets, but because they're tied to a connection, that can be hard to achieve unless you've got a sophisticated database layer between you and the actual database (some of the better connection poolers also do statement caching if configured to do so). A good second best can be creating and using a new instance of PreparedStatement with IDENTICAL sql.
    Hope this clarifies...

  • PreparedStatement Synchronization Query

    Hi All,
    I hope this is the right place to post this query (heh)! In a Java Webapp I have around 30 PreparedStatement(s) stored as global variables. As it is possible that some of the PreparedStatement(s) will be executed by multiple users concurrently from different pages (i.e. sections of the code), in addition to the usual synchronization tags I have volatile boolean values to check whether a PreparedStatement is currently in use to prevent concurrent execution. For example:
    //  PreparedStatement is global, ResultSet is local.
    synchronized(this) {
      while (flagRaised) {
         try {
           wait();
         } catch (InterruptedException e) {
           // do nothing.
       flagRaised = true;
       try {
         preparedStatement.setString(1, "Pears");
         localResultSet = preparedStatement.executeQuery();
       } catch (SQLException e) {
         // log the problem
       flagRaised = false;
       notifyAll();
    }I believe that this is necessary for any "mutator" statements where I'm using "setXXXX", but if I had a statement that returned an entire table would I need to implement any additional synchronization code? For example could I simply have:
    localResultSet = preparedStatement.executeQuery(); // where the PreparedStatement returns a table.with no synchronization/volatile variables?
    Thanks in anticipation,
    Simon

    I fail to see why the above is necessary. Think of what you are doing: caching a PreparedStatement. Why?
    PreparedStatement, out of the box with a decent JDBC driver, will cache the parsed SQL query. Further, most RDBMS will also perform their own native cachine of query plans. (I will leave out the considerations of RDBMS cached execution plans, though they are also valid to the discussion). You are adding a level of pooling above and beyond what the vendor offers. This might be necessary if your own system, but have you benchmarked this? Do you 'know' the middleware parse of a PreparedStatement is your actual scaling bottleheck. IMO, this is a rare situation.
    Rather, understand what both your RDBMS and your JDBC driver's use of PreparedStatement already offer you. Premature optimization is the root of most software evil, at least according to Knuth. Sure you are not contributing to the same?
    - Saish

  • Statement or Prepared Statement???

    Hi,
    Since the PreparedStatement is a Precompiled Statement , can i use it for normal SQL statements where i need to pass a parameter for a select statement like:-
    Instead of this:-
    "Select name from employee where empId= "+empId
    Shall i use :-
    PreparedStatement ps=con.prepareStatement( "Select name from employee where empId= ?")
    Resultset rs=ps.executeQuery();
    if(rs.next()){
    rs.setString(1,empId);
    ps.executeUpdate();
    Which one is better here?? Where i havn't used PreparedStatement repeated execution of statement here. Pls. do provide a solution...
    Thanks,
    JavaCrazyLover

    why to go for normal Statement interface which operates
    during the runtime and slow??.Statement is not slow (unless you define what you mean by slow). They can be efficient in some situations. However, the difference in execution times using a PreparedStatement even in such cases is not very significant. So, it is advisable to always use PreparedStatement.

  • Jbo null pointer exception whilst creating an AM

    Hello,
    I am trying to create some EO's,VO's and associated AM. At the end of the creation, I tend to get the following error
    Load Error
    Exception: oracle.jbo.dt.objects.JboException(java.lang.NullPointerException).
    The creation of EO's runs smooth, but if I decide to create the associated VO's and the AM, the application hangs, and I have to kill it before I can move forward.
    Please guide me

    I am sorry I was ambiguous in my previous post.
    I am trying to create a EO/VO/AM triplet for a host of tables using JDev 11g, and the tables under the 'mct' database.
    I followed the following steps to create my triplet.
    1. Using the EO wizard, I selected a host of tables, for instance, MCT_CONFIG_CONTACT_CENTER_VL from the MCT db
    2. Following the usual steps, I tend to get the null pointer exception, with a 'load error' for one of the classes contained in a zip file, which I do not think I'm using, in the creation of the EO.
    In the light of the above scenario, can you please guide me?

  • Applets in jsp

    Hi:
    I'm trying to load the applet in my jsp page using <jsp:plugin tag . But it says nullpointerexception during execution. It works well with a html page but not with a jsp page.
    I'm using resin server and I use ekit(open source html editor) as the applet. I'm confused about the code and codebase attributes.
    Could anyone tell me how to deal with this.
    Thanks.

    code is the main applet class. codebase is the path to the directory that contains the class.

  • Doing Shift-End using Robot class

    I am trying to use the Robot class to do a Shift-End in order to select the text in a window from the cursor to the end of the line. However, the following code only moves the cursor to the end of the line without selecting the text.
    robot.keyPress(KeyEvent.VK_SHIFT);
    robot.keyPress(KeyEvent.VK_END);
    robot.keyRelease(KeyEvent.VK_END);
    robot.keyRelease(KeyEvent.VK_SHIFT);
    Note that I have been able to make the following code work. So the problem with the code above does not seem to be with the Shift key per se or with the ordering of the statements.
    robot.keyPress(KeyEvent.VK_SHIFT);
    robot.keyPress(KeyEvent.VK_A);
    robot.keyRelease(KeyEvent.VK_A);
    robot.keyRelease(KeyEvent.VK_SHIFT);
    Any idea how to make the Shift-End work? I am using an XP PC.

    My ENTIRE code follows. Not surprisingly, the shiftEnd.actionPerformed gets a nullPointerException during execution. And being new to Java, I get the feeling I might be missing a whole bunch of stuff. For example, do I need to register for events? Do I need to generate a shift-End ActionEvent somehow? It is only the last 4 lines that are at issue here. Everything down to that point accomplishes what I want, i.e., position the mouse in a text window in the upper right-hand corner of my screen, move the cursor to the top of that window, then go down 5 lines. At that point, I want to do the shift-End to select all text in the line.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.KeyStroke;
    import javax.swing.JTextField;
    public class KeyStrokeTest {
    /** Creates a new instance of KeyStrokeTest */
    public KeyStrokeTest() {
    * @param args the command line arguments
    public static void main(String[] args)
    throws AWTException{
    Robot robot = new Robot();
    // Position mouse over Test Director test
    robot.mouseMove(600,300);
    // Press and release left mouse button to set focus in Test Director test
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);
    // Go to top of Test Director test
    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_HOME);
    robot.keyRelease(KeyEvent.VK_CONTROL);
    robot.keyRelease(KeyEvent.VK_HOME);
    // Go down to first line of request
    for(int i=0;i<5;i++) {
    robot.keyPress(KeyEvent.VK_DOWN);
    robot.keyRelease(KeyEvent.VK_DOWN);
    robot.delay(1000);
    // Do a shift End
    KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_END,KeyEvent.VK_SHIFT);
    JTextField textComponent = new JTextField("String");
    ActionListener shiftEnd = textComponent.getActionForKeyStroke( keyStroke );
    shiftEnd.actionPerformed( null );

  • Scenario required for sd route and mm route

    Dear Guru
    There is two process for stock transfer order one is SD route and 2nd one is mm route
    can you please explain the differnce between these rout
    and what is the scenario required for sd route and mm route
    it means in which scenario we use sd route for stock transfer and in which scenario we use mm route for stock transfer
    Thanks in advance
    Kashyap

    Kashyup,
    I am not aware of 'SD Route vs MM Route'.  They are the same Route.
    STO is basically a special kind of Purchase order.  Purchase orders are part of the MM module. In order to permit shipping goods from one plant to another, SAP has 'borrowed' some of the functionality from the SD module.
    During Configuration of Stock Transport orders, you assign a Customer (Shipto), Sales org, and Distribution channel to the receiving plant.  When creating a STO, the system uses these data to determine the Route.
    Route contains info that the system uses to plan movement of goods from one location to another location in the SD module.  The route contains duration information (how long does it take to move goods from warehouse to customer location), factory calendar, and perhaps some other data.  In the case of an SD order, the system will find the customer for the Sales doc, the default shipping conditions for the customer, and using this information together with the region of the shipping point, will determine a route.
    This same determination procedure is also used during creation of a STO.  The system will take the STO customer from STO configuration, and the default shipping conditions for that customer, and using this information together with the region of the shipping point, will determine a Route.  The same determination procedure used by SD sales orders.
    When you are setting up your master data, and you have decided what the duration of transport time should be, it is important that your planned delivery time in your info records or in your material master be consistent with your shipping duration (pick/pack/route time).  This makes the execution (creation and shipment of STOs) stay consistent with planning (creation of STO purchase reqs) as far as timing is concerned.
    If your STOs use Deliveries, then the shipping information in the STO that was determined during creation (customer, shipping point, route, etc) will be copied to the delivery during delivery creation.
    Rgds,
    DB49

  • Execution of membership rules during creation event in OIM

    Hi,
    I have a question regarding the execution sequence of a role membership rule/s. As noted in the section "Orchestration Concepts" of the Oracle 11gR1 Developer's Guide (http://docs.oracle.com/cd/E21764_01/doc.1111/e14309/oper.htm#CCHJHFGE), there are 6 Orchestration stages:
    1. Validation: Stage to perform validation on the orchestration, such as validity of orchestration parameters. Orchestration parameter is the data that is required to carry out the orchestration operation.
    2. Preprocess: Stage to perform orchestration parameter manipulations or get approvals or perform Segregation of Duties (SoD) checks.
    3. Action: Stage in which the action takes place.
    4. Audit: Stage in which the auditing of operation is performed.
    5. Postprocess: Stage in which consequent operations related to the current operation takes place. Examples of consequent operations are auto role membership and policy evaluation on a user creation.
    6. Finalization: Last stage in the process to perform any clean up.
    The question is: If a role membership rule has been set up so that a user will be assigned a role if a particular user attribute is set during the preprocess or postprocess stage, when is the actual execution of the membership rule performed? i.e. in which orchestration stage is the role membership rule executed?
    regards,
    Evangelo
    Edited by: 953049 on 25-Sep-2012 22:04

    Custom Preprocess handler doesn't work in 11g. Are you sure? The documentation only states that it will not work for trusted reconciliation (from Oracle support article ID 1262803.1 - OIM11g: Sample Code For A Custom Event Handler Implemented for Pre-Process Stage During Create User Management Operation).

  • Select PreparedStatement execution slowdown overtime - Oracle 10.2.0.1

    This is a very confusing issue. We have a batch type application built on Hibernate using Oracle JDBC 10.2.0.1 drivers. Currently using a Spring configured connection pool (don't think this is the issue). Basically, the first step of the process involved looking up Subscriber information and related objects. This results in Hibernate pumping out lots and lots of sql, executing using PreparedStatement. I've profiled the code and the time is being spent in the execution of the SQL, post executeQuery call.
    At the beginning performance is great, but over time, after about 50,000 invocations of the Subscriber search, the execution time starts to increase eventually to the point where it is taking 5 times as long to do a search as it did at the beginning. I have checked the usual suspects (polling for a resource, memory consumption etc..) and they all appear to be fine. And as I said, it is actually on the call to PreparedStatement.executeQuery that the time seems to grow. I created a test harness using a set of 100,000 Subscriber ids, replicated 40 times, and I can really get the application to slow down.
    I've had a thought that it was maybe the size of TCP/IP buffer that maybe Hibernate was saturating the buffer.. I would prefer not to go playing with this, but I will if it's the way to go.
    Has anyone come across this before. Is there some Oracle database kernal setting that I should be looking at here? I could really do with a little here so any advise given is much appreciated.
    Jay

    At the risk of stating the obvious...
    UAT and Prod both use 10.2.0.3 and both work correctly. The 10.2.0.3 patchset has not yet been applied on dev, so dev is using an outdated version of Oracle. Why wouldn't you apply the 10.2.0.3 patchset to the dev environment and see if that solves the problem?
    More generally, it seems very wrong to be running a later version of the database in UAT and in Prod than in dev. It seems particularly wrong to have a 10.1 development environment for a 10.2 production environment. It's also rather odd to have the development environment using Windows when the production environment is on Unix since that means any operating system dependent issues have to be discovered during UAT, which isn't particularly helpful.
    Justin

  • Creation & Execution of Assement Cycles & Distribution cycle

    HI
    what is T.code for Creation of Disribution cycle and Execution
    What is T.code for Creation of Assesment cycle and Execution of this Cycle
    Regards
    sure

    Hi,
    Cost Center Distribution cycle crreation Tr. Code KSV1 and Tr. code execution KSV5
    Cost Center Assessment cycle creation Tr. code KSU1 and Tr. code executation KSU5.
    Trust this helps much!
    Cheers!

  • Automatic Activity Creation during the Campaign Execution

    Hi Experts,
    I have the following requirement.
    If I run a campaign then a corresponding activity should be created in the CRM system.
    Ex; If a mail Invitation to a Tradeshow is sent to 10 customers then 10 Activities should be created for each of the 10 Customers.
    Does anyone know how to achieve this.
    We are using SAP CRM 2007
    Cheers,
    Arun

    Hi,
    First create Activity Template for activity.
    Under communication medium define followings:
    Communication Medium: ZXXX - Email/Activities
    Communication Methods and Transaction Types
    Priority 7 - () Generate Contact - assign Transaction type (Activity Template)
    Define Communication Methods for BP-Determined
    3 Internet Mail (SMTP)
    7 Generate Contact - assign Transaction type (Activity Template)
    During Campaign creation under Channel you need to fill 'Email Form' assignment
    also fill Activity template.
    Once Campaign ready for execution, click on button, it will send email and also create activities using template for those BPs included in segment.

  • LongTerm Planning-Demand Creation,MRP Execution

    Hi,
    Can anyone explain me what is meant by Longterm planning. What are the Tcodes used for using LongTerm Planning.
    How can we say that a given material is planned by Longterm Planning?.
    How to create demand in Longterm planning and then execute MRP in Longterm planning?.
    Thanks in advance.

    Hi,
    LTP - Long Term Planning is one of the planning tool provided by SAP for the planning puropses. It has got multiple usgaes, for production planning, procurement planning or for budget control etc. Why it is used depends mainly on what kind of business one is doing, what kind of products a company is producing. Mainly we do LTP for MTS scenarios. In MTO scenarios also we can use LTP.
    As the name says it is used for the planning purpose only and we can do multiple plannings by using inactive planning versions available or by creationg them. Analyse the result of the planning in inactive version and subsequntly convert or transfer inactive plan to active demand plan and execute the processes in a normal way.
    Main object in LTP is the creation of planning scenarios, which contains details reagrding validity dates of scenario, which all objects need to be considered for planning (viz, production orders, sales orders, PO, PR, planned orders , stocks, capacity, BOM explosion etc check t code MS31/MS32/MS33 etc), the plants where LTP is going to be used,  what is the inactive version is going to be used etc. The creation of scenario helps in simulaitong the planning results.
    Demand for LTP will be created in a normal way as we do it in DM. You can also use SOP to transfer data to LTP.
    You use planning scenarios created earlier whenever you run LTP. The result of LTP are inactive plans and nonconvertibles. You can use MRP result only for the analysis purpose. You do this analysis lutliple times by using different planning scenarios for the same bunch of materials. When you feel one of the scenario/simulation is giving proper results then you can convert that inactive planning to active plan and proceed ahead with normal execution cycle.
    Hope this will help.
    Regards,
    Pavan

Maybe you are looking for