Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:45:36+00:00 2026-06-01T17:45:36+00:00

I am trying to make an Enterprise Application but facing a very strange error.

  • 0

I am trying to make an Enterprise Application but facing a very strange error.

Whenever i try to call enterprise application’s facade from any class other than Main, I am get an InvocationTargetException.

Here is my code: –

public class TellerMachine {
    @EJB
    private static BillerFacadeRemote billerFacade;

    @EJB
    private static AccountFacadeRemote accountFacade;
    @EJB
    private static CustomerFacadeRemote customerFacade;
    @EJB
    private static BanktellerFacadeRemote banktellerFacade;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        TellerMachine tm = new TellerMachine();
        Scanner s = new Scanner(System.in);
        String sssa = billerFacade.hiHAHAHAHA();
        System.out.println(sssa);
        tm.printABC();
        TestClass t = new TestClass();
        t.abc();
    }

    public void printABC()
    {
        String sssa = billerFacade.hiHAHAHAHA();
        System.out.println(sssa);  
    }
}

Test Class: –

public class TestClass 
{
@EJB
private static BillerFacadeRemote billerFacade;
public static void main(String[] args)
{

}
public void abc()
{
    try{
    String a = billerFacade.hiHAHAHAHA();
    System.out.println(a);}
    catch(Exception e)
    {
        System.out.println(e.getCause().toString());
    }
}

}

Method in BillerFacade: –

@Override
public String hiHAHAHAHA() {
    return "abc";
}

Stack Trace: –

Warning: /Users/varunbatra/Desktop/RealApp/SwinBankTellerMachine/dist/gfdeploy/SwinBankTellerMachine does not exist.
abc
abc
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:438)
    at org.glassfish.appclient.client.AppClientFacade.main(AppClientFacade.java:165)
Caused by: java.lang.NullPointerException
    at swinbanktellermachine.TestClass.abc(TestClass.java:29)
    at swinbanktellermachine.TellerMachine.main(TellerMachine.java:52)
    ... 6 more
Java Result: 1

Why it’s like that? and sometime even i am calling the remote method from my Main class it still gives me this Exception. What’s the matter with Netbeans? Sometime it works sometime it doesn’t. Please Help and clear my confusion.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:45:38+00:00Added an answer on June 1, 2026 at 5:45 pm

    According to this stackoverflow discussion and the referenced EJB specification, static injection is only allowed in the application main class. Therefore, the injection works for your TellerMachine class but not for called TestClass instance from within the TellerMachine main method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying make a segue call in a tableview , but the application
im trying make one replace in string from a array but this dont work
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server
Trying to make a MySQL-based application support MS SQL, I ran into the following
Trying to make a web service call to an HTTPS endpoint in my Silverlight
trying to make a page which will recursively call a function until a limit
I am trying to develop an enterprise application which needs to list all the
trying to make 5 curl childs for curl handler and defining them, but can't
Trying to make a simple application in rails 3. If I create a team
Trying to make a setup for my application. However, I am having trouble getting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.