Results 1 to 7 of 7
  1. #1
    raymasuku is offline Member
    Join Date
    Nov 2013
    Posts
    4
    Rep Power
    0

    Default null pointer exception

    Hi I have developed an enterprise application, consisting of an ejb module, web app and also an enterprise client(desktop). I have designed a two fields form that will post to the database. Here’s how my app looks like: EJB container consists of an entity class, as stateful session bean and also a remote bean for accessing it as remote client which consists of my business methods. Then i also did a web service from the session bean i created.

    From my client, i have created a web service client to communicate with the web service deployed on the ejb module. i have also dragged the method that i want to use to my form that i want to send data with. Im getting a null pointer exception.

    It points to this stack trace

    stack trace : private static Registration register(java.lang.String name, java.lang.String surname) {
    com.dariunhouse.ws.RegistrationWSSS port = service.getRegistrationWSSSPort();
    return port.register(name, surname);

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,710
    Rep Power
    5

    Default Re: null pointer exception

    That's not a stacktrace, that's code. Which line is the one causing the exception? Of course there are two basic options; either service is null (probably meaning that it isn't injected), or port is null. My money is on service being null, but without any code to see how that is initialized, I can't say anything for sure.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    raymasuku is offline Member
    Join Date
    Nov 2013
    Posts
    4
    Rep Power
    0

    Default Re: null pointer exception

    Quote Originally Posted by gimbal2 View Post
    That's not a stacktrace, that's code. Which line is the one causing the exception? Of course there are two basic options; either service is null (probably meaning that it isn't injected), or port is null. My money is on service being null, but without any code to see how that is initialized, I can't say anything for sure.
    Thanks for the reply

    The exception is as follows : exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

    at GUI.regForm.register(regForm.java:152)
    The line 152 code looks like this :
    private static Registration register(java.lang.String name, java.lang.String surname) {
    com.dariunhouse.ws.RegistrationWSSS port = service.getRegistrationWSSSPort();
    return port.register(name, surname);

    and another points to this button : at GUI.regForm.btnSubmitActionPerformed(regForm.java: 92)
    and this is how the button looks this : private void btnSubmitActionPerformed(java.awt.event.ActionEven t evt) {
    Registration result = register(txtName.getText(), txtSurname.getText());
    if (result.equals("success")) {
    JOptionPane.showMessageDialog(null, "Transaction Added", "Transactions", JOptionPane.WARNING_MESSAGE);
    //System.out.println();
    } else {
    // clearFields();
    JOptionPane.showMessageDialog(null, "Transaction Fialed!");

    I can send you a screen shot of how my classes looks like but i dont know how to attach them here, please advice

  4. #4
    raymasuku is offline Member
    Join Date
    Nov 2013
    Posts
    4
    Rep Power
    0

    Default Re: null pointer exception

    Hey gimbal2 , i just want to ask a quick question , does enabling contexts and dependency injection or disabling it have an impact on what im trying to solve now

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,710
    Rep Power
    5

    Default Re: null pointer exception

    I suggest you try it out.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    raymasuku is offline Member
    Join Date
    Nov 2013
    Posts
    4
    Rep Power
    0

    Default Re: null pointer exception

    Hmm just did it still show me the same output

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,710
    Rep Power
    5

    Default Re: null pointer exception

    Well there you go, you just proved that it doesn't make a difference, so something else is wrong. Keep searching.

    Meanwhile you haven't provided anything that I asked for. Just how does your code fill that 'service' object reference for which at this point I still have to only guess is the one that is null? Which line EXACTLY is throwing the exception? You just re-posted exactly what you had already posted which is just not helpful at all, how am I to know which line is the one that is causing the problems?

    Surely you know that you can find the line that is causing the problem in the exception stacktrace that you are not posting, right? Exception handling is very basic Java knowledge, if you're working with something as complicated as EJBs and webservices then you must know the basics of the basics.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Why I am getting null pointer exception?
    By ashvini in forum New To Java
    Replies: 6
    Last Post: 04-03-2013, 06:02 PM
  2. null pointer exception
    By bequick01 in forum New To Java
    Replies: 3
    Last Post: 04-28-2011, 08:31 PM
  3. Null pointer exception?
    By coffee in forum New To Java
    Replies: 4
    Last Post: 08-03-2009, 03:22 AM
  4. Null Pointer Exception
    By ScKaSx in forum New To Java
    Replies: 1
    Last Post: 01-24-2009, 11:27 AM
  5. Null Pointer Exception
    By demiser55 in forum New To Java
    Replies: 1
    Last Post: 09-22-2008, 06:33 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •