This discussion is archived
3 Replies Latest reply: May 3, 2011 2:04 PM by DrClap RSS

method inside Session.class file in deployed jar being called instead of ..

856967 Newbie
Currently Being Moderated
I created a project and deployed that project as a jar.

I am clicking rightclick->Session.java -> RUN and its supposed to run and connect to an application. Instead of connecting to Session.java at runtime, the Session.class file inside the jar file is being called, how to stop this and call methods inside the Session.java ?

Thanks,
Arty
  • 1. Re: method inside Session.class file in deployed jar being called instead of ..
    804091 Explorer
    Currently Being Moderated
    For starters, code in ".java" files are NOT executed. ".java" files simply hold the source code that gets compiled into ".class" files, which holds the code that gets executed. So no matter how you try to run a Java application, you will never execute code in a .java file.

    Also, when you say...
    I am clicking rightclick->Session.java -> RUN
    Where are you doing this? Is this right in your OS? Is this happening in an IDE? Maybe in some other apparatus? Please be much more specific in what you are doing and what you are trying to accomplish.
  • 2. Re: method inside Session.class file in deployed jar being called instead of ..
    856967 Newbie
    Currently Being Moderated
    It is in JDeveloper. I have a class created "Session.java". In this class, I am trying to make a call to external application using SSO, which utilizes URL, UserID and Password.

    public static void main(String[] args) {
    try {
    System.out.println("contacting CRMOD");

    session.logon("https://secure-a.crmondemand.com",
    "USERID", "PASSWORD");
    System.out.println("called the logon method");
    } catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    }


    System.out.println("sessionId=" + session.jsessionid);

    }

    session.logon here, calls a method logon written inside the same Session.java class and gets the user id and password and should ideally enter the external application CRMOD - this is the ideal situation. In my case, the method overriding does not happen. the session.logon does not override the logon method inside the same class and returns a null, the description of the error message is as below :-


    \wlsafclient.jar;C:\Oracle\Middleware\oracle_common\modules\oracle.xdk_11.1.0\xsqlserializers.jar;\Oracle\Middleware\OC4J\jlib\javax-ssl-1_1.jar;\Oracle\Middleware\OC4J\jlib\jaxen.jar;\Oracle\Middleware\OC4J\jlib\jssl-1_1.jar;\Oracle\Middleware\OC4J\jlib\ldapjclnt10.jar;\Oracle\Middleware\OC4J\jlib\ojpse.jar;\Oracle\Middleware\OC4J\jlib\oraclepki.jar;\Oracle\Middleware\OC4J\jlib\osdt_cert.jar;\Oracle\Middleware\OC4J\jlib\osdt_core.jar;\Oracle\Middleware\OC4J\jlib\osdt_saml.jar;\Oracle\Middleware\OC4J\jlib\osdt_wss.jar;\Oracle\Middleware\OC4J\jlib\osdt_xmlsec.jar;C:\JDeveloper\mywork\AREA_CODE_006\CRM\deploy\car.jar session.Session ----->this is the Session.class packed up in the jar file called car.jar
    contacting CRMOD --this is system.out.println message
    null system.out.println message
    java.lang.NullPointerException
         at session.Session.main(Session.java:195)
    Exception in thread "main" java.lang.NullPointerException
         at session.Session.main(Session.java:204)
    Process exited with exit code 1.
  • 3. Re: method inside Session.class file in deployed jar being called instead of ..
    DrClap Expert
    Currently Being Moderated
    I don't think it's anything as complicated or confusing as that. I think it's simply that the code which you didn't show before
    session.logon("https://secure-a.crmondemand.com", "USERID", "PASSWORD");
    didn't assign any value to the "session" variable, and therefore you get a plain ordinary NullPointerException.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points